/* ===== KL Weather Live — Stylesheet ===== */

:root {
  --bg-deep: #0a0e1a;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #e8ecf4;
  --text-dim: #8892a6;
  --text-faint: #5a6378;
  --accent: #f0a830;
  --accent-glow: rgba(240, 168, 48, 0.15);
  --cyan: #38bdf8;
  --teal: #2dd4bf;
  --violet: #a78bfa;
  --amber: #fbbf24;
  --slate: #94a3b8;
  --rose: #fb7185;
  --radius: 16px;
  --radius-sm: 10px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

#bgCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.container {
  position: relative;
  z-index: 1;
  max-width: 880px;
  margin: 0 auto;
  padding: 40px 24px 60px;
}

/* ===== Header ===== */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  animation: fadeDown 0.6s ease;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-left i {
  font-size: 42px;
  color: var(--amber);
  filter: drop-shadow(0 0 12px rgba(251, 191, 36, 0.3));
}

.header h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  font-size: 13px;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
  margin-top: 2px;
}

.refresh-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.refresh-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}

.refresh-btn:active {
  transform: scale(0.96);
}

.refresh-btn i {
  font-size: 18px;
}

.refresh-btn.spinning i {
  animation: spin 0.8s linear infinite;
}

/* ===== Hero Card ===== */
.hero-card {
  position: relative;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 36px;
  overflow: hidden;
  margin-bottom: 24px;
  animation: fadeUp 0.6s ease 0.1s both;
}

.hero-bg-glow {
  position: absolute;
  top: -60px;
  right: -60px;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 32px;
  flex-wrap: wrap;
}

.hero-left {
  display: flex;
  align-items: center;
  gap: 24px;
}

.weather-icon-large {
  font-size: 72px;
  line-height: 1;
  filter: drop-shadow(0 4px 20px rgba(251, 191, 36, 0.2));
}

.weather-icon-large i {
  transition: var(--transition);
}

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

.temp-value {
  font-size: 80px;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 0.9;
  background: linear-gradient(135deg, #fff 0%, #a0aec0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.temp-unit {
  font-size: 28px;
  font-weight: 400;
  color: var(--text-dim);
  margin-top: 8px;
}

.weather-desc {
  font-size: 18px;
  color: var(--text-dim);
  margin-top: 8px;
  font-weight: 500;
}

.hero-right {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-dim);
}

.meta-row i {
  font-size: 18px;
  color: var(--text-faint);
}

.meta-row strong {
  color: var(--text);
  font-weight: 600;
}

/* ===== Metrics Grid ===== */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 32px;
  animation: fadeUp 0.6s ease 0.2s both;
}

.metric-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  transition: var(--transition);
}

.metric-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.metric-card i {
  font-size: 26px;
}

.metric-label {
  font-size: 12px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

.metric-value {
  font-size: 26px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: -0.02em;
}

.text-cyan { color: var(--cyan); }
.text-teal { color: var(--teal); }
.text-violet { color: var(--violet); }
.text-amber { color: var(--amber); }
.text-slate { color: var(--slate); }
.text-rose { color: var(--rose); }

/* ===== Forecast ===== */
.forecast-section {
  animation: fadeUp 0.6s ease 0.3s both;
}

.section-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.section-title i {
  color: var(--text-dim);
}

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

.forecast-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 24px 18px;
  text-align: center;
  transition: var(--transition);
}

.forecast-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.forecast-day {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.forecast-date {
  font-size: 12px;
  color: var(--text-faint);
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 16px;
}

.forecast-icon {
  font-size: 42px;
  margin-bottom: 12px;
  display: inline-block;
}

.forecast-temps {
  display: flex;
  justify-content: center;
  gap: 12px;
  align-items: baseline;
}

.forecast-high {
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
}

.forecast-low {
  font-size: 18px;
  font-weight: 400;
  color: var(--text-faint);
}

.forecast-desc {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 8px;
}

.forecast-astro {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 12px;
  font-size: 11px;
  color: var(--text-faint);
}

.forecast-astro span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ===== Footer ===== */
.footer {
  margin-top: 40px;
  text-align: center;
  animation: fadeUp 0.6s ease 0.4s both;
}

.footer p {
  font-size: 13px;
  color: var(--text-faint);
}

.footer a {
  color: var(--text-dim);
  text-decoration: none;
  transition: var(--transition);
}

.footer a:hover {
  color: var(--accent);
}

.footer-note {
  margin-top: 6px;
  font-size: 11px;
}

/* ===== Error Banner ===== */
.error-banner {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(220, 38, 38, 0.15);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(220, 38, 38, 0.3);
  color: #fca5a5;
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  z-index: 100;
  animation: fadeUp 0.4s ease;
}

/* ===== Loading State ===== */
.loading .hero-card,
.loading .metric-card,
.loading .forecast-card {
  opacity: 0.5;
  pointer-events: none;
}

/* ===== Animations ===== */
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-16px); }
  to { opacity: 1; transform: translateY(0); }
}

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

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

/* ===== Responsive ===== */
@media (max-width: 680px) {
  .container { padding: 24px 16px 40px; }
  .header h1 { font-size: 22px; }
  .header-left i { font-size: 34px; }
  .hero-card { padding: 28px 20px; }
  .hero-content { flex-direction: column; align-items: flex-start; }
  .hero-right { width: 100%; }
  .weather-icon-large { font-size: 56px; }
  .temp-value { font-size: 60px; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .forecast-grid { grid-template-columns: 1fr; }
  .refresh-btn span { display: none; }
  .refresh-btn { padding: 10px 14px; }
}

@media (max-width: 400px) {
  .metrics-grid { grid-template-columns: 1fr; }
  .temp-value { font-size: 52px; }
}
