/* ─── RESET & VARIABLES ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green-dark:  #1b5e20;
  --green:       #2e7d32;
  --green-med:   #388e3c;
  --green-light: #558b2f;
  --amber:       #f57f17;
  --orange:      #e65100;
  --red:         #c62828;
  --bg:          #f0f4f0;
  --card-bg:     #ffffff;
  --text:        #212121;
  --text-muted:  #666;
  --border:      #e0e0e0;
  --radius:      12px;
  --shadow:      0 2px 8px rgba(0,0,0,.10);
}

html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ─── NAV ────────────────────────────────────────────────────────── */
nav {
  background: var(--green-dark);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 52px;
  position: sticky;
  top: 0;
  z-index: 1000;
}
nav .logo {
  font-size: 1.4rem;
  font-weight: 900;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.5px;
  white-space: nowrap;
}
nav .logo span { color: #a5d6a7; }
nav ul { list-style: none; display: flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; }
nav ul li a {
  color: #c8e6c9;
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  white-space: nowrap;
  transition: background 0.15s;
}
nav ul li a:hover { background: rgba(255,255,255,.12); color: #fff; }
.nav-dropdown { position: relative; }
.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
  min-width: 200px;
  padding: 0.4rem 0;
  z-index: 2000;
}
.nav-dropdown:hover .dropdown-menu,
.nav-dropdown:focus-within .dropdown-menu { display: block; }
.dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  color: var(--text);
  font-size: 0.9rem;
}
.dropdown-menu a:hover { background: #f5f5f5; }
.dd-icon { font-size: 1rem; }

/* ─── LOCATION BAR ───────────────────────────────────────────────── */
.loc-bar {
  background: var(--green);
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.loc-left, .loc-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
#loc-select {
  padding: 0.45rem 0.75rem;
  border: none;
  border-radius: 8px;
  font-size: 0.92rem;
  font-family: inherit;
  background: rgba(255,255,255,.95);
  color: var(--text);
  min-width: 220px;
  max-width: 320px;
  cursor: pointer;
}
.btn-icon {
  padding: 0.42rem 0.85rem;
  border: 1.5px solid rgba(255,255,255,.55);
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn-icon:hover { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.8); }
.btn-icon.saved { background: rgba(255,255,255,.2); border-color: #fff; color: #fff; }
.btn-primary {
  padding: 0.45rem 1rem;
  border: none;
  border-radius: 8px;
  background: #fff;
  color: var(--green-dark);
  font-size: 0.88rem;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.12s;
  white-space: nowrap;
}
.btn-primary:hover { background: #e8f5e9; transform: translateY(-1px); }
.btn-icon.small { font-size: 0.8rem; padding: 0.3rem 0.6rem; }

/* ─── LOCATION HEADER ────────────────────────────────────────────── */
.loc-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1rem 1.25rem 0.5rem;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.loc-name {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--green-dark);
  line-height: 1.2;
}
.loc-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.meta-tag {
  background: #e8f5e9;
  color: var(--green);
  border-radius: 4px;
  padding: 0.1rem 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
}
.loc-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}
.last-updated {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  margin-top: 0.2rem;
}

/* ─── DASHBOARD GRID ─────────────────────────────────────────────── */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
  padding: 0.9rem 1.25rem 1.5rem;
}
.card-full { grid-column: 1 / -1; }

@media (min-width: 900px) {
  .dash-grid {
    grid-template-columns: 300px 1fr 1fr;
    grid-template-rows: auto auto auto;
  }
  #gonogo-card  { grid-column: 1; grid-row: 1 / 3; }
  #river-card   { grid-column: 2; grid-row: 1; }
  #weather-card { grid-column: 3; grid-row: 1; }
  #alerts-card  { grid-column: 2; grid-row: 2; }
  #solunar-card { grid-column: 3; grid-row: 2; }
  #forecast3-card { grid-column: 1 / -1; }
}

/* ─── CARD BASE ───────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  min-height: 120px;
}
.card-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

/* ─── GO/NO GO CARD ──────────────────────────────────────────────── */
.gonogo-inner {
  text-align: center;
  padding: 0.5rem 0 0.75rem;
}
.gonogo-score {
  font-size: 4rem;
  font-weight: 900;
  line-height: 1;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 6px solid;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.65rem;
  transition: color 0.4s, border-color 0.4s;
}
.gonogo-label {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  transition: color 0.4s;
}
.gonogo-sublabel {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}
.gonogo-factors {
  margin-top: 1rem;
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.factor-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
}
.factor-row.pos { background: #e8f5e9; }
.factor-row.neg { background: #fff8f8; }
.factor-icon { font-size: 1rem; flex-shrink: 0; }
.factor-text { flex: 1; color: var(--text); }
.factor-impact {
  font-weight: 700;
  font-size: 0.78rem;
  margin-left: auto;
}
.factor-row.pos .factor-impact { color: var(--green); }
.factor-row.neg .factor-impact { color: var(--red); }

/* ─── RIVER CARD ─────────────────────────────────────────────────── */
.river-stage {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin-bottom: 0.2rem;
}
.stage-val {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.trend {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-muted);
}
.trend.rising { color: var(--orange); }
.trend.falling { color: var(--green); }
.river-cfs {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}
.status-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.status-badge.good    { background: #e8f5e9; color: var(--green); }
.status-badge.caution { background: #fff3e0; color: var(--orange); }
.status-badge.bad     { background: #ffebee; color: var(--red); }
.gauge-note { font-size: 0.73rem; color: #aaa; margin-top: 0.3rem; }

/* ─── WEATHER CARD ───────────────────────────────────────────────── */
.weather-main { margin-bottom: 0.6rem; }
.weather-temp {
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1.1;
}
.temp-sep { color: var(--border); margin: 0 0.15rem; }
.temp-low { font-size: 1.2rem; color: var(--text-muted); font-weight: 600; }
.weather-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}
.weather-details {
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.weather-detail-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
  border-top: 1px solid var(--border);
  padding-top: 0.5rem;
  margin-top: 0.4rem;
}

/* ─── ALERTS CARD ────────────────────────────────────────────────── */
.alerts-list { display: flex; flex-direction: column; gap: 0.5rem; }
.alert-item {
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  font-size: 0.82rem;
  line-height: 1.4;
}
.alert-item strong { display: block; margin-bottom: 0.15rem; }
.alert-high { background: #ffebee; border-left: 3px solid var(--red); }
.alert-high strong { color: var(--red); }
.alert-mod { background: #fff8e1; border-left: 3px solid var(--amber); }
.alert-mod strong { color: #a37000; }
.alert-clear {
  padding: 0.65rem 0.75rem;
  background: #e8f5e9;
  border-radius: 8px;
  font-size: 0.88rem;
  color: var(--green);
  font-weight: 600;
}

/* ─── SOLUNAR CARD ───────────────────────────────────────────────── */
.sol-rating {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 0.6rem;
}
.sol-bar-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}
.sol-bar-track {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.sol-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}
.sol-bar-label { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; }
.sol-status { margin-bottom: 0.75rem; }
.period-badge {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
}
.period-badge.major { background: #e8f5e9; color: var(--green); }
.period-badge.minor { background: #fff8e1; color: #a37000; }
.period-badge.none  { background: #f5f5f5; color: var(--text-muted); }
.sol-windows-title {
  font-size: 0.73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}
.sol-windows { display: flex; flex-direction: column; gap: 0.3rem; }
.sol-win {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-size: 0.8rem;
}
.sol-win.major { background: #e8f5e9; }
.sol-win.minor { background: #fff8e1; }
.win-type { font-weight: 700; font-size: 0.72rem; text-transform: uppercase; color: var(--text-muted); }
.win-time { font-weight: 600; color: var(--text); }

/* ─── 3-DAY FORECAST CARD ────────────────────────────────────────── */
.fc3-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}
.fc3-day {
  text-align: center;
  padding: 0.75rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fafafa;
}
.fc3-label { font-size: 0.82rem; font-weight: 700; color: var(--text-muted); margin-bottom: 0.3rem; }
.fc3-moon { font-size: 1.6rem; margin-bottom: 0.3rem; }
.fc3-rating { font-size: 1rem; font-weight: 800; margin-bottom: 0.3rem; }
.fc3-window { font-size: 0.73rem; color: var(--text-muted); line-height: 1.4; }

/* ─── MAP SECTION ────────────────────────────────────────────────── */
.map-section {
  margin: 0 1.25rem 1.5rem;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: all 0.25s;
}
.map-section.hidden { display: none; }
.map-header {
  background: var(--green-dark);
  color: #fff;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.88rem;
  font-weight: 600;
}
.map-header .btn-icon { border-color: rgba(255,255,255,.4); font-size: 0.78rem; padding: 0.25rem 0.55rem; }
#map { height: 320px; }

/* ─── SKELETON LOADING ───────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, #e8e8e8 25%, #f4f4f4 50%, #e8e8e8 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px;
  height: 1.1rem;
  margin-bottom: 0.5rem;
}
.skeleton.short { width: 60%; }
.skeleton.tall { height: 3rem; }
.skeleton.circle {
  width: 80px; height: 80px;
  border-radius: 50%;
  margin: 0 auto 0.75rem;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── NO DATA ────────────────────────────────────────────────────── */
.no-data { font-size: 0.88rem; color: var(--text-muted); font-style: italic; }

/* ─── TOAST ──────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #212121;
  color: #fff;
  padding: 0.6rem 1.4rem;
  border-radius: 24px;
  font-size: 0.88rem;
  font-weight: 600;
  z-index: 9999;
  transition: transform 0.3s ease;
  pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ─── FOOTER ─────────────────────────────────────────────────────── */
footer {
  background: var(--green-dark);
  color: #c8e6c9;
  text-align: center;
  padding: 1.5rem 1rem;
  font-size: 0.82rem;
  margin-top: 1rem;
}
.footer-links { display: flex; justify-content: center; gap: 1.25rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.footer-links a { color: #a5d6a7; text-decoration: none; }
.footer-links a:hover { color: #fff; }

/* ─── ACCESSIBILITY ──────────────────────────────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

/* ─── RESPONSIVE ─────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .dash-grid { grid-template-columns: 1fr; padding: 0.75rem; }
  .loc-bar { padding: 0.6rem 0.75rem; }
  .loc-header { padding: 0.75rem 0.75rem 0.4rem; }
  #loc-select { min-width: 0; max-width: 100%; flex: 1; font-size: 0.85rem; }
  .gonogo-score { font-size: 3rem; width: 100px; height: 100px; }
  .fc3-grid { grid-template-columns: 1fr; }
  nav ul { display: none; }
}
@media (max-width: 480px) {
  .loc-right { gap: 0.35rem; }
  .btn-icon { padding: 0.38rem 0.6rem; font-size: 0.8rem; }
}
