/* ─── Global ────────────────────────────────────── */
:root {
  --bg:       #f0f4f8;
  --surface:  #ffffff;
  --surface2: #e8eef5;
  --border:   rgba(0,0,0,.1);
  --text:     #1e293b;
  --muted:    #64748b;
}
*, *::before, *::after { box-sizing: border-box; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  min-height: 100vh;
}

/* ─── Header ─────────────────────────────────────── */
.site-header {
  background: linear-gradient(135deg, #1a56a0 0%, #2172c9 60%, #1a88d4 100%);
  border-bottom: 1px solid rgba(0,0,0,.15);
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
}
.site-header h1 { color: #fff; }

/* ─── Page nav (switch between the 2 pages) ──────── */
.page-nav { display:flex; justify-content:center; gap:.5rem; flex-wrap:wrap; }
.page-nav .btn {
  font-size:.82rem; font-weight:600; border-radius: 999px;
  padding:.35rem 1rem;
}
.page-nav .btn-light { color:#1a56a0; }
.page-nav .btn-outline-light:hover { background: rgba(255,255,255,.2); color:#fff; }

/* ─── Section title ──────────────────────────────── */
.section-title {
  color: #1a56a0;
  border-bottom: 2px solid #2172c9;
  padding-bottom: .4rem;
  margin-bottom: 1rem;
}

/* ─── Cards ──────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.card-header {
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  border-radius: 12px 12px 0 0 !important;
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
}
.metric-card { transition: transform .2s, box-shadow .2s; }
.metric-card:hover { transform: translateY(-4px); box-shadow: 0 8px 30px rgba(0,0,0,.12); }
.card-icon   { font-size: 2rem; display: block; margin-bottom: .2rem; }
.metric-label { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; }
.metric-value { font-size: 1.9rem; font-weight: 700; color: #1e293b; line-height: 1.1; }
.metric-unit  { font-size: .78rem; color: var(--muted); }

/* ─── Tables ──────────────────────────────────────── */
.table { color: var(--text); font-size: .875rem; }
.table-dark thead th {
  background: #1a56a0; color: #e0eeff;
  border-color: rgba(255,255,255,.15);
  font-size: .78rem; text-transform: uppercase; letter-spacing: .6px;
}
.table-striped > tbody > tr:nth-of-type(odd) > * { background-color: #f8fafc; color: var(--text); }
.table-hover  > tbody > tr:hover > * { background-color: #dbeafe; color: #1e293b; }
.table td, .table th { border-color: var(--border); padding: .45rem .75rem; vertical-align: middle; white-space: nowrap; }

.temp-badge  { color: #dc2626; font-weight: 700; }
.hum-badge   { color: #0891b2; font-weight: 700; }
.pres-badge  { color: #16a34a; font-weight: 700; }
.wind-badge  { color: #b45309; font-weight: 700; }
.rain-badge  { color: #2563eb; font-weight: 700; }

/* ─── Buttons ────────────────────────────────────── */
.btn-outline-light { border-color: rgba(255,255,255,.5); color: #fff; font-size: .8rem; }
.btn-outline-light:hover { background: rgba(255,255,255,.2); color: #fff; }
.btn-outline-secondary { font-size: .75rem; }

/* ─── Chart range buttons ────────────────────────── */
.chart-range-btn { font-size: .75rem; padding: .2rem .6rem; }

/* ─── Water level station cards (หน้าแรก) ────────── */
.wl-station-card .card-icon { color: #38bdf8; }
.wl-station-card .metric-value { color: #38bdf8; }
.wl-station-card.is-stale { opacity: .55; }

/* ─── Misc ───────────────────────────────────────── */
#alertBox { border-radius: 10px; }
footer { border-top: 1px solid var(--border); color: var(--muted) !important; font-size: .8rem; background: #fff; }
.wl-status-normal  { background:#dcfce7; color:#15803d; border:1px solid #86efac; }
.wl-status-watch   { background:#fef9c3; color:#92400e; border:1px solid #fde047; }
.wl-status-danger  { background:#fee2e2; color:#991b1b; border:1px solid #fca5a5; }
.wl-status-badge   { display:inline-block; padding:.2rem .75rem; border-radius:999px; font-size:.75rem; font-weight:700; margin-top:.3rem; }
@media (max-width: 576px) { .metric-value { font-size: 1.5rem; } .card-icon { font-size: 1.6rem; } }
