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

:root {
  --bg:        #080c18;
  --bg2:       #0d1225;
  --surface:   rgba(255,255,255,0.05);
  --border:    rgba(255,255,255,0.09);
  --blue:      #3b82f6;
  --violet:    #8b5cf6;
  --cyan:      #22d3ee;
  --green:     #34d399;
  --amber:     #f59e0b;
  --rose:      #f43f5e;
  --text:      #e8eaf6;
  --muted:     #8892b0;
  --grad:      linear-gradient(135deg, var(--blue), var(--violet));
  --card-glow: 0 0 40px rgba(59,130,246,0.10);
  --radius:    20px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Ambient background glows */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 15% 5%,  rgba(59,130,246,0.09) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 85% 85%, rgba(139,92,246,0.09) 0%, transparent 60%),
    radial-gradient(ellipse 40% 30% at 50% 50%, rgba(34,211,238,0.04) 0%, transparent 70%);
}

/* ── Nav ─────────────────────────────────────────────── */
nav {
  position: sticky; top: 0; z-index: 200;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2rem; height: 64px;
  background: rgba(8,12,24,0.85);
  backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
}

.logo {
  font-size: 1.25rem; font-weight: 700; white-space: nowrap;
  background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

/* Search */
.search-wrap {
  position: relative; flex: 1; max-width: 440px; margin: 0 1.5rem;
}
.search-icon {
  position: absolute; left: 0.9rem; top: 50%; transform: translateY(-50%);
  font-size: 0.85rem; pointer-events: none;
}
.search-wrap input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-family: 'Outfit', sans-serif; font-size: 0.95rem;
  padding: 0.55rem 3rem 0.55rem 2.4rem;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.search-wrap input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.kbd {
  position: absolute; right: 0.75rem; top: 50%; transform: translateY(-50%);
  font-size: 0.68rem; color: var(--muted);
  background: rgba(255,255,255,0.06); border: 1px solid var(--border);
  border-radius: 5px; padding: 2px 7px; pointer-events: none;
}

/* Suggestions dropdown */
.suggestions {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: #111827; border: 1px solid var(--border); border-radius: 12px;
  list-style: none; overflow: hidden; z-index: 300;
  box-shadow: 0 16px 40px rgba(0,0,0,0.5);
  max-height: 220px; overflow-y: auto;
}
.suggestions.hidden { display: none; }
.suggestions li {
  padding: 0.65rem 1rem; cursor: pointer; font-size: 0.9rem;
  display: flex; align-items: center; gap: 0.5rem; color: var(--muted);
  transition: background .15s, color .15s;
}
.suggestions li:hover, .suggestions li.active { background: rgba(59,130,246,0.1); color: var(--text); }
.suggestions li .sug-name { color: var(--text); font-weight: 500; }

/* Nav right */
.nav-right { display: flex; align-items: center; gap: 0.75rem; white-space: nowrap; }
.badge {
  border-radius: 20px; padding: 3px 10px; font-size: 0.74rem; font-weight: 500;
}
.badge-live {
  background: rgba(52,211,153,0.12); color: var(--green);
  border: 1px solid rgba(52,211,153,0.25);
}
.badge-live::before { content: '● '; font-size: 0.6rem; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

.refresh-countdown { font-size: 0.78rem; color: var(--muted); }

/* ── Error banner ──────────────────────────────────────── */
.error-banner {
  position: relative; z-index: 100;
  background: rgba(244,63,94,0.1); border-bottom: 1px solid rgba(244,63,94,0.3);
  color: var(--rose); padding: 0.6rem 2rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  font-size: 0.88rem;
}
.error-banner button {
  background: none; border: none; color: var(--rose); cursor: pointer; font-size: 1rem;
}
.hidden { display: none !important; }

/* ── Main layout ───────────────────────────────────────── */
main {
  position: relative; z-index: 1;
  max-width: 1300px; margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 1.25rem;
}

/* ── Glass card ────────────────────────────────────────── */
.card {
  background: var(--surface);
  backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--card-glow);
  animation: fadeUp 0.5s ease both;
}
.card-title {
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 1rem;
}
.card-header-row {
  display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 1rem;
}
.card-sub { font-size: 0.72rem; color: var(--muted); }

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

/* ── Hero card ─────────────────────────────────────────── */
.hero {
  grid-column: 1; grid-row: 1 / 3;
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: 420px; gap: 1.25rem;
  background: linear-gradient(150deg, rgba(59,130,246,0.14), rgba(139,92,246,0.09));
  animation-delay: 0.05s; position: relative; overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; top: -60px; right: -60px;
  width: 240px; height: 240px; border-radius: 50%;
  background: radial-gradient(circle, rgba(59,130,246,0.18) 0%, transparent 70%);
  pointer-events: none;
}

.hero-top { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; }
.hero-location { display: flex; align-items: center; gap: 0.4rem; font-size: 1rem; color: var(--muted); }
.hero-location .pin { color: var(--blue); }
.hero-country { font-size: 0.8rem; color: var(--muted); }
.hero-sun { display: flex; flex-direction: column; gap: 2px; font-size: 0.75rem; color: var(--muted); text-align: right; }

.hero-center { text-align: center; }
.hero-icon { font-size: 4.5rem; line-height: 1; margin-bottom: 0.25rem;
  filter: drop-shadow(0 0 24px rgba(255,210,60,0.45)); }
.hero-temp {
  font-size: 5.5rem; font-weight: 800; line-height: 1; letter-spacing: -4px;
  background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-desc { font-size: 1.1rem; color: var(--muted); margin-top: 0.25rem; }
.hero-range { display: flex; align-items: center; gap: 0.5rem; justify-content: center; margin-top: 0.4rem; font-size: 0.9rem; }
.hero-high { color: var(--rose); font-weight: 600; }
.hero-low  { color: var(--cyan); font-weight: 600; }
.range-sep { color: var(--muted); }

.hero-meta {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem;
}
.hero-meta-item {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 12px; padding: 0.6rem 0.8rem;
  transition: background .2s;
}
.hero-meta-item:hover { background: rgba(255,255,255,0.07); }
.hero-meta-item .label { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.hero-meta-item .val   { font-size: 1rem; font-weight: 600; margin-top: 2px; }
.hero-update { font-size: 0.7rem; color: var(--muted); text-align: right; margin-top: 0.5rem; }

/* ── Color accents ─────────────────────────────────────── */
.c-blue   { color: var(--blue); }
.c-cyan   { color: var(--cyan); }
.c-green  { color: var(--green); }
.c-amber  { color: var(--amber); }
.c-violet { color: var(--violet); }
.c-rose   { color: var(--rose); }

/* ── Stats grid ────────────────────────────────────────── */
.stats-grid {
  grid-column: 2; grid-row: 1;
  display: grid; grid-template-columns: repeat(3,1fr); gap: 0.9rem;
}
.stat-card {
  background: var(--surface);
  backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: 16px; padding: 1rem 1.2rem;
  box-shadow: var(--card-glow);
  display: flex; flex-direction: column; gap: 0.35rem;
  animation: fadeUp 0.5s ease both; animation-delay: var(--delay, 0s);
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.stat-card:hover {
  transform: translateY(-3px);
  border-color: rgba(59,130,246,0.3);
  box-shadow: 0 8px 32px rgba(59,130,246,0.15);
}
.stat-icon  { font-size: 1.3rem; }
.stat-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.stat-value { font-size: 1.35rem; font-weight: 700; }
.stat-sub   { font-size: 0.73rem; color: var(--muted); }

/* Progress bar */
.progress-bar {
  height: 4px; border-radius: 4px;
  background: rgba(255,255,255,0.08); margin-top: 4px; overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 4px; background: var(--grad);
  transition: width 1.2s cubic-bezier(0.16,1,0.3,1);
}

/* ── Graph cards ───────────────────────────────────────── */
.graph-card { grid-column: 2; animation-delay: 0.2s; }

.tab-row { display: flex; gap: 0.4rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.tab {
  padding: 0.35rem 0.9rem; border-radius: 8px; font-size: 0.78rem; font-weight: 500;
  cursor: pointer; border: 1px solid var(--border); color: var(--muted);
  background: transparent; transition: all .2s; font-family: 'Outfit', sans-serif;
}
.tab.active {
  background: var(--grad); color: #fff; border-color: transparent;
  box-shadow: 0 2px 14px rgba(59,130,246,0.35);
}
.tab:hover:not(.active) { border-color: var(--blue); color: var(--text); }

.chart-wrap { position: relative; height: 230px; }

/* Empty state */
.empty-state {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.5rem; color: var(--muted); font-size: 0.88rem; text-align: center;
}
.empty-icon { font-size: 2rem; }
.empty-sub  { font-size: 0.75rem; }

/* ── Hourly strip ──────────────────────────────────────── */
.hourly-strip { grid-column: 1 / -1; animation-delay: 0.28s; }
.hourly-scroll {
  display: flex; gap: 0.65rem; overflow-x: auto; padding-bottom: 0.5rem;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.hour-card {
  flex: 0 0 78px; text-align: center;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  border-radius: 14px; padding: 0.7rem 0.4rem;
  transition: background .2s, transform .2s, border-color .2s;
  cursor: default;
}
.hour-card:hover { background: rgba(59,130,246,0.1); transform: translateY(-4px); border-color: rgba(59,130,246,0.3); }
.hour-card.now   { border-color: var(--blue); background: rgba(59,130,246,0.1); }
.hour-time  { font-size: 0.68rem; color: var(--muted); font-weight: 500; }
.hour-icon  { font-size: 1.4rem; margin: 0.3rem 0; }
.hour-temp  { font-size: 0.92rem; font-weight: 700; }
.hour-rain  { font-size: 0.62rem; color: var(--cyan); margin-top: 2px; }

/* ── Weekly row ────────────────────────────────────────── */
.weekly-row { grid-column: 1 / -1; animation-delay: 0.34s; }
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.65rem; }
.day-card {
  text-align: center; background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  border-radius: 14px; padding: 1rem 0.4rem;
  transition: background .2s, transform .2s, border-color .2s;
}
.day-card:hover { background: rgba(139,92,246,0.1); transform: translateY(-4px); border-color: rgba(139,92,246,0.3); }
.day-card.today { border-color: var(--violet); background: rgba(139,92,246,0.08); }
.day-name   { font-size: 0.68rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.day-date   { font-size: 0.6rem; color: var(--muted); margin-bottom: 0.2rem; }
.day-icon   { font-size: 1.7rem; margin: 0.4rem 0; }
.day-high   { font-size: 0.95rem; font-weight: 700; color: var(--rose); }
.day-low    { font-size: 0.8rem; color: var(--cyan); margin-top: 1px; }
.day-precip { font-size: 0.62rem; color: var(--blue); margin-top: 5px; }
.day-bar    {
  height: 3px; border-radius: 3px; margin-top: 6px;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
}
.day-desc   { font-size: 0.6rem; color: var(--muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── History table ─────────────────────────────────────── */
.history-card { grid-column: 1 / -1; animation-delay: 0.4s; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
thead th {
  text-align: left; color: var(--muted); font-weight: 500; font-size: 0.7rem;
  text-transform: uppercase; letter-spacing: 0.08em; padding: 0 0.75rem 0.75rem;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody tr { border-bottom: 1px solid rgba(255,255,255,0.04); transition: background .15s; }
tbody tr:hover { background: rgba(255,255,255,0.025); }
tbody td { padding: 0.6rem 0.75rem; }
.table-empty { text-align: center; color: var(--muted); padding: 2rem !important; }
.pill {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 0.7rem; font-weight: 500; white-space: nowrap;
}
.pill-blue   { background: rgba(59,130,246,0.15);  color: var(--blue); }
.pill-green  { background: rgba(52,211,153,0.12);  color: var(--green); }
.pill-amber  { background: rgba(245,158,11,0.12);  color: var(--amber); }
.pill-rose   { background: rgba(244,63,94,0.12);   color: var(--rose); }
.pill-violet { background: rgba(139,92,246,0.12);  color: var(--violet); }

/* ── Footer ────────────────────────────────────────────── */
footer {
  position: relative; z-index: 1; text-align: center;
  padding: 1.5rem; font-size: 0.78rem; color: var(--muted);
  border-top: 1px solid var(--border);
}
footer a { color: var(--blue); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 1024px) {
  main { grid-template-columns: 1fr; }
  .hero { grid-column: 1; grid-row: auto; min-height: auto; }
  .stats-grid { grid-column: 1; grid-row: auto; grid-template-columns: repeat(3, 1fr); }
  .graph-card { grid-column: 1; }
  .week-grid  { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 640px) {
  nav { padding: 0 1rem; }
  .search-wrap { max-width: none; margin: 0 0.75rem; }
  .refresh-countdown { display: none; }
  main { padding: 1rem 0.75rem 3rem; gap: 0.9rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .week-grid  { grid-template-columns: repeat(2, 1fr); }
  .hero-temp  { font-size: 4.5rem; }
}
