/* ============================================================
   DESIGN SYSTEM — Dark Astronomical Theme
   ============================================================ */
:root {
  --bg-void: #060810;
  --bg-deep: #0a0e1a;
  --bg-card: #0f1424;
  --bg-elevated: #161c2e;
  --bg-surface: #1c2438;
  --bg-hover: #222b40;
  --accent-sky: #4f9cf9;
  --accent-glow: #7eb8ff;
  --accent-warm: #ff9f43;
  --accent-cold: #74b9ff;
  --accent-storm: #a29bfe;
  --accent-success: #3ddc97;
  --accent-info: #4f9cf9;
  --accent-sun: #ffd32a;
  --text-primary: #f0f4ff;
  --text-secondary: #8899bb;
  --text-muted: #657496;
  --border-subtle: rgba(79,156,249,0.08);
  --border-mid: rgba(79,156,249,0.15);
  --border-strong: rgba(79,156,249,0.3);
  --font-display: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --shadow-card: 0 4px 24px rgba(0,0,0,0.4), 0 1px 0 rgba(79,156,249,0.06) inset;
  --shadow-glow: 0 0 40px rgba(79,156,249,0.12);
  --nav-bg: rgba(10, 14, 26, 0.92);
  --nav-bg-solid: rgba(10, 14, 26, 0.98);
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

:root[data-theme="light"] {
  --bg-void: #f3f7ff;
  --bg-deep: #e8efff;
  --bg-card: #ffffff;
  --bg-elevated: #f4f7ff;
  --bg-surface: #e8efff;
  --bg-hover: #dce7ff;
  --accent-sky: #2f77d9;
  --accent-glow: #2567d0;
  --accent-cold: #2f77d9;
  --accent-success: #118a57;
  --accent-info: #2f77d9;
  --text-primary: #18263f;
  --text-secondary: #405273;
  --text-muted: #5d6d88;
  --border-subtle: rgba(47,119,217,0.14);
  --border-mid: rgba(47,119,217,0.24);
  --border-strong: rgba(47,119,217,0.4);
  --shadow-card: 0 6px 18px rgba(24,38,63,0.08), 0 1px 0 rgba(47,119,217,0.08) inset;
  --shadow-glow: 0 0 22px rgba(47,119,217,0.12);
  --nav-bg: rgba(232, 239, 255, 0.92);
  --nav-bg-solid: rgba(232, 239, 255, 0.98);
}

/* RTL Support */
[dir="rtl"] { text-align: right; }
[dir="rtl"] .search-icon { left: auto; right: 14px; }
[dir="rtl"] .search-clear { right: auto; left: 14px; }
[dir="rtl"] .hourly-scroll { direction: rtl; }
[dir="rtl"] .stat-row { flex-direction: row-reverse; }
[dir="rtl"] .nav-bar { flex-direction: row-reverse; }
[dir="rtl"] .location-row { flex-direction: row-reverse; }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0,0,0,0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg-void);
  color: var(--text-primary);
  color-scheme: dark;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--transition), color var(--transition);
}

:root[data-theme="light"] body {
  color-scheme: light;
}

/* Starfield background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 10% 15%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(1px 1px at 30% 40%, rgba(255,255,255,0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 60% 20%, rgba(255,255,255,0.35) 0%, transparent 100%),
    radial-gradient(1px 1px at 80% 60%, rgba(255,255,255,0.25) 0%, transparent 100%),
    radial-gradient(1px 1px at 45% 75%, rgba(255,255,255,0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 90% 30%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(1px 1px at 15% 80%, rgba(255,255,255,0.2) 0%, transparent 100%),
    radial-gradient(1px 1px at 70% 85%, rgba(255,255,255,0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 25% 55%, rgba(255,255,255,0.2) 0%, transparent 100%),
    radial-gradient(1px 1px at 55% 45%, rgba(255,255,255,0.25) 0%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

/* Atmospheric glow */
body::after {
  content: '';
  position: fixed;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 600px;
  background: radial-gradient(ellipse, rgba(79,156,249,0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.app-wrapper {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 0 100px;
}

/* ============================================================
   TOP BAR
   ============================================================ */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top)) 20px 20px;
  gap: 12px;
}

.logo {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.logo-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-sky);
  box-shadow: 0 0 10px var(--accent-sky);
  animation: pulse-dot 2.5s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}

.lang-btn {
  background: var(--bg-card);
  border: 0.5px solid var(--border-mid);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}

.lang-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

/* ============================================================
   SEARCH
   ============================================================ */
.search-container {
  padding: 0 20px 8px;
  position: relative;
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 15px;
  transition: var(--transition);
}

.search-input {
  width: 100%;
  background: var(--bg-card);
  border: 0.5px solid var(--border-mid);
  border-radius: var(--radius-md);
  padding: 13px 44px 13px 42px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

.search-input::placeholder { color: var(--text-muted); }

.search-input:focus {
  border-color: var(--border-strong);
  background: var(--bg-elevated);
  box-shadow: 0 0 0 3px rgba(79,156,249,0.08);
}

.search-input:focus ~ .search-icon { color: var(--accent-sky); }

.search-clear {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-surface);
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.search-clear:hover { background: var(--bg-hover); color: var(--text-primary); }
.search-clear.visible { display: flex; }

/* Search results dropdown */
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 20px;
  right: 20px;
  background: var(--bg-card);
  border: 0.5px solid var(--border-mid);
  border-radius: var(--radius-md);
  overflow: hidden;
  z-index: 100;
  box-shadow: var(--shadow-card);
  display: none;
}

.search-results.visible { display: block; }

/* ============================================================
   ADS SLOTS (RECTANGULAR, NON-INTRUSIVE)
   ============================================================ */
.ad-slot-section {
  padding: 4px 20px 8px;
}

.ad-slot-section:has(.sp-adsense-slot:empty) {
  display: none;
}

.ad-slot-card {
  background: var(--bg-card);
  border: 0.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px;
}

.ad-slot-card:has(.sp-adsense-slot:empty) {
  display: none;
}

.ad-slot-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-family: var(--font-display);
}

.sp-adsense-slot {
  display: block;
  width: 100%;
  min-height: 100px;
  border-radius: 10px;
  overflow: hidden;
  background: transparent;
}

.sp-adsense-slot:empty {
  display: none;
}

@media (max-width: 720px) {
  .sp-adsense-slot {
    min-height: 90px;
  }
}

.search-result-item {
  padding: 12px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: var(--transition);
  border-bottom: 0.5px solid var(--border-subtle);
}

.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg-elevated); }
.search-result-item:focus-visible {
  outline: 2px solid var(--accent-glow);
  outline-offset: -2px;
  background: var(--bg-elevated);
}

.result-icon { font-size: 16px; opacity: 0.7; }

.result-text { flex: 1; }
.result-city { font-size: 14px; font-weight: 500; color: var(--text-primary); }
.result-country { font-size: 12px; color: var(--text-secondary); }

/* ============================================================
   HERO WEATHER CARD
   ============================================================ */
.hero-card {
  margin: 12px 20px 16px;
  background: var(--bg-card);
  border: 0.5px solid var(--border-mid);
  border-radius: var(--radius-xl);
  padding: 28px 28px 24px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  animation: fadeSlideUp 0.5s ease both;
}

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Dynamic background glow based on condition */
.hero-card::before {
  content: '';
  position: absolute;
  top: -60px;
  right: -40px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--card-glow, rgba(79,156,249,0.12)) 0%, transparent 70%);
  pointer-events: none;
  transition: background 1s ease;
}

.location-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 8px;
}

.location-info { flex: 1; }

.city-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.location-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.location-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent-sky); }

.local-time-btn {
  background: var(--bg-elevated);
  border: 0.5px solid var(--border-mid);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.local-time-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

/* Main temperature display */
.temp-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
}

.temp-main {
  font-family: var(--font-display);
  font-size: 80px;
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -0.05em;
  color: var(--text-primary);
  text-shadow: 0 0 60px rgba(79,156,249,0.2);
}

.temp-unit {
  font-size: 28px;
  font-weight: 400;
  color: var(--text-secondary);
  margin-top: 10px;
  cursor: pointer;
  transition: var(--transition);
}

.temp-unit:hover { color: var(--accent-sky); }

.weather-icon-large {
  font-size: 68px;
  line-height: 1;
  animation: float 4s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.condition-text {
  font-size: 15px;
  font-weight: 400;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.feels-like {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* Hi/Lo bar */
.hilow-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.hilow-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 500;
}

.hi-val { color: var(--accent-warm); }
.lo-val { color: var(--accent-cold); }

.temp-range-bar {
  flex: 1;
  height: 4px;
  background: var(--bg-surface);
  border-radius: 2px;
  overflow: hidden;
}

.temp-range-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent-cold), var(--accent-warm));
  transition: width 0.6s ease;
}

/* Stats mini grid */
.stats-mini {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stat-mini {
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.stat-mini-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

.stat-mini-val {
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-display);
  color: var(--text-primary);
}

/* ============================================================
   SECTION LABELS
   ============================================================ */
.section-header {
  padding: 8px 20px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: var(--font-display);
}

.section-source {
  margin: -6px 20px 10px;
  font-size: 11px;
  color: var(--text-muted);
}

.transparency-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 4px 20px 0;
}

.source-chip {
  font-size: 10px;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 0.5px solid var(--border-subtle);
  border-radius: 999px;
  padding: 4px 8px;
}

.trust-info-wrap {
  position: relative;
}

.trust-info-btn {
  border: 0.5px solid var(--border-mid);
  background: var(--bg-card);
  color: var(--text-secondary);
  border-radius: 999px;
  width: 22px;
  height: 22px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.trust-info-btn:hover,
.trust-info-btn:focus-visible {
  color: var(--text-primary);
  border-color: var(--border-strong);
  outline: none;
}

.trust-tooltip {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  width: min(280px, calc(100vw - 56px));
  background: var(--bg-card);
  border: 0.5px solid var(--border-mid);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.4;
  padding: 10px 12px;
  display: none;
  z-index: 120;
}

.trust-tooltip.visible { display: block; }

@media (max-width: 520px) {
  .trust-tooltip {
    position: fixed;
    left: 16px;
    right: 16px;
    width: auto;
    bottom: calc(88px + env(safe-area-inset-bottom));
    max-height: 42vh;
    overflow: auto;
  }
}

/* ============================================================
   HOURLY FORECAST
   ============================================================ */
.hourly-section {
  padding: 0 0 16px;
  animation: fadeSlideUp 0.5s 0.1s ease both;
}

.hourly-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 20px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-snap-type: x mandatory;
}

.hourly-scroll::-webkit-scrollbar { display: none; }

.hour-card {
  flex-shrink: 0;
  scroll-snap-align: start;
  background: var(--bg-card);
  border: 0.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 10px;
  text-align: center;
  min-width: 64px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.hour-card:hover, .hour-card.active {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
  box-shadow: 0 0 16px rgba(79,156,249,0.1);
}

.hour-card.active { border-color: var(--accent-sky); }

.hour-time { font-size: 11px; color: var(--text-secondary); font-weight: 500; }
.hour-icon { font-size: 22px; line-height: 1; }
.hour-temp { font-size: 14px; font-weight: 600; font-family: var(--font-display); }
.hour-precip {
  font-size: 10px;
  color: var(--accent-cold);
  font-weight: 500;
  min-height: 14px;
}

/* ============================================================
   7-DAY FORECAST
   ============================================================ */
.forecast-section {
  padding: 0 20px 16px;
  animation: fadeSlideUp 0.5s 0.15s ease both;
}

.forecast-card {
  background: var(--bg-card);
  border: 0.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.day-row {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  gap: 12px;
  border-bottom: 0.5px solid var(--border-subtle);
  cursor: pointer;
  transition: var(--transition);
}

.day-row:last-child { border-bottom: none; }
.day-row:hover { background: var(--bg-elevated); }

.day-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  min-width: 44px;
}

.day-icon { font-size: 22px; line-height: 1; }

.day-desc {
  flex: 1;
  font-size: 12px;
  color: var(--text-secondary);
}

.day-precip {
  font-size: 11px;
  color: var(--accent-cold);
  font-weight: 500;
  min-width: 30px;
  text-align: center;
}

.day-precip.low-prob {
  color: var(--text-muted);
  font-weight: 400;
}

.day-range {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
}

.day-hi { color: var(--text-primary); min-width: 30px; text-align: right; }
.day-lo { color: var(--text-muted); min-width: 30px; }

.day-bar {
  width: 50px;
  height: 4px;
  background: var(--bg-surface);
  border-radius: 2px;
  overflow: hidden;
}

.day-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent-cold), var(--accent-warm));
}

/* ============================================================
   DETAIL CARDS
   ============================================================ */
.details-section {
  padding: 0 20px 16px;
  animation: fadeSlideUp 0.5s 0.2s ease both;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.detail-card {
  background: var(--bg-card);
  border: 0.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: var(--transition);
  cursor: default;
}

.detail-card:hover { background: var(--bg-elevated); border-color: var(--border-mid); }

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.detail-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 500;
}

.detail-icon { font-size: 16px; opacity: 0.6; }

.detail-value {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.detail-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Progress bar in detail cards */
.detail-bar {
  height: 3px;
  background: var(--bg-surface);
  border-radius: 2px;
  overflow: hidden;
}

.detail-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--accent-sky);
  transition: width 0.8s ease;
}

/* UV Index color */
.uv-low { background: var(--accent-teal, #00b894); }
.uv-mod { background: var(--accent-sun); }
.uv-high { background: var(--accent-warm); }
.uv-extreme { background: #e17055; }

/* ============================================================
   SUN/MOON CARD
   ============================================================ */
.sunmoon-card {
  margin: 0 20px 16px;
  background: var(--bg-card);
  border: 0.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  animation: fadeSlideUp 0.5s 0.25s ease both;
}

.sunmoon-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.sun-item, .moon-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.sun-icon { font-size: 24px; }
.sun-time { font-family: var(--font-display); font-size: 18px; font-weight: 700; }
.sun-label { font-size: 11px; color: var(--text-muted); }

/* Sun arc SVG */
.sun-arc-wrap {
  width: 100%;
  overflow: hidden;
}

.sun-arc-wrap svg { width: 100%; height: 56px; }

/* ============================================================
   AIR QUALITY
   ============================================================ */
.aqi-card {
  margin: 0 20px 16px;
  background: var(--bg-card);
  border: 0.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  animation: fadeSlideUp 0.5s 0.3s ease both;
}

.aqi-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.aqi-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; }
.aqi-value { font-family: var(--font-display); font-size: 20px; font-weight: 700; }
.aqi-category { font-size: 12px; color: var(--text-secondary); }

.aqi-scale {
  display: flex;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  gap: 2px;
  margin-bottom: 8px;
}

.aqi-seg { flex: 1; border-radius: 2px; }
.aqi-seg-1 { background: #00b894; }
.aqi-seg-2 { background: #fdcb6e; }
.aqi-seg-3 { background: #e17055; }
.aqi-seg-4 { background: #d63031; }
.aqi-seg-5 { background: #6c5ce7; }

.aqi-marker {
  position: relative;
  height: 10px;
  margin-top: -8px;
}

.aqi-marker-dot {
  position: absolute;
  top: 0;
  width: 12px;
  height: 12px;
  background: white;
  border-radius: 50%;
  border: 2px solid var(--bg-deep);
  transform: translateX(-50%);
  transition: left 0.6s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

/* ============================================================
   ALERTS
   ============================================================ */
.alerts-summary {
  margin: 0 20px 10px;
  color: var(--text-secondary);
  font-size: 12px;
}

.alerts-list {
  margin: 0 20px 16px;
  display: grid;
  gap: 10px;
}

.alert-card {
  background: var(--bg-card);
  border: 0.5px solid var(--border-subtle);
  border-left-width: 3px;
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: var(--shadow-card);
}

.alert-card.severity-extreme,
.alert-card.severity-severe { border-left-color: var(--accent-sun); }
.alert-card.severity-moderate { border-left-color: var(--accent-sky); }
.alert-card.severity-minor,
.alert-card.severity-unknown { border-left-color: var(--border-mid); }

.alert-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.alert-meta {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.alert-chip {
  font-size: 10px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 0.5px solid var(--border-mid);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.02);
}

.alert-times,
.alert-area,
.alert-text {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.alert-text {
  color: var(--text-primary);
  line-height: 1.4;
}

.alert-empty {
  border: 0.5px dashed var(--border-mid);
  border-radius: var(--radius-md);
  padding: 14px;
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
}

/* ============================================================
   RECENTLY SEARCHED
   ============================================================ */
.recent-section {
  padding: 0 20px 16px;
  animation: fadeSlideUp 0.5s 0.35s ease both;
}

.recent-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.recent-scroll::-webkit-scrollbar { display: none; }

.recent-chip {
  flex-shrink: 0;
  background: var(--bg-card);
  border: 0.5px solid var(--border-subtle);
  border-radius: 100px;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.recent-chip:hover { background: var(--bg-elevated); color: var(--text-primary); border-color: var(--border-mid); }
.recent-chip-icon { font-size: 14px; }

/* ============================================================
   BOTTOM NAV
   ============================================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 0.5px solid var(--border-mid);
  padding: 10px 20px 24px;
  display: flex;
  justify-content: space-around;
  z-index: 50;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  border: none;
  background: none;
  color: var(--text-muted);
}

.nav-item.active { color: var(--accent-sky); }
.nav-item:hover { color: var(--text-secondary); }

.nav-icon { font-size: 20px; line-height: 1; }
.nav-label { font-size: 10px; font-weight: 500; letter-spacing: 0.04em; }

/* ============================================================
   LANGUAGE MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.modal-overlay.visible { display: flex; }

.lang-modal {
  background: var(--bg-card);
  border: 0.5px solid var(--border-mid);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-width: 480px;
  padding: 24px 24px 40px;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.modal-handle {
  width: 40px;
  height: 4px;
  background: var(--bg-surface);
  border-radius: 2px;
  margin: 0 auto 20px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.lang-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.lang-option {
  background: var(--bg-elevated);
  border: 0.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: var(--transition);
}

.lang-option:hover { background: var(--bg-hover); border-color: var(--border-mid); }
.lang-option.active { border-color: var(--accent-sky); background: rgba(79,156,249,0.08); }

button:focus-visible,
input:focus-visible,
[role="button"]:focus-visible,
[role="tab"]:focus-visible,
[role="option"]:focus-visible {
  outline: 2px solid var(--accent-glow);
  outline-offset: 2px;
}

.lang-flag { font-size: 22px; }
.lang-name { font-size: 14px; font-weight: 500; }
.lang-native { font-size: 12px; color: var(--text-secondary); }

/* ============================================================
   LOADING STATE
   ============================================================ */
.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-hover) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.loading-hero { height: 260px; margin: 12px 20px; border-radius: var(--radius-xl); }

.skeleton-text {
  display: inline-block;
  color: transparent !important;
  min-height: 1em;
  border-radius: 6px;
}

.section-message {
  margin: 0 20px 10px;
  background: rgba(79,156,249,0.08);
  border: 0.5px solid var(--border-mid);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  display: none;
  align-items: center;
  gap: 8px;
}

.section-message.visible { display: flex; }
.section-message:empty { display: none !important; }

/* ============================================================
   ERROR STATE
   ============================================================ */
.error-banner {
  margin: 8px 20px;
  background: rgba(209, 48, 48, 0.1);
  border: 0.5px solid rgba(209,48,48,0.3);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 13px;
  color: #ff7675;
  display: none;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}

.error-banner.banner-error {
  background: rgba(209, 48, 48, 0.1);
  border-color: rgba(209,48,48,0.3);
  color: #ff7675;
}

.error-banner.banner-info {
  background: color-mix(in srgb, var(--accent-info) 12%, transparent);
  border-color: color-mix(in srgb, var(--accent-info) 35%, transparent);
  color: var(--accent-info);
}

.error-banner.banner-success {
  background: color-mix(in srgb, var(--accent-success) 12%, transparent);
  border-color: color-mix(in srgb, var(--accent-success) 35%, transparent);
  color: var(--accent-success);
}

.error-banner.visible { display: flex; }
#error-msg:empty { display: none; }

.error-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.error-close {
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  opacity: 0.8;
}

.error-close:hover { opacity: 1; }

/* ============================================================
   UNIT TOGGLE
   ============================================================ */
.unit-toggle {
  display: flex;
  background: var(--bg-elevated);
  border-radius: 100px;
  padding: 3px;
  border: 0.5px solid var(--border-subtle);
  margin: 0;
}

.unit-btn {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  background: none;
  color: var(--text-muted);
}

.unit-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

/* ============================================================
   THEME PREFERENCE
   ============================================================ */
.theme-pref {
  margin: 0 20px 12px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 0.5px solid var(--border-subtle);
}

#section-settings {
  margin-top: 2px;
}

.settings-lang-btn {
  width: 100%;
  justify-content: flex-start;
}

.settings-lang-text {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted);
}

.theme-pref-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 600;
  font-family: var(--font-display);
}

.theme-toggle {
  display: flex;
  gap: 6px;
  background: var(--bg-elevated);
  border-radius: 100px;
  padding: 3px;
  border: 0.5px solid var(--border-subtle);
}

.theme-btn {
  flex: 1;
  border: none;
  border-radius: 100px;
  background: transparent;
  color: var(--text-muted);
  padding: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.theme-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.theme-note {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-secondary);
}

/* ============================================================
   LOW-PERFORMANCE PROFILE
   ============================================================ */
:root.low-performance .logo-dot,
:root.low-performance .weather-icon-large,
:root.low-performance .hero-card,
:root.low-performance .hourly-section,
:root.low-performance .forecast-section,
:root.low-performance .details-section,
:root.low-performance .sunmoon-card,
:root.low-performance .aqi-card,
:root.low-performance .recent-section,
:root.low-performance .lang-modal,
:root.low-performance .skeleton {
  animation: none !important;
}

:root.low-performance .bottom-nav {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: var(--nav-bg-solid);
}

:root.low-performance .modal-overlay {
  backdrop-filter: none;
}

:root.low-performance .hero-card,
:root.low-performance .forecast-card,
:root.low-performance .aqi-card,
:root.low-performance .sunmoon-card {
  box-shadow: none;
}

:root.low-performance body::before,
:root.low-performance body::after {
  opacity: 0.55;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (min-width: 480px) {
  .app-wrapper { border-left: 0.5px solid var(--border-subtle); border-right: 0.5px solid var(--border-subtle); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Scrollbar for desktop */
@media (hover: hover) {
  ::-webkit-scrollbar { width: 4px; height: 4px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: 2px; }
}
