/* SmartFlood visual theme
   Theme-only override: no layout, HTML structure, API, or behavior changes. */
:root {
  --bg: #101719;
  --surface: #182123;
  --surface2: #202b2e;
  --surface3: #141c1e;
  --border: rgba(176, 199, 193, 0.14);
  --border2: rgba(105, 183, 173, 0.32);
  --accent: #75c2b7;
  --accent2: #4f9f96;
  --danger: #dc6b61;
  --warning: #d3a34e;
  --critical: #b47a91;
  --success: #69aa84;
  --admin: #a79abb;
  --text: #edf2ef;
  --muted: #9baba7;
  --muted2: #71817d;
  --font-head: 'Be Vietnam Pro', 'Segoe UI', Arial, sans-serif;
  --font-mono: 'Be Vietnam Pro', 'Segoe UI', Arial, sans-serif;
  --page-grid: rgba(117, 194, 183, 0.025);
  --map-control-bg: #202b2e;
  --map-control-text: #edf2ef;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.2);
  --overlay: rgba(24, 33, 35, 0.82);
}

:root[data-theme='light'] {
  --bg: #f3f7f6;
  --surface: #ffffff;
  --surface2: #edf4f2;
  --surface3: #e4eeeb;
  --border: rgba(28, 73, 67, 0.15);
  --border2: rgba(31, 122, 111, 0.34);
  --accent: #16776d;
  --accent2: #1f8f83;
  --danger: #c3443b;
  --warning: #9a6700;
  --critical: #8d4964;
  --success: #26764b;
  --admin: #675980;
  --text: #172624;
  --muted: #5c706c;
  --muted2: #778985;
  --page-grid: rgba(31, 143, 131, 0.055);
  --map-control-bg: #ffffff;
  --map-control-text: #172624;
  --shadow: 0 18px 48px rgba(31, 70, 64, 0.12);
  --overlay: rgba(255, 255, 255, 0.88);
}

html {
  color-scheme: dark;
}

html[data-theme='light'] {
  color-scheme: light;
}

html,
body,
.header,
header,
.panel,
.section,
.card,
.stat-card,
.forecast-metric,
.notify-row,
.alert-item,
.item,
.conn-status,
#toast,
.toast,
input,
select,
textarea,
button {
  transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

html, body, button, input, select, textarea {
  font-family: 'Be Vietnam Pro', 'Segoe UI', Arial, sans-serif;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

body::before {
  background-image:
    linear-gradient(var(--page-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--page-grid) 1px, transparent 1px);
}

.blob-1 { background: #4f9f96; }
.blob-2 { background: #536f6b; }

.card::before {
  background: linear-gradient(90deg, transparent, var(--accent2), transparent);
}

.card::after {
  background: rgba(117, 194, 183, 0.22);
}

.card,
.panel,
.section,
.stat-card,
.conn-status,
#toast,
.toast {
  box-shadow: var(--shadow);
}

.logo-icon,
.brand-icon {
  background: var(--accent2) !important;
}

.logo-title,
.brand-text,
.forecast-station,
.forecast-metric-value,
.tg-code,
.alert-item strong {
  color: var(--text) !important;
}

.btn,
.btn-header,
.btn-mini,
.btn-chip,
.btn-back,
.panel-title,
.section-title,
.stat-val,
.risk-badge,
.forecast-station,
.forecast-metric-value,
.tg-code {
  font-family: var(--font-head);
}

.btn:not(.btn-ghost):not(.btn-back):not(.btn-logout),
button:not(.btn-ghost):not(.btn-back):not(.btn-logout) {
  text-shadow: none;
}

.btn::after {
  background: linear-gradient(rgba(255, 255, 255, 0.04), transparent);
}

.btn-admin {
  background: var(--warning);
  color: #18201f;
}

input[type='email'],
input[type='password'],
input[type='text'],
input[type='number'],
select,
textarea {
  color: var(--text);
  background-color: var(--surface2);
  border-color: var(--border);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(117, 194, 183, 0.09);
}

.stat-card.water::before { background: var(--danger); }
.stat-card.temp::before { background: var(--warning); }
.stat-card.humi::before { background: var(--accent2); }
.stat-card.light::before { background: var(--admin); }

.leaflet-container { background: #dfe7e3 !important; }

.leaflet-control-zoom a,
.leaflet-control-layers,
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: var(--map-control-bg) !important;
  color: var(--map-control-text) !important;
}

.leaflet-control-layers label,
.leaflet-popup-content {
  color: var(--map-control-text) !important;
}

.chart-empty {
  background: linear-gradient(180deg, transparent, var(--overlay));
}

.error-box,
.alert-error {
  color: #efaaa4;
  background: rgba(220, 107, 97, 0.1);
  border-color: rgba(220, 107, 97, 0.32);
}

.alert-info {
  color: #9cd8cf;
  background: rgba(79, 159, 150, 0.1);
  border-color: rgba(79, 159, 150, 0.3);
}

.conn-dot.on {
  box-shadow: 0 0 5px rgba(105, 170, 132, 0.7);
}

::selection {
  color: #10201e;
  background: #9bd6ce;
}

.theme-toggle {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 11px;
  border: 1px solid var(--border2);
  border-radius: 999px;
  background: var(--surface2);
  color: var(--text);
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: none;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
  outline: none;
}

.theme-toggle-icon {
  width: 17px;
  height: 17px;
  display: inline-grid;
  place-items: center;
  font-size: 15px;
}

.theme-toggle-header {
  margin-right: 10px;
}

.theme-toggle-floating {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 1000;
  box-shadow: var(--shadow);
}

:root[data-theme='light'] .blob {
  opacity: 0.07;
}

:root[data-theme='light'] .card::after {
  background: rgba(31, 143, 131, 0.13);
}

:root[data-theme='light'] .btn-admin {
  color: #ffffff;
}

:root[data-theme='light'] .admin-badge {
  background: rgba(103, 89, 128, 0.1);
}

:root[data-theme='light'] #alertBanner {
  color: #9f3029;
  background: rgba(195, 68, 59, 0.1);
}

:root[data-theme='light'] input::placeholder,
:root[data-theme='light'] textarea::placeholder {
  color: #7a8d89;
}

@media (max-width: 720px) {
  .theme-toggle {
    min-width: 34px;
    padding: 7px 8px;
  }

  .header-right .theme-toggle-label {
    display: none;
  }

  .theme-toggle-header {
    margin-right: 6px;
  }

  .theme-toggle-floating {
    top: 12px;
    right: 12px;
  }
}
