:root {
  --bg: #f0f4f8;
  --bg2: #e2e8f0;
  --card: #ffffff;
  --border: rgba(0,0,0,0.08);
  --border-strong: rgba(0,0,0,0.15);
  --sky: #0284c7;
  --green: #16a34a;
  --muted: #94a3b8;
  --muted2: #64748b;
  --text: #334155;
  --text-bright: #0f172a;
  --midsea: #0284c7;
  --sog: #16a34a;
  --eilat: #ea580c;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Rajdhani', sans-serif;
  font-size: 15px;
  min-height: 100vh;
}
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 70% 40% at 15% 10%, rgba(2,132,199,0.06) 0%, transparent 70%),
    radial-gradient(ellipse 50% 30% at 85% 90%, rgba(22,163,74,0.04) 0%, transparent 70%);
}

/* ── HEADER ── */
header {
  position: sticky; top: 0; z-index: 100;
  height: 56px;
  background: rgba(255,255,255,0.95);
  border-bottom: 1px solid var(--border-strong);
  backdrop-filter: blur(10px);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 1.5rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.logo { display: flex; align-items: center; gap: 0.7rem; justify-self: start; }
.logo-title {
  font-size: 1.2rem; font-weight: 700; letter-spacing: 0.12em;
  color: var(--sky); text-transform: uppercase;
  line-height: 1.1;
}
.header-center {
  display: flex; align-items: center; gap: 1rem; justify-self: center;
}
.header-right { display: flex; align-items: center; gap: 0.9rem; justify-self: end; flex-shrink: 0; }
.last-update-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.6rem; color: var(--muted); letter-spacing: 0.05em;
}

/* ── HEADER BUTTONS ── */
.settings-btn,
.refresh-btn {
  background: transparent;
  border: none;
  color: var(--sky);
  padding: 0.28rem 0.4rem; border-radius: 4px;
  cursor: pointer; display: flex; align-items: center;
  transition: opacity 0.18s;
}
.settings-btn:hover,
.refresh-btn:hover { opacity: 0.7; }
.refresh-btn:disabled { opacity: 0.3; cursor: default; }
.refresh-btn.spinning .r-icon { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── DIALOGS ── */
.dialog-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.25);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}
.dialog-overlay.open { opacity: 1; visibility: visible; }
.dialog {
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 1.5rem;
  width: 380px;
  max-width: calc(100vw - 2rem);
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  transform: translateY(8px);
  transition: transform 0.2s;
}
.dialog-overlay.open .dialog { transform: translateY(0); }
.dialog-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem;
}
.dialog-title {
  font-size: 1rem; font-weight: 700; letter-spacing: 0.06em;
  color: var(--text-bright); text-transform: uppercase;
}
.dialog-close {
  background: none; border: none; cursor: pointer;
  color: var(--muted2); font-size: 1.2rem; line-height: 1;
  padding: 0.1rem 0.3rem; border-radius: 3px;
  transition: background 0.15s;
}
.dialog-close:hover { background: rgba(0,0,0,0.07); }
.dialog-section { margin-bottom: 1.1rem; }
.dialog-section:last-child { margin-bottom: 0; }
.dialog-section-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.6rem; letter-spacing: 0.2em; color: var(--muted2);
  text-transform: uppercase; margin-bottom: 0.5rem;
}
.dialog-footer {
  border-top: 1px solid var(--border);
  margin-top: 0.5rem; padding-top: 1rem;
  display: flex; align-items: center; justify-content: space-between;
}
.dialog-status {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.6rem; letter-spacing: 0.1em; color: var(--muted2);
}
.restore-btn {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--muted2);
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.65rem; letter-spacing: 0.1em;
  padding: 0.35rem 1rem; border-radius: 20px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; line-height: 1;
  transition: border-color 0.15s, color 0.15s;
  text-transform: uppercase;
}
.restore-btn:hover { border-color: rgba(0,0,0,0.3); color: var(--text-bright); background: rgba(0,0,0,0.04); }

/* ── PILLS ── */
.filter-group { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.filter-pill {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.68rem; letter-spacing: 0.08em;
  padding: 0.28rem 0.8rem; border-radius: 20px;
  border: 1px solid var(--border-strong);
  background: transparent; color: var(--muted2);
  cursor: pointer; transition: all 0.18s; text-transform: uppercase;
}
.filter-pill:hover { color: var(--text-bright); border-color: rgba(0,0,0,0.3); background: rgba(0,0,0,0.04); }
.filter-pill.active { background: var(--sky); border-color: var(--sky); color: #fff; font-weight: 700; }

/* ── MAIN ── */
main {
  position: relative; z-index: 1;
  max-width: 1200px; margin: 0 auto;
  padding: 1.5rem 1.125rem 3rem;
}

/* ── REGION SECTION ── */
.region-section { margin-bottom: 2rem; }
.region-header {
  display: flex; align-items: flex-end; gap: 0.75rem;
  margin-bottom: 0; padding-bottom: 0.3rem;
}
.region-title {
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.25em;
  text-transform: uppercase; color: var(--sky); padding-left: 2px;
  display: flex; align-items: baseline; gap: 0.5rem;
}
.region-title-he {
  font-family: inherit;
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.25em;
  text-transform: none; color: var(--sky);
}
.region-title-he::before {
  content: '|';
  margin-right: 0.5rem;
}
.region-count { font-family: 'Share Tech Mono', monospace; font-size: 0.62rem; color: var(--muted2); margin-left: auto; }

/* ── TABLE ── */
.wind-table-wrap {
  border: 1px solid var(--border-strong);
  border-radius: 6px; overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.wind-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.wind-table thead tr { background: #f8fafc; }
.wind-table th {
  padding: 0.35rem 0.7rem; padding-top: calc(0.35rem + 1px);
  text-align: left; vertical-align: middle;
  font-family: 'Share Tech Mono', monospace; font-size: 0.6rem;
  letter-spacing: 0.18em; color: var(--muted2);
  text-transform: uppercase; font-weight: 400;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}
.wind-table th.th-center { text-align: center; }
.wind-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
  background: #ffffff;
}
.wind-table tbody tr:last-child { border-bottom: none; }
.wind-table tbody tr:hover { background: #f0f9ff; }
.wind-table td { padding: 0; vertical-align: middle; }

/* ── WINDGURU LINK ── */
.td-wg { text-align: center; width: 32px; padding: 0 !important; }
.wg-link {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 38px;
  color: #64748b; text-decoration: none;
  transition: color 0.15s; opacity: 1;
}
.wg-link:hover { color: var(--sky); }

/* ── EXPAND BUTTON ── */
.td-expand { text-align: center; width: 32px; padding: 0 !important; }
.expand-btn {
  background: none; border: none; cursor: pointer;
  color: #64748b; padding: 0.3rem 0.4rem;
  display: flex; align-items: center; justify-content: center;
  transition: color 0.15s, transform 0.25s;
  width: 100%; min-height: 38px;
}
.expand-btn:hover { color: var(--sky); }
.expand-btn.open { color: var(--sky); transform: rotate(180deg); }

/* ── FORECAST PANEL ── */
.forecast-row td { padding: 0 !important; background: #f1f5f9; }
.forecast-row { display: none; }
.forecast-row.open { display: table-row; }
.forecast-panel { padding: 1rem 1.2rem 1.2rem; border-top: 1px solid var(--border-strong); }
.forecast-loading {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.7rem; color: var(--muted2); letter-spacing: 0.1em;
}

/* ── CELLS ── */
.td-name { min-width: 155px; padding: 0.3rem 0.7rem !important; }
.st-en { font-weight: 600; font-size: 0.88rem; color: var(--text-bright); letter-spacing: 0.02em; }
.st-he { font-family: 'Noto Sans Hebrew', sans-serif; font-size: 0.72rem; color: var(--muted2); direction: rtl; text-align: left; margin-top: 0; }
.td-wind { text-align: center; width: 80px; height: 100%; padding: 0 !important; }
.wind-val {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%; min-height: 38px;
  font-family: 'Inter', 'DM Sans', system-ui, sans-serif;
  font-size: 0.8rem; font-weight: 600; letter-spacing: 0.01em;
  transition: background 0.4s, color 0.4s;
}
.td-dir { text-align: center; width: 50px; padding: 0.3rem 0.3rem 0.3rem calc(0.3rem + 2px) !important; }
.dir-wrap { display: flex; align-items: center; justify-content: center; }
.dir-arrow { font-size: 1.5rem; line-height: 1; color: #000; font-weight: 900; display: inline-block; }
.td-status { text-align: center; width: 42px; }
.st-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.st-dot.ok      { background: var(--green); box-shadow: 0 0 4px rgba(22,163,74,0.5); }
.st-dot.err     { background: #dc2626; box-shadow: 0 0 4px rgba(220,38,38,0.5); }
.st-dot.loading { background: var(--muted); animation: pulse 1s ease-in-out infinite; }
.st-dot.stale   { background: #f59e0b; box-shadow: 0 0 4px rgba(245,158,11,0.6); animation: pulse 1.5s ease-in-out infinite; }
.st-dot.none    { background: #cbd5e1; }
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:0.5;transform:scale(1.4)} }

/* ── SHIMMER ── */
.shimmer {
  display: inline-block; width: 46px; height: 16px; border-radius: 3px;
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.err-msg { font-family: 'Share Tech Mono', monospace; font-size: 0.62rem; color: #dc2626; }
.no-id   { font-family: 'Share Tech Mono', monospace; font-size: 0.62rem; color: var(--muted); font-style: italic; }

/* ── FOOTER ── */
footer {
  position: relative; z-index: 1;
  text-align: center; padding: 1.5rem;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.58rem; color: var(--muted); letter-spacing: 0.15em;
  border-top: 1px solid var(--border);
  background: #fff;
}

@media (max-width: 700px) {
  header { display: flex; flex-wrap: nowrap; height: auto; padding: 0.6rem 1rem; gap: 0.4rem; }
  .logo { flex: 1; justify-self: unset; }
  .header-center { display: none; }
  .header-right { gap: 0.3rem; flex-shrink: 0; justify-self: unset; }
  main { padding: 1rem 1.125rem 3rem; }
  .wind-table th, .wind-table td { padding: 0.4rem 0.5rem; }
}

@media (max-width: 480px) {
  .header-right { gap: 0.15rem; }
  main { padding: 1rem 0.75rem 3rem; }
}
