:root {
  --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  
  /* Dark Theme Colors */
  --bg-primary: #0a0e17;
  --bg-secondary: rgba(20, 27, 45, 0.7);
  --card-bg: rgba(255, 255, 255, 0.05);
  --card-border: rgba(255, 255, 255, 0.12);
  --card-border-hover: rgba(255, 255, 255, 0.25);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #38bdf8;
  --accent-glow: rgba(56, 189, 248, 0.25);
  --accent-warm: #f59e0b;
  --pill-bg: rgba(255, 255, 255, 0.08);
  --pill-active-bg: #38bdf8;
  --pill-active-text: #0f172a;
  
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 9999px;
  
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px rgba(56, 189, 248, 0.15);
}

[data-theme="light"] {
  --bg-primary: #f0f4f9;
  --bg-secondary: rgba(255, 255, 255, 0.85);
  --card-bg: rgba(255, 255, 255, 0.7);
  --card-border: rgba(0, 0, 0, 0.08);
  --card-border-hover: rgba(0, 0, 0, 0.18);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent: #0284c7;
  --accent-glow: rgba(2, 132, 199, 0.2);
  --pill-bg: rgba(0, 0, 0, 0.06);
  --pill-active-bg: #0284c7;
  --pill-active-text: #ffffff;
  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.06);
}

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  transition: background-color 0.4s ease, color 0.4s ease;
}

/* Dynamic Weather Background Glows */
.app-background {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  opacity: 0.6;
  transition: opacity 0.5s ease;
}

.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  will-change: transform;
}

.glow-1 {
  width: 500px;
  height: 500px;
  top: -100px;
  left: -100px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.4), transparent 70%);
}

.glow-2 {
  width: 600px;
  height: 600px;
  bottom: -150px;
  right: -100px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.35), transparent 70%);
}

.glow-3 {
  width: 400px;
  height: 400px;
  top: 40%;
  right: 20%;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.25), transparent 70%);
}

/* Weather Themes */
body.weather-clear .glow-1 { background: radial-gradient(circle, rgba(245, 158, 11, 0.45), transparent 70%); }
body.weather-clear .glow-2 { background: radial-gradient(circle, rgba(56, 189, 248, 0.35), transparent 70%); }

body.weather-rain .glow-1 { background: radial-gradient(circle, rgba(59, 130, 246, 0.5), transparent 70%); }
body.weather-rain .glow-2 { background: radial-gradient(circle, rgba(100, 116, 139, 0.4), transparent 70%); }

body.weather-storm .glow-1 { background: radial-gradient(circle, rgba(139, 92, 246, 0.6), transparent 70%); }
body.weather-storm .glow-2 { background: radial-gradient(circle, rgba(239, 68, 68, 0.3), transparent 70%); }

body.weather-snow .glow-1 { background: radial-gradient(circle, rgba(186, 230, 253, 0.5), transparent 70%); }
body.weather-snow .glow-2 { background: radial-gradient(circle, rgba(224, 231, 255, 0.4), transparent 70%); }

/* Layout Container */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Header */
.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  font-size: 32px;
  filter: drop-shadow(0 4px 12px rgba(245, 158, 11, 0.4));
}

.brand-text h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--text-primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--accent-glow);
  color: var(--accent);
  border: 1px solid var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Search Box */
.search-wrapper {
  position: relative;
  flex: 1;
  max-width: 500px;
  min-width: 280px;
}

.search-bar {
  display: flex;
  align-items: center;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-pill);
  padding: 10px 18px;
  gap: 10px;
  backdrop-filter: blur(16px);
  transition: border-color 0.25s, box-shadow 0.25s;
}

.search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

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

.search-bar input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 15px;
  outline: none;
}

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

.clear-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 50%;
}

.clear-btn:hover {
  color: var(--text-primary);
}

.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  backdrop-filter: blur(24px);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  z-index: 100;
  max-height: 280px;
  overflow-y: auto;
}

.autocomplete-item {
  padding: 12px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background-color 0.2s;
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover, .autocomplete-item.selected {
  background-color: var(--accent-glow);
}

.autocomplete-item strong {
  color: var(--text-primary);
  font-size: 14px;
}

.autocomplete-item span {
  color: var(--text-muted);
  font-size: 13px;
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.live-clock {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--card-bg);
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--card-border);
}

.btn-icon {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-primary);
  transition: transform 0.2s, background-color 0.2s;
}

.btn-icon:hover {
  transform: scale(1.05);
  border-color: var(--accent);
}

/* Quick Cities Pills */
.quick-cities {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: none;
}

.quick-cities::-webkit-scrollbar {
  display: none;
}

.quick-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.city-pills {
  display: flex;
  gap: 8px;
}

.pill {
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--pill-bg);
  border: 1px solid var(--card-border);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.25s ease;
}

.pill:hover {
  color: var(--text-primary);
  border-color: var(--accent);
}

.pill.active {
  background: var(--pill-active-bg);
  color: var(--pill-active-text);
  border-color: var(--pill-active-bg);
  box-shadow: 0 4px 14px var(--accent-glow);
}

/* Loading & Error States */
.loading-bar {
  height: 4px;
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.loading-progress {
  height: 100%;
  width: 40%;
  background: var(--accent);
  border-radius: var(--radius-pill);
  animation: loadingAnim 1.2s infinite ease-in-out;
}

@keyframes loadingAnim {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(120%); width: 60%; }
  100% { transform: translateX(250%); }
}

.error-banner {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

/* Generic Card */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-card);
  transition: border-color 0.3s ease, transform 0.3s ease;
}

.card:hover {
  border-color: var(--card-border-hover);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.card-header h3 {
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-header .subtext {
  font-size: 12px;
  color: var(--text-muted);
}

/* Hero Weather Card */
.hero-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 380px;
  background: linear-gradient(145deg, var(--card-bg), rgba(255, 255, 255, 0.02));
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.city-title {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.country-badge {
  display: inline-block;
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
  margin-top: 4px;
}

.date-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.condition-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--pill-bg);
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--card-border);
}

.condition-badge .badge-icon {
  font-size: 24px;
}

.condition-badge .badge-text {
  font-size: 14px;
  font-weight: 600;
}

.hero-center {
  display: flex;
  align-items: baseline;
  gap: 24px;
  margin: 24px 0;
}

.temp-display {
  display: flex;
  align-items: flex-start;
}

.big-temp {
  font-size: 88px;
  font-weight: 800;
  letter-spacing: -3px;
  line-height: 0.9;
}

.temp-unit {
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
  margin-top: 6px;
}

.temp-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.feels-like {
  font-size: 15px;
  color: var(--text-secondary);
}

.feels-like strong {
  color: var(--text-primary);
}

.high-low {
  display: flex;
  gap: 12px;
  font-size: 14px;
  color: var(--text-muted);
}

.high-low span strong {
  color: var(--text-secondary);
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding-top: 20px;
  border-top: 1px solid var(--card-border);
}

.metric-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.03);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.metric-icon {
  font-size: 22px;
}

.metric-info {
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.metric-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.metric-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* Air Quality Card */
.aqi-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.aqi-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.aqi-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 10px 0;
}

.aqi-score-container {
  text-align: center;
  padding: 18px 0;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
}

.aqi-score {
  font-size: 56px;
  font-weight: 800;
  line-height: 1;
  color: #10b981;
}

.aqi-scale-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.aqi-pollutants {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.pollutant {
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
}

.p-name {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.p-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.aqi-tip {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  padding-top: 10px;
  border-top: 1px solid var(--card-border);
}

/* Hourly Forecast Strip (Full Width) */
.hourly-card {
  grid-column: 1 / -1;
}

.hourly-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 8px 4px 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--card-border) transparent;
}

.hourly-scroll::-webkit-scrollbar {
  height: 6px;
}

.hourly-scroll::-webkit-scrollbar-thumb {
  background: var(--card-border);
  border-radius: var(--radius-pill);
}

.hourly-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 82px;
  padding: 14px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  text-align: center;
  gap: 8px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.hourly-item:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}

.hourly-time {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.hourly-icon {
  font-size: 24px;
}

.hourly-temp {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.hourly-pop {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 2px;
}

/* 10-Day Forecast List (Full Width) */
.tenday-card {
  grid-column: 1 / -1;
}

.tenday-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tenday-row {
  display: grid;
  grid-template-columns: 140px 180px 1fr 140px 110px;
  align-items: center;
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.04);
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.tenday-row:hover {
  background-color: rgba(255, 255, 255, 0.06);
  transform: translateX(4px);
}

.tenday-day {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.tenday-date {
  font-size: 12px;
  color: var(--text-muted);
}

.tenday-condition {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-secondary);
}

.tenday-icon {
  font-size: 22px;
}

/* Temperature Bar */
.tenday-temp-range {
  display: flex;
  align-items: center;
  gap: 12px;
}

.t-min {
  font-size: 14px;
  color: var(--text-muted);
  width: 32px;
  text-align: right;
  font-weight: 600;
}

.t-bar-track {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-pill);
  position: relative;
  overflow: hidden;
}

.t-bar-fill {
  position: absolute;
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, #38bdf8, #f59e0b);
}

.t-max {
  font-size: 15px;
  color: var(--text-primary);
  width: 34px;
  font-weight: 700;
}

.tenday-rain {
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
  text-align: right;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.tenday-wind {
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
}

/* Footer */
.main-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 20px;
  border-top: 1px solid var(--card-border);
  font-size: 13px;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 10px;
}

.main-footer strong {
  color: var(--text-secondary);
}

/* Responsive Media Queries */
@media (max-width: 992px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  
  .tenday-row {
    grid-template-columns: 110px 140px 1fr 100px;
  }

  .tenday-wind {
    display: none;
  }
}

@media (max-width: 680px) {
  .app-container {
    padding: 16px 12px 30px;
  }

  .main-header {
    flex-direction: column;
    align-items: stretch;
  }

  .search-wrapper {
    max-width: 100%;
  }

  .header-actions {
    justify-content: space-between;
  }

  .big-temp {
    font-size: 64px;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .tenday-row {
    grid-template-columns: 80px 1fr 110px;
    gap: 8px;
    padding: 10px 12px;
  }

  .tenday-condition span.cond-text {
    display: none;
  }
}
