/* ==========================================================================
   BAM-1022 Dust Monitoring Dashboard - Enterprise Bootstrap Theme
   Buriram Rajabhat University (BRU) • Academic & Research Grade
   ========================================================================== */

:root,
[data-bs-theme="dark"] {
  --bs-body-bg: #060a14;
  --bs-body-color: #f8fafc;
  --bs-primary: #38bdf8;
  --bs-primary-rgb: 56, 189, 248;
  
  --surface-card: rgba(15, 23, 42, 0.88);
  --surface-card-hover: rgba(22, 34, 60, 0.96);
  --surface-subtle: rgba(15, 23, 42, 0.6);
  --surface-border: rgba(255, 255, 255, 0.08);
  --surface-border-glow: rgba(56, 189, 248, 0.35);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --pcd-blue: #0284c7;
  --pcd-green: #059669;
  --pcd-yellow: #d97706;
  --pcd-orange: #ea580c;
  --pcd-red: #dc2626;

  --radius-card: 16px;
  --radius-sm: 8px;
  --radius-pill: 9999px;
  --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --page-bg-gradient: radial-gradient(at 0% 0%, rgba(14, 165, 233, 0.08) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(99, 102, 241, 0.08) 0px, transparent 50%),
    radial-gradient(at 50% 100%, rgba(15, 23, 42, 0.95) 0px, transparent 70%);
}

[data-bs-theme="light"] {
  --bs-body-bg: #f1f5f9;
  --bs-body-color: #0f172a;
  --bs-primary: #0284c7;
  --bs-primary-rgb: 2, 132, 199;
  
  --surface-card: #ffffff;
  --surface-card-hover: #fcfdfe;
  --surface-subtle: #f8fafc;
  --surface-border: #e2e8f0;
  --surface-border-glow: rgba(2, 132, 199, 0.15);

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;

  --page-bg-gradient: radial-gradient(at 0% 0%, rgba(2, 132, 199, 0.04) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(99, 102, 241, 0.03) 0px, transparent 50%),
    radial-gradient(at 50% 100%, rgba(241, 245, 249, 0.8) 0px, transparent 70%);
}

body {
  font-family: 'Prompt', 'Inter', -apple-system, sans-serif;
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);
  min-height: 100vh;
  line-height: 1.5;
  background-image: var(--page-bg-gradient);
  background-attachment: fixed;
}

/* Glassmorphic Cards */
.card-dark {
  background: var(--surface-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-card);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  transition: var(--transition-fast);
}

.card-dark:hover {
  border-color: rgba(56, 189, 248, 0.25);
}

/* Top App Header */
.app-header-card {
  padding: 14px 20px;
  margin-bottom: 20px;
}

.brand-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0284c7, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.3rem;
  box-shadow: 0 4px 16px rgba(2, 132, 199, 0.35);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 2px;
  letter-spacing: -0.01em;
}

.brand-badge {
  font-size: 0.75rem;
  color: var(--bs-primary);
  background: rgba(56, 189, 248, 0.15);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-weight: 600;
}

.brand-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0;
}

/* Header Clock & Pills */
.header-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.clock-pill {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: #fff;
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.3);
}

/* Top AQI Banner */
.banner-aqi-card {
  padding: 24px 28px;
  margin-bottom: 24px;
  border-left: 5px solid var(--bs-primary);
}

.aqi-circle-badge {
  width: 96px;
  height: 96px;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #0284c7, #0369a1);
  color: #fff;
  box-shadow: 0 6px 24px rgba(2, 132, 199, 0.4);
  flex-shrink: 0;
}

.aqi-circle-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1;
}

.aqi-circle-lbl {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.9;
}

.banner-status-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(16, 185, 129, 0.15);
  color: #10B981;
  border: 1px solid rgba(16, 185, 129, 0.3);
  margin-bottom: 8px;
}

.banner-heading {
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.banner-advice {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.banner-meta-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-pill);
  padding: 4px 12px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.banner-meta-badge strong {
  color: #fff;
}

/* Metric KPI Cards */
.metric-kpi-card {
  padding: 16px 18px;
  height: 100%;
}

.metric-kpi-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.kpi-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
}

.icon-pm25 { background: rgba(56, 189, 248, 0.15); color: #38bdf8; }
.icon-flow { background: rgba(14, 165, 233, 0.15); color: #0ea5e9; }
.icon-temp { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.icon-rh   { background: rgba(6, 182, 212, 0.15); color: #06b6d4; }
.icon-bp   { background: rgba(129, 140, 248, 0.15); color: #818cf8; }
.icon-wind { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.icon-ft   { background: rgba(236, 72, 153, 0.15); color: #ec4899; }
.icon-frh  { background: rgba(168, 85, 247, 0.15); color: #a855f7; }

.kpi-title-text {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0;
}

.kpi-sub-text {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.kpi-value-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.kpi-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.85rem;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}

.kpi-unit {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-left: 4px;
}

.kpi-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
}

.badge-pcd-good,
.badge-pcd-blue { background: rgba(2, 132, 199, 0.15); color: #38bdf8; border: 1px solid rgba(2, 132, 199, 0.35); }
.badge-pcd-green { background: rgba(5, 150, 105, 0.15); color: #10b981; border: 1px solid rgba(5, 150, 105, 0.35); }
.badge-pcd-stable { background: rgba(2, 132, 199, 0.15); color: #38bdf8; border: 1px solid rgba(2, 132, 199, 0.3); }
.badge-pcd-warn,
.badge-pcd-yellow { background: rgba(217, 119, 6, 0.15); color: #f59e0b; border: 1px solid rgba(217, 119, 6, 0.35); }
.badge-pcd-orange { background: rgba(234, 88, 12, 0.15); color: #fb923c; border: 1px solid rgba(234, 88, 12, 0.35); }
.badge-pcd-alert,
.badge-pcd-red { background: rgba(220, 38, 38, 0.15); color: #ef4444; border: 1px solid rgba(220, 38, 38, 0.35); }

/* Chart Containers & Pill Filter */
.chart-box-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--surface-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.chart-box-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.chart-box-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.chart-body-wrap {
  padding: 18px 20px;
  position: relative;
  height: 310px;
}

/* Time Filter Segmented Buttons */
.time-filter-btn-group {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  padding: 3px;
  display: inline-flex;
  gap: 2px;
}

.time-filter-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  transition: var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.time-filter-btn:hover {
  color: #fff;
}

.time-filter-btn.active {
  background: #0284c7;
  color: #fff;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4);
}

/* Stats Summary Strip */
.stats-summary-strip {
  display: flex;
  gap: 8px;
  padding: 10px 20px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--surface-border);
  flex-wrap: wrap;
}

.stat-strip-item {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.stat-strip-item strong {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
}

/* Map & Geolocation Card */
.geo-detail-box {
  background: var(--surface-subtle);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  transition: var(--transition-fast);
}

.geo-info-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--surface-border);
  font-size: 0.85rem;
}

.geo-info-lbl {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.geo-info-val {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--text-main);
}

/* Standards Guide Cards */
.standard-guide-card {
  border-radius: 12px;
  padding: 14px 16px;
  background: var(--surface-subtle);
  border: 1px solid var(--surface-border);
  border-top: 4px solid var(--pcd-blue);
  height: 100%;
  color: var(--text-main);
  transition: var(--transition-fast);
}

.guide-band-blue   { border-top-color: var(--pcd-blue); }
.guide-band-green  { border-top-color: var(--pcd-green); }
.guide-band-yellow { border-top-color: var(--pcd-yellow); }
.guide-band-orange { border-top-color: var(--pcd-orange); }
.guide-band-red    { border-top-color: var(--pcd-red); }

.aqi-level-title {
  color: var(--text-main);
}

.aqi-advice-text {
  color: var(--text-muted);
}

/* Table Component */
.table-dark-custom {
  --bs-table-bg: transparent;
  --bs-table-striped-bg: rgba(255, 255, 255, 0.02);
  --bs-table-hover-bg: rgba(56, 189, 248, 0.05);
  color: var(--bs-body-color);
  border-color: var(--surface-border);
}

.table-dark-custom th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom-width: 1px;
}

.table-dark-custom td {
  font-size: 0.85rem;
  vertical-align: middle;
}

/* Modal Dark Customization */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(3, 7, 18, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1050;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: linear-gradient(145deg, #0d1527 0%, #070d19 100%);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 20px;
  padding: 24px 28px;
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  color: #fff;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(56, 189, 248, 0.08);
  transform: translateY(20px) scale(0.97);
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  margin: auto;
}

@media (max-width: 576px) {
  .modal-overlay {
    padding: 10px;
    align-items: flex-start;
  }
  .modal-box {
    padding: 18px 16px;
    border-radius: 16px;
    max-height: calc(100vh - 20px);
  }
}

.modal-overlay.active .modal-box {
  transform: translateY(0) scale(1);
}

.modal-export-dialog {
  max-width: 520px;
}

/* Modal Header & Icon Badge */
.modal-icon-badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-icon-badge i {
  width: 22px;
  height: 22px;
}

.modal-title-custom {
  font-size: 1.1rem;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1.3;
}

.modal-subtitle-custom {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.btn-close-custom {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}

.btn-close-custom:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  transform: rotate(90deg);
}

.btn-close-custom i {
  width: 16px;
  height: 16px;
}

/* Custom Form Elements & Quick Presets */
.form-label-custom {
  font-size: 0.8rem;
  font-weight: 600;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.export-preset-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-preset-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-preset-pill:hover {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.3);
  color: #38bdf8;
}

.btn-preset-pill.active {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.25) 0%, rgba(56, 189, 248, 0.35) 100%);
  border-color: #38bdf8;
  color: #38bdf8;
  font-weight: 600;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
}

/* Modern Date Input Group */
.input-date-custom-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.input-date-label {
  font-size: 0.72rem;
  color: #64748b;
  font-weight: 500;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon .input-icon {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: #64748b;
  pointer-events: none;
  transition: color 0.2s ease;
}

.form-control-custom-dark {
  background: rgba(15, 23, 42, 0.75) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: #f1f5f9 !important;
  border-radius: 10px !important;
  padding: 8px 12px 8px 36px !important;
  font-size: 0.85rem !important;
  font-family: 'JetBrains Mono', monospace !important;
  transition: all 0.2s ease !important;
  color-scheme: dark;
}

.form-control-custom-dark:focus {
  background: rgba(15, 23, 42, 0.95) !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18) !important;
  outline: none !important;
}

.input-with-icon:focus-within .input-icon {
  color: #38bdf8;
}

/* Export Metadata Preview Box */
.export-meta-preview {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  padding: 12px 14px;
}

/* Primary Gradient Action Button */
.btn-primary-gradient {
  background: linear-gradient(135deg, #0284c7 0%, #0ea5e9 100%);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #ffffff;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 9px 18px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
}

.btn-primary-gradient:hover {
  background: linear-gradient(135deg, #0369a1 0%, #0284c7 100%);
  border-color: #38bdf8;
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.4);
  transform: translateY(-1px);
  color: #fff;
}

.btn-cancel-custom {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  font-size: 0.88rem;
  padding: 9px 16px;
  border-radius: 10px;
  transition: all 0.2s ease;
}

.btn-cancel-custom:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
  border-color: rgba(255, 255, 255, 0.2);
}

/* General Dark Form Inputs */
input[type="date"], input[type="text"], input[type="password"], select.form-select {
  color-scheme: dark;
}

/* User Session Badge */
.user-pill-session {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--surface-border);
  font-size: 0.82rem;
}

.avatar-initials {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #0284c7;
  color: #fff;
  font-weight: 700;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   Air4Thai PCD Portal Components
   ========================================================================== */
.air4thai-spotlight-card {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.12) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 1.5px solid rgba(56, 189, 248, 0.35);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4), 0 0 24px rgba(56, 189, 248, 0.12);
  border-radius: 18px;
  position: relative;
  overflow: hidden;
}

.air4thai-spotlight-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.25), rgba(56, 189, 248, 0.35));
  border-bottom-left-radius: 12px;
  border-left: 1px solid rgba(56, 189, 248, 0.4);
  border-bottom: 1px solid rgba(56, 189, 248, 0.4);
  padding: 4px 14px;
  font-size: 0.76rem;
  font-weight: 600;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 6px;
}

.aqi-badge-squircle {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease;
}

.aqi-badge-squircle .aqi-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.45rem;
  line-height: 1;
}

.aqi-badge-squircle .aqi-unit {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.9;
}

/* PCD AQI Color Bands */
.pcd-badge-1 {
  background: linear-gradient(145deg, rgba(2, 132, 199, 0.35), rgba(56, 189, 248, 0.25));
  border: 1px solid #38bdf8;
  color: #38bdf8;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.25);
}

.pcd-badge-2 {
  background: linear-gradient(145deg, rgba(5, 150, 105, 0.35), rgba(16, 185, 129, 0.25));
  border: 1px solid #34d399;
  color: #34d399;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.25);
}

.pcd-badge-3 {
  background: linear-gradient(145deg, rgba(217, 119, 6, 0.35), rgba(245, 158, 11, 0.25));
  border: 1px solid #fbbf24;
  color: #fbbf24;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.25);
}

.pcd-badge-4 {
  background: linear-gradient(145deg, rgba(234, 88, 12, 0.35), rgba(249, 115, 22, 0.25));
  border: 1px solid #fb923c;
  color: #fb923c;
  box-shadow: 0 0 16px rgba(234, 88, 12, 0.25);
}

.pcd-badge-5 {
  background: linear-gradient(145deg, rgba(220, 38, 38, 0.4), rgba(239, 68, 68, 0.3));
  border: 1px solid #f87171;
  color: #f87171;
  box-shadow: 0 0 16px rgba(220, 38, 38, 0.3);
}

.pcd-badge-0 {
  background: rgba(100, 116, 139, 0.2);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #94a3b8;
}

/* Pollutants Mini Grid */
.pollutant-pill-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 8px 6px;
  text-align: center;
  transition: all 0.2s ease;
}

.pollutant-pill-box:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
}

.pollutant-pill-name {
  font-size: 0.7rem;
  color: #94a3b8;
  font-weight: 500;
  display: block;
}

.pollutant-pill-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  font-weight: 700;
  color: #f8fafc;
  display: block;
  margin-top: 2px;
}

/* Station Card Hover Effects */
.station-pcd-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px 20px;
  transition: all 0.22s ease;
}

.station-pcd-card:hover {
  transform: translateY(-3px);
  border-color: rgba(56, 189, 248, 0.35);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4), 0 0 20px rgba(56, 189, 248, 0.08);
}

/* ==========================================================================
   Clean & Crisp Light Theme System for BAM-1022 Dashboard
   ========================================================================== */
[data-bs-theme="light"] {
  --bs-body-bg: #f8fafc;
  --bs-body-color: #0f172a;
  --bs-primary: #0284c7;
  --bs-primary-rgb: 2, 132, 199;

  --surface-card: #ffffff;
  --surface-card-hover: #fcfdfe;
  --surface-border: #e2e8f0;
  --surface-border-glow: rgba(2, 132, 199, 0.15);

  --text-muted: #64748b;
  --text-dim: #94a3b8;
}

[data-bs-theme="light"] body {
  background-color: #f1f5f9;
  color: #0f172a;
  background-image: 
    radial-gradient(at 0% 0%, rgba(2, 132, 199, 0.04) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(99, 102, 241, 0.03) 0px, transparent 50%),
    radial-gradient(at 50% 100%, rgba(241, 245, 249, 0.8) 0px, transparent 70%);
}

/* Glassmorphic to Crisp Clean Cards */
[data-bs-theme="light"] .card-dark {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 6px 18px rgba(15, 23, 42, 0.03);
}

[data-bs-theme="light"] .card-dark:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06), 0 10px 24px rgba(15, 23, 42, 0.05);
}

/* Header & Controls */
[data-bs-theme="light"] .app-header-card {
  background: #ffffff;
  border-color: #e2e8f0;
}

[data-bs-theme="light"] .brand-title,
[data-bs-theme="light"] .banner-heading,
[data-bs-theme="light"] .kpi-num,
[data-bs-theme="light"] .chart-box-title,
[data-bs-theme="light"] .banner-meta-badge strong,
[data-bs-theme="light"] .pollutant-pill-val {
  color: #0f172a !important;
}

[data-bs-theme="light"] .kpi-title-text {
  color: #1e293b !important;
}

[data-bs-theme="light"] .kpi-sub-text,
[data-bs-theme="light"] .chart-box-sub {
  color: #64748b !important;
}

[data-bs-theme="light"] .header-pill {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #475569;
}

[data-bs-theme="light"] .clock-pill {
  color: #0284c7;
  background: #f0f9ff;
  border-color: #bae6fd;
}

[data-bs-theme="light"] .banner-meta-badge {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #475569;
}

/* Chart Header & Segmented Time Filter Controls */
[data-bs-theme="light"] .chart-box-header {
  border-bottom-color: #f1f5f9;
}

[data-bs-theme="light"] .time-filter-btn-group {
  background: #f1f5f9;
  border-color: #e2e8f0;
}

[data-bs-theme="light"] .time-filter-btn {
  color: #64748b;
}

[data-bs-theme="light"] .time-filter-btn:hover {
  color: #0f172a;
}

[data-bs-theme="light"] .time-filter-btn.active {
  background: #ffffff;
  color: #0284c7;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* Stats Summary Strip */
[data-bs-theme="light"] .stats-summary-strip {
  background: #f8fafc;
  border-bottom-color: #e2e8f0;
}

[data-bs-theme="light"] .stat-strip-item strong {
  color: #0f172a;
}

/* Data Tables */
[data-bs-theme="light"] .table-dark-custom {
  color: #0f172a;
  border-color: #f1f5f9;
}

[data-bs-theme="light"] .table-dark-custom th {
  background: #f8fafc;
  color: #475569;
  border-bottom: 2px solid #e2e8f0;
}

[data-bs-theme="light"] .table-dark-custom td {
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
}

[data-bs-theme="light"] .table-dark-custom tbody tr:hover td {
  background: #f8fafc;
}

/* Pollutants Mini Grid in PCD / Modal */
[data-bs-theme="light"] .pollutant-pill-box {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-bs-theme="light"] .pollutant-pill-box:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

/* Modals */
[data-bs-theme="light"] .modal-content {
  background: #ffffff;
  color: #0f172a;
  border-color: #e2e8f0;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.12);
}

[data-bs-theme="light"] .modal-header,
[data-bs-theme="light"] .modal-footer {
  border-color: #f1f5f9;
}

/* Buttons */
[data-bs-theme="light"] .btn-outline-light {
  color: #334155;
  border-color: #cbd5e1;
  background: #ffffff;
}

[data-bs-theme="light"] .btn-outline-light:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #94a3b8;
}

[data-bs-theme="light"] .btn-outline-secondary {
  color: #475569;
  border-color: #cbd5e1;
  background: #ffffff;
}

[data-bs-theme="light"] .btn-outline-secondary:hover {
  background: #f1f5f9;
  color: #0f172a;
}

/* Geolocation Rows */
[data-bs-theme="light"] .geo-info-row {
  border-bottom: 1px solid #f1f5f9;
}

[data-bs-theme="light"] .geo-info-val {
  color: #0f172a;
}

/* ==========================================================================
   Comprehensive Light Mode Overhauls for Modals, Inputs & Nested Cards
   ========================================================================== */
[data-bs-theme="light"] .modal-overlay {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(8px);
}

[data-bs-theme="light"] .modal-box {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.15) !important;
}

[data-bs-theme="light"] .modal-title-custom {
  color: #0f172a !important;
}

[data-bs-theme="light"] .modal-subtitle-custom {
  color: #64748b !important;
}

[data-bs-theme="light"] .modal-icon-badge {
  background: #f0f9ff;
  border-color: #bae6fd;
}

[data-bs-theme="light"] .btn-close-custom {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #64748b;
}

[data-bs-theme="light"] .btn-close-custom:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #ef4444;
}

/* Modal Form Inputs & Date Pickers */
[data-bs-theme="light"] .form-label-custom,
[data-bs-theme="light"] .input-date-label,
[data-bs-theme="light"] label.form-label {
  color: #475569 !important;
}

[data-bs-theme="light"] .form-control-custom-dark,
[data-bs-theme="light"] .form-input,
[data-bs-theme="light"] .form-control {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
  color-scheme: light !important;
}

[data-bs-theme="light"] .form-control-custom-dark:focus,
[data-bs-theme="light"] .form-input:focus,
[data-bs-theme="light"] .form-control:focus {
  background: #ffffff !important;
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15) !important;
}

[data-bs-theme="light"] .form-select {
  background-color: #f8fafc !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
  color-scheme: light !important;
}

[data-bs-theme="light"] .input-with-icon .input-icon {
  color: #94a3b8;
}

[data-bs-theme="light"] .input-with-icon:focus-within .input-icon {
  color: #0284c7;
}

/* Modal Preset Pills */
[data-bs-theme="light"] .btn-preset-pill {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #475569;
}

[data-bs-theme="light"] .btn-preset-pill:hover {
  background: #e0f2fe;
  border-color: #7dd3fc;
  color: #0284c7;
}

[data-bs-theme="light"] .btn-preset-pill.active {
  background: #0284c7;
  border-color: #0284c7;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3);
}

/* Modal Internal Cards (Fixing Dark Bootstrap Utility Overrides) */
[data-bs-theme="light"] .modal-box .bg-dark,
[data-bs-theme="light"] .modal-box .bg-black,
[data-bs-theme="light"] .modal-box .export-meta-preview,
[data-bs-theme="light"] .modal-box .pipeline-flow-container,
[data-bs-theme="light"] .modal-box .pipeline-step-node,
[data-bs-theme="light"] .modal-box .pipeline-stat-card {
  background-color: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

[data-bs-theme="light"] .modal-box .border-secondary {
  border-color: #e2e8f0 !important;
}

[data-bs-theme="light"] .modal-box .text-light,
[data-bs-theme="light"] .modal-box .text-white {
  color: #0f172a !important;
}

[data-bs-theme="light"] .modal-box .text-muted {
  color: #64748b !important;
}

[data-bs-theme="light"] .terminal-console-box {
  background: #0f172a !important;
  color: #e2e8f0 !important;
  border-color: #1e293b !important;
}

[data-bs-theme="light"] .table-dark {
  --bs-table-bg: #ffffff;
  --bs-table-striped-bg: #f8fafc;
  --bs-table-hover-bg: #f1f5f9;
  --bs-table-color: #0f172a;
  color: #0f172a;
  border-color: #e2e8f0;
}

[data-bs-theme="light"] .table-dark th {
  background: #f8fafc;
  color: #475569;
  border-bottom: 2px solid #e2e8f0;
}

[data-bs-theme="light"] .table-dark td {
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
}

[data-bs-theme="light"] .btn-cancel-custom {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #475569;
}

[data-bs-theme="light"] .btn-cancel-custom:hover {
  background: #e2e8f0;
  color: #0f172a;
  border-color: #94a3b8;
}

/* Custom Date Bar and Dropdowns in Main Dashboard */
[data-bs-theme="light"] #customDateBar,
[data-bs-theme="light"] #monthSelectBar {
  background: #f8fafc !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

[data-bs-theme="light"] #geoStationNameTitle {
  color: #0f172a !important;
}

[data-bs-theme="light"] .card-dark .text-light,
[data-bs-theme="light"] .modal-box .text-light,
[data-bs-theme="light"] .pro-card .text-light,
[data-bs-theme="light"] .card-dark .text-white,
[data-bs-theme="light"] .modal-box .text-white,
[data-bs-theme="light"] .pro-card .text-white {
  color: #0f172a !important;
}

[data-bs-theme="light"] .btn-primary,
[data-bs-theme="light"] .btn-primary-gradient,
[data-bs-theme="light"] .badge.bg-primary,
[data-bs-theme="light"] .badge.bg-success,
[data-bs-theme="light"] .badge.bg-danger {
  color: #ffffff !important;
}

/* Fix Chart Headers in Light Mode (Remove dark slate header bar) */
[data-bs-theme="light"] .chart-box-header {
  background: #ffffff !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

[data-bs-theme="light"] .chart-box-title {
  color: #0f172a !important;
}

[data-bs-theme="light"] .chart-box-sub {
  color: #64748b !important;
}

/* Fix Geolocation Right Detail Card (bg-dark to crisp light) */
[data-bs-theme="light"] .card-dark .bg-dark {
  background-color: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

[data-bs-theme="light"] .card-dark .border-secondary {
  border-color: #e2e8f0 !important;
}

/* Fix Standards Guide Cards at the bottom (Remove dark grey bg, use crisp white with subtle shadow) */
[data-bs-theme="light"] .standard-guide-card {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-top-width: 4px !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(15, 23, 42, 0.03) !important;
  color: #1e293b !important;
}

[data-bs-theme="light"] .standard-guide-card .aqi-level-title,
[data-bs-theme="light"] .standard-guide-card .text-light,
[data-bs-theme="light"] .standard-guide-card span.fw-bold {
  color: #0f172a !important;
}

[data-bs-theme="light"] .standard-guide-card strong {
  color: #0f172a !important;
}

[data-bs-theme="light"] .standard-guide-card .small {
  color: #334155 !important;
}

[data-bs-theme="light"] .standard-guide-card .aqi-advice-text,
[data-bs-theme="light"] .standard-guide-card p.text-muted {
  color: #475569 !important;
}

/* Light mode styling for the AQI badges inside the guide cards */
[data-bs-theme="light"] .standard-guide-card .badge.bg-primary {
  background: rgba(2, 132, 199, 0.12) !important;
  color: #0284c7 !important;
  border: 1px solid rgba(2, 132, 199, 0.25) !important;
}

[data-bs-theme="light"] .standard-guide-card .badge.bg-success {
  background: rgba(5, 150, 105, 0.12) !important;
  color: #059669 !important;
  border: 1px solid rgba(5, 150, 105, 0.25) !important;
}

[data-bs-theme="light"] .standard-guide-card .badge.bg-warning {
  background: rgba(217, 119, 6, 0.14) !important;
  color: #b45309 !important;
  border: 1px solid rgba(217, 119, 6, 0.25) !important;
}

[data-bs-theme="light"] .standard-guide-card .badge.bg-danger {
  background: rgba(220, 38, 38, 0.12) !important;
  color: #dc2626 !important;
  border: 1px solid rgba(220, 38, 38, 0.25) !important;
}

/* Ensure map and station details title is black */
[data-bs-theme="light"] h3.text-light {
  color: #0f172a !important;
}

/* User Session Pill in Light Mode */
.data-source-badge {
  background: var(--surface-subtle);
  border: 1px solid var(--surface-border);
}

[data-bs-theme="light"] .user-session-pill {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

[data-bs-theme="light"] .user-session-pill.is-admin {
  background: #fffbeb !important;
  border-color: #fde68a !important;
  box-shadow: 0 1px 3px rgba(245, 158, 11, 0.1) !important;
}

[data-bs-theme="light"] .user-session-pill .user-name-tag {
  color: #0f172a !important;
}

[data-bs-theme="light"] .user-session-pill .btn-session-logout,
[data-bs-theme="light"] .user-session-pill .btn-session-switch {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #475569 !important;
}

[data-bs-theme="light"] .user-session-pill .btn-session-logout:hover {
  background: #fee2e2 !important;
  border-color: #fca5a5 !important;
  color: #ef4444 !important;
}

[data-bs-theme="light"] .data-source-badge {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

/* ==========================================================================
   Floating Action Button (FAB) Theme Switcher
   ========================================================================== */
.theme-fab-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--surface-card);
  border: 1px solid var(--surface-border);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1040;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35), 0 0 12px rgba(56, 189, 248, 0.2);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

.theme-fab-toggle:hover {
  transform: translateY(-3px) scale(1.08);
  border-color: var(--bs-primary);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.45), 0 0 16px rgba(56, 189, 248, 0.4);
  color: var(--bs-primary);
}

.theme-fab-toggle:active {
  transform: translateY(-1px) scale(1.02);
}

.theme-fab-toggle i {
  width: 20px;
  height: 20px;
  transition: transform 0.4s ease;
}

.theme-fab-toggle:hover i {
  transform: rotate(30deg);
}

[data-bs-theme="light"] .theme-fab-toggle {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0284c7 !important;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.12), 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

[data-bs-theme="light"] .theme-fab-toggle:hover {
  border-color: #0284c7 !important;
  background: #f8fafc !important;
  box-shadow: 0 8px 24px rgba(2, 132, 199, 0.25) !important;
}

@media (max-width: 576px) {
  .theme-fab-toggle {
    bottom: 18px;
    right: 18px;
    width: 44px;
    height: 44px;
  }
}







