/* === WEATHER PULSE — CSS === */
:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-hover: #334155;
  --border: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --accent: #38bdf8;
  --accent-glow: rgba(56, 189, 248, 0.15);
  --gradient: linear-gradient(135deg, #0ea5e9, #6366f1);
  --font: 'Inter', -apple-system, sans-serif;
  --radius: 16px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  line-height: 1.5;
}

#app {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon { font-size: 28px; }

.logo h1 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
}

.logo h1 span {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.search-box {
  position: relative;
  display: flex;
  gap: 6px;
  flex: 1;
  max-width: 380px;
}

#search {
  flex: 1;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

#search:focus { border-color: var(--accent); }
#search::placeholder { color: var(--text-muted); }

#search-btn, #location-btn {
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.2s;
}

#search-btn:hover, #location-btn:hover { background: var(--surface-hover); }

/* Suggestions dropdown */
#suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 60px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-top: 4px;
  list-style: none;
  z-index: 100;
  overflow: hidden;
}

#suggestions.hidden { display: none; }

#suggestions li {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.1s;
}

#suggestions li:hover { background: var(--surface-hover); }

/* Loading */
#loading {
  text-align: center;
  padding: 80px 0;
}

#loading.hidden { display: none; }

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

#loading p { color: var(--text-muted); }

/* Error */
#error {
  text-align: center;
  padding: 40px;
  color: #f87171;
}

#error.hidden { display: none; }

/* Main content */
#main.hidden { display: none; }

/* Current weather */
.current-weather {
  display: flex;
  justify-content: space-between;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 20px;
  gap: 24px;
  flex-wrap: wrap;
}

.current-left { flex: 1; min-width: 200px; }

.location {
  font-size: 24px;
  font-weight: 700;
}

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

.temp-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.weather-icon { font-size: 56px; }

.temp {
  font-size: 56px;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.condition {
  font-size: 16px;
  color: var(--text-muted);
  text-transform: capitalize;
}

.current-right {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  flex: 1;
  min-width: 200px;
}

.detail {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}

.detail-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.detail-value {
  font-size: 18px;
  font-weight: 700;
}

/* Charts */
.chart-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.chart-section h2 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}

.chart-container {
  position: relative;
  height: 220px;
}

/* Forecast */
.forecast-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.forecast-section h2 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
}

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

.forecast-day {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 14px 8px;
  text-align: center;
  transition: background 0.2s;
}

.forecast-day:hover { background: rgba(255, 255, 255, 0.08); }

.forecast-day .day-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.forecast-day .day-icon {
  font-size: 28px;
  margin-bottom: 8px;
}

.forecast-day .day-high {
  font-size: 16px;
  font-weight: 700;
}

.forecast-day .day-low {
  font-size: 13px;
  color: var(--text-muted);
}

/* Footer */
footer {
  text-align: center;
  padding: 16px;
  font-size: 12px;
  color: var(--text-muted);
}

footer a { color: var(--accent); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* Responsive */
@media (max-width: 700px) {
  .forecast-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .current-weather { flex-direction: column; }

  .temp { font-size: 44px; }
  .weather-icon { font-size: 44px; }
}

@media (max-width: 480px) {
  header { flex-direction: column; align-items: stretch; }

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

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

  .current-right { grid-template-columns: repeat(3, 1fr); }

  .detail { padding: 8px; }
  .detail-value { font-size: 15px; }
}
