:root {
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-card: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --accent: #0284c7;
  --accent-hover: #0369a1;
  --border: #e2e8f0;
  --warning-bg: #fef3c7;
  --warning-border: #f59e0b;
  --warning-text: #92400e;
  --error-bg: #fee2e2;
  --error-border: #ef4444;
  --error-text: #991b1b;
  --info-bg: #e0f2fe;
  --info-border: #38bdf8;
  --info-text: #0369a1;
  --radius: 12px;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg:
    0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #0b1120;
    --bg-secondary: #111d35;
    --bg-card: #152445;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --accent: #38bdf8;
    --accent-hover: #7dd3fc;
    --border: #1e355b;
    --warning-bg: #451a03;
    --warning-border: #d97706;
    --warning-text: #fef3c7;
    --error-bg: #450a0a;
    --error-border: #dc2626;
    --error-text: #fee2e2;
    --info-bg: #082f49;
    --info-border: #0284c7;
    --info-text: #e0f2fe;
  }
}

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

body {
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  padding: 1.5rem 1rem;
}

.container {
  max-width: 800px;
  margin: 0 auto;
}

.header {
  text-align: center;
  margin-bottom: 2rem;
}

.header h1 {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.025em;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* Search and Controls */
.search-section {
  margin-bottom: 1.5rem;
}

.search-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

#city-search-input {
  flex: 1 1 260px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

#city-search-input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  background: var(--bg-secondary);
}

/* Preset Chips */
.preset-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.preset-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.chip {
  padding: 0.25rem 0.75rem;
  font-size: 0.85rem;
  border-radius: 9999px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Status Banner */
.status-banner {
  display: none;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  line-height: 1.4;
}

.status-banner.visible {
  display: block;
}

.status-banner.status-warning {
  background: var(--warning-bg);
  color: var(--warning-text);
  border: 1px solid var(--warning-border);
}

.status-banner.status-error {
  background: var(--error-bg);
  color: var(--error-text);
  border: 1px solid var(--error-border);
}

.status-banner.status-info {
  background: var(--info-bg);
  color: var(--info-text);
  border: 1px solid var(--info-border);
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

/* Current Weather */
.current-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.location-name {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
}

.weather-condition {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.weather-icon {
  font-size: 3.5rem;
  line-height: 1;
}

.current-temp-wrapper {
  margin: 1rem 0 1.5rem 0;
}

.current-temp {
  font-size: 3.75rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  color: var(--text-primary);
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.detail-item {
  display: flex;
  flex-direction: column;
}

.detail-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.detail-val {
  font-size: 1.25rem;
  color: var(--text-primary);
  margin-top: 0.25rem;
}

/* 5-Day Forecast */
.forecast-heading {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.forecast-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.75rem;
}

.forecast-day {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 0.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.forecast-day-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.forecast-icon {
  font-size: 2rem;
  margin: 0.25rem 0;
}

.forecast-temps {
  font-size: 0.9rem;
}

.forecast-max {
  font-weight: 700;
  color: var(--text-primary);
}

.forecast-min {
  color: var(--text-muted);
  margin-left: 0.25rem;
}

.forecast-cond {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

@media (max-width: 600px) {
  body {
    padding: 1rem 0.75rem;
  }

  .header h1 {
    font-size: 1.75rem;
  }

  .current-temp {
    font-size: 3rem;
  }

  .search-bar {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

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