/* ============================================================
   ASMeteo — Stations page styles
   (AllStations, live summary dashboard, leaderboards)
   ============================================================ */

/* ── Premium button (public nav, links to login) ── */
.btn-premium {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff !important;
    border: none;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.78rem;
    padding: 0.3rem 0.85rem;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.45);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    text-decoration: none !important;
}
/* Leaflet popup (map icon bubble) — ensure readable in dark theme */
html:not([data-theme="light"]) .leaflet-popup-content-wrapper,
html:not([data-theme="light"]) .leaflet-popup-tip {
    background: var(--pub-card-bg) !important;
    color: var(--pub-card-color) !important;
    border: 1px solid rgba(255,255,255,0.06) !important;
    box-shadow: 0 8px 22px rgba(0,0,0,0.6) !important;
}
html:not([data-theme="light"]) .leaflet-popup-content {
    color: var(--pub-card-color) !important;
}
html:not([data-theme="light"]) .leaflet-container a.leaflet-popup-close-button {
    color: var(--pub-card-color) !important;
}

/* Leaflet controls (zoom, attribution) — dark mode overrides for authenticated layout 

   WHY THESE ARE NEEDED:
   Leaflet plugin CSS (leaflet.css) provides default light-theme styling for map controls.
   These body.dark-mode overrides ensure zoom buttons, attribution text, and layer controls
   are visible with dark backgrounds when authenticated users enable dark mode.

   The rules target Leaflet-specific classes (.leaflet-control-zoom, .leaflet-bar, etc.)
   and apply dark backgrounds (#1e293b), light text (#cbd5e1), and proper borders/shadows.
*/
body.dark-mode .leaflet-control-zoom,
body.dark-mode .leaflet-bar {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4) !important;
}

body.dark-mode .leaflet-control-zoom a,
body.dark-mode .leaflet-bar a {
    background: #1e293b !important;
    color: #cbd5e1 !important;
    border-bottom: 1px solid #334155 !important;
}

body.dark-mode .leaflet-control-zoom a:hover,
body.dark-mode .leaflet-bar a:hover {
    background: #0f172a !important;
    color: #93c5fd !important;
}

body.dark-mode .leaflet-control-zoom a:last-child,
body.dark-mode .leaflet-bar a:last-child {
    border-bottom: none !important;
}

body.dark-mode .leaflet-control-attribution {
    background: rgba(15, 23, 42, 0.85) !important;
    color: #94a3b8 !important;
    border-top: 1px solid #334155 !important;
}

body.dark-mode .leaflet-control-attribution a {
    color: #60a5fa !important;
}

body.dark-mode .leaflet-control-layers {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4) !important;
}

body.dark-mode .leaflet-control-layers-toggle {
    background-color: #1e293b !important;
}

body.dark-mode .leaflet-control-layers-list {
    color: #cbd5e1 !important;
}

body.dark-mode .leaflet-touch .leaflet-bar {
    border: 1px solid #334155 !important;
}

.btn-premium:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.60);
    color: #fff !important;
}
:is([data-theme="light"], body.light-mode) .btn-premium {
    box-shadow: 0 2px 8px rgba(180, 110, 0, 0.30);
}

/* Old square stat tiles removed from the layout; keep marker styles below. */

/* ── Map marker ── */
.custom-div-icon {
    background: transparent !important;
    border: none !important;
}
.pulse-marker-static {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.40);
    border: 2px solid rgba(255,255,255,0.55);
    overflow: hidden;
    transition: box-shadow 160ms ease, transform 160ms ease;
}

/* single value — centred */
.pulse-marker-static .marker-temp-center {
    font-size: 0.75rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.55);
    line-height: 1;
    letter-spacing: -0.02em;
}

/* split values — top half (2m) / bottom half (5cm) */
.pulse-marker-static .marker-temp-top {
    font-size: 0.65rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.55);
    line-height: 1;
    letter-spacing: -0.02em;
    padding-bottom: 1px;
}
.pulse-marker-static .marker-temp-bottom {
    font-size: 0.58rem;
    font-weight: 600;
    color: rgba(255,255,255,0.90);
    text-shadow: 0 1px 2px rgba(0,0,0,0.45);
    line-height: 1;
    padding-top: 1px;
    border-top: 1px solid rgba(255,255,255,0.40);
    width: 80%;
    text-align: center;
}

/* Improve legibility of small marker labels on both dark and light backgrounds.
   Keep the contour minimal so bright circles do not wash out the white text. */
.pulse-marker-static .reading,
.pulse-marker-static .marker-temp-center,
.pulse-marker-static .marker-temp-top,
.pulse-marker-static .marker-temp-bottom {
    /* soft outer glow + subtle offset shadow for contrast */
    text-shadow: 0 0 2px rgba(0,0,0,0.72), 0 1px 0 rgba(0,0,0,0.35);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
.stat-tile::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    border-radius: 10px 0 0 10px;
    background: var(--tile-accent, rgba(255,255,255,0.4));
}
/* Decorative large icon watermark */
.stat-tile::after {
    content: var(--tile-icon, '');
    font-family: 'FontAwesome';
    position: absolute;
    right: 6px;
    bottom: -2px;
    font-size: 1.8rem;
    opacity: 0.07;
    pointer-events: none;
    line-height: 1;
}
.stat-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px var(--tile-glow, rgba(0,0,0,0.25)) !important;
}
.stat-tile .stat-value {
    font-size: 1.1rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 1px;
    letter-spacing: -0.03em;
}
.stat-tile .stat-label {
    font-size: 0.55rem;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
}

/* Remove old stat tile visuals to avoid confusion; header inline pills are used instead. */

/* Ensure header-stats pills remain visible on light theme */
:is([data-theme="light"], body.light-mode) .summary-dashboard-header .hdr-pill {
    background: rgba(0,0,0,0.03);
    color: #0f172a;
}

/* ── Extreme temperature cards ── */
.extreme-card {
    border-radius: 12px;
    color: white;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.10);
}
/* Large watermark icon */
.extreme-card::after {
    content: var(--ext-icon, '');
    font-family: 'FontAwesome';
    position: absolute;
    right: -4px;
    bottom: -4px;
    font-size: 2.8rem;
    opacity: 0.08;
    pointer-events: none;
    line-height: 1;
}
.extreme-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 22px var(--ext-glow, rgba(0,0,0,0.3)) !important;
}
.extreme-card .extreme-label {
    font-size: 0.55rem;
    opacity: 0.75;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    margin-bottom: 2px;
}
.extreme-card .extreme-temp {
    font-size: 1.3rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.04em;
}
.extreme-card .extreme-name {
    font-size: 0.6rem;
    opacity: 0.7;
    margin-top: 3px;
    font-weight: 500;
}
.extreme-card.extreme-cold {
    background: linear-gradient(145deg, #0c4a6e 0%, #0369a1 50%, #0ea5e9 100%);
    box-shadow: 0 4px 18px rgba(3,105,161,0.30);
    --ext-icon:  '\f2dc';
    --ext-glow:  rgba(14,165,233,0.40);
}
.extreme-card.extreme-hot {
    background: linear-gradient(145deg, #7c2d12 0%, #c2410c 50%, #f97316 100%);
    box-shadow: 0 4px 18px rgba(194,65,12,0.30);
    --ext-icon:  '\f185';
    --ext-glow:  rgba(249,115,22,0.40);
}

/* ── Summary dashboard panel ── */
.summary-dashboard {
    background: var(--pub-card-bg);
    border-radius: 12px;
    border: 1px solid var(--pub-card-border);
    box-shadow: var(--pub-card-shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.summary-dashboard-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 60%, #1a4f8a 100%);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.summary-dashboard-header .header-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7dd3fc;
    font-size: 1rem;
    flex-shrink: 0;
}
.summary-dashboard-header .header-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.01em;
    line-height: 1.2;
}
.summary-dashboard-header .header-subtitle {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.55);
    font-weight: 400;
}
.summary-dashboard-header .live-badge {
    background: rgba(255, 255, 255, 0.15);
    color: #7dd3fc;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
}
.summary-dashboard-header .live-badge .live-dot {
    font-size: 0.45rem;
    vertical-align: middle;
    color: #4ade80;
}
.summary-dashboard-body {
    padding: 16px 18px;
    flex: 1;
}
.summary-dashboard-footer {
    background: rgba(0, 0, 0, 0.15);
    border-top: 1px solid var(--pub-card-border);
    padding: 8px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 0.7rem;
    flex-shrink: 0;
}

/* ── Leaderboard ── */
.temp-leaderboard {
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}
.temp-leaderboard-header {
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.temp-leaderboard-header.live-header {
    background: linear-gradient(90deg, #0c4a6e 0%, #0369a1 100%);
}
.temp-leaderboard-header.h24-header {
    background: linear-gradient(90deg, #1e1b4b 0%, #4338ca 100%);
}
.temp-leaderboard-header .lb-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}
.temp-leaderboard-header .lb-badge {
    font-size: 0.62rem;
    padding: 2px 7px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.2);
    color: #bae6fd;
    font-weight: 600;
}
.temp-leaderboard-header.h24-header .lb-badge {
    color: #c7d2fe;
}

.temp-leaderboard-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 12px;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s;
}
.temp-leaderboard-row:last-child {
    border-bottom: none;
}
.temp-leaderboard-row:hover {
    background: #f8fafc;
}
.temp-leaderboard-row .rank {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #64748b;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: 8px;
}
.temp-leaderboard-row .rank.rank-1 { background: #fef9c3; color: #854d0e; }
.temp-leaderboard-row .rank.rank-2 { background: #f1f5f9; color: #475569; }
.temp-leaderboard-row .rank.rank-3 { background: #fef3c7; color: #92400e; }

.temp-leaderboard-row a {
    text-decoration: none;
    color: #1e293b;
    font-size: 0.8rem;
    font-weight: 500;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.temp-leaderboard-row a:hover {
    color: #0369a1;
}
.temp-leaderboard-row .temp-val {
    font-size: 0.82rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-left: 8px;
}

/* ── Map placeholder ── */
.map-placeholder {
    height: 450px;
    border-radius: 8px;
    background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e2e8f0;
    isolation: isolate;
}

/* ── Nav pills inside the always-dark stations branded header ── */
.stations-page-wrapper .card-header .nav-pills {
    background: rgba(255, 255, 255, 0.08) !important;
    border-radius: 6px;
    padding: 4px;
}
.stations-page-wrapper .card-header .nav-pills .nav-link {
    padding: 0.45rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 4px;
    margin: 0 2px;
    color: rgba(255, 255, 255, 0.60) !important;
    background: transparent;
    border: none;
    transition: all 0.2s ease;
}
.stations-page-wrapper .card-header .nav-pills .nav-link.active {
    background: rgba(14, 165, 233, 0.35) !important;
    color: #7dd3fc !important;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.30);
    font-weight: 600;
}
.stations-page-wrapper .card-header .nav-pills .nav-link:not(.active):hover {
    background: rgba(255, 255, 255, 0.12) !important;
    color: #fff !important;
}
.stations-page-wrapper .card-header .nav-pills .nav-link i { opacity: 0.65; }
.stations-page-wrapper .card-header .nav-pills .nav-link.active i,
.stations-page-wrapper .card-header .nav-pills .nav-link:hover i {
    opacity: 1;
    color: #7dd3fc;
}

@media (max-width: 991.98px) {
    .stations-page-wrapper .card-header .nav-pills .nav-link {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }
}
@media (max-width: 767.98px) {
    .stations-page-wrapper .card-header .nav-pills .nav-link {
        padding: 0.35rem 0.5rem;
        font-size: 0.75rem;
    }
    .stations-page-wrapper .card-header .nav-pills {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .map-placeholder {
        height: 280px;
    }
}

/* ============================================================
   Public layout — glassmorphism light theme
   Canvas provides the animated gradient background.
   Cards float on it as frosted glass panels.
   ============================================================ */

body:not(.dark-mode) .page-content,
body:not(.dark-mode) .main-container {
    background: transparent;
}

/* ============================================================
   AllStations page — glassmorphism dark theme overrides
   These are scoped to .stations-page-wrapper so they don't
   bleed into the authenticated layout where the same classes
   are used with a light theme.
   ============================================================ */

.stations-page-wrapper {
    padding: 0 0 1.25rem;
}

.stations-page-wrapper .panel.panel-default {
    background: transparent;
    border: 0;
    box-shadow: none;
}

.stations-page-wrapper .panel-body {
    padding: 0;
}

/* Main card */
.stations-page-wrapper .card {
    border-radius: 24px !important;
    /* Force a GPU compositing layer so backdrop-filter children render correctly
       on initial paint inside this overflow:hidden container (Chromium paint bug) */
    transform: translateZ(0);
    will-change: transform;
}

/* Card header — branded gradient (dark mode) */
.stations-page-wrapper .card-header {
    background: linear-gradient(135deg, rgba(7, 13, 31, 0.90) 0%, rgba(14, 165, 233, 0.22) 60%, rgba(99, 102, 241, 0.18) 100%) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.10) !important;
    padding: 1.2rem 1.5rem !important;
    border-radius: 24px 24px 0 0 !important;
}

/* In light mode: let public.css CSS vars drive the header (matches StationGraphs) */
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .card-header {
    background: var(--pub-header-bg) !important;
    border-bottom: 1px solid var(--pub-header-border) !important;
}

/* Nav pills in light mode — use dark readable colours on the pale-blue header */
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .card-header .nav-pills {
    background: rgba(30, 41, 59, 0.08) !important;
}
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .card-header .nav-pills .nav-link {
    color: var(--pub-pill-color) !important;
}
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .card-header .nav-pills .nav-link.active {
    background: var(--pub-pill-active-bg) !important;
    color: var(--pub-pill-active-color) !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .card-header .nav-pills .nav-link:not(.active):hover {
    background: var(--pub-pill-hover-bg) !important;
    color: var(--pub-pill-hover-color) !important;
}
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .card-header .nav-pills .nav-link i { opacity: 1; color: var(--pub-accent-color); }
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .card-header .graph-card-title,
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .card-header .graph-bold,
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .card-header h4,
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .card-header h6 {
    color: var(--pub-title-color) !important;
}
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .card-header .text-primary {
    color: var(--pub-accent-color) !important;
}

.stations-page-wrapper .card-body,
.stations-page-wrapper .tab-content,
.stations-page-wrapper .tab-pane {
    background: transparent !important;
}

/* Summary dashboard */
.stations-page-wrapper .summary-dashboard {
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.40);
    background: rgba(10, 20, 45, 0.65) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    /* Isolate stacking context to prevent backdrop-filter clipping by parent overflow:hidden */
    isolation: isolate;
    transform: translateZ(0);
}

.stations-page-wrapper .summary-dashboard-header {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.25) 0%, rgba(99, 102, 241, 0.22) 100%) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.10) !important;
}
.stations-page-wrapper .summary-dashboard-header .header-title  { color: #f1f5f9 !important; }
.stations-page-wrapper .summary-dashboard-header .header-subtitle { color: rgba(255, 255, 255, 0.55) !important; }
.stations-page-wrapper .summary-dashboard-header .header-icon {
    background: rgba(14, 165, 233, 0.25) !important;
    color: #7dd3fc !important;
}
.stations-page-wrapper .summary-dashboard-header .live-badge {
    background: rgba(74, 222, 128, 0.15) !important;
    color: #4ade80 !important;
    border: 1px solid rgba(74, 222, 128, 0.30) !important;
}
.stations-page-wrapper .summary-dashboard-header .live-badge .live-dot { color: #4ade80 !important; }
.stations-page-wrapper .summary-dashboard-body  { background: transparent !important; }
.stations-page-wrapper .summary-dashboard-footer {
    background: rgba(0, 0, 0, 0.20) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.07) !important;
    color: rgba(255, 255, 255, 0.45) !important;
}

/* Leaderboard */
.stations-page-wrapper .temp-leaderboard {
    border-radius: 16px;
    background: rgba(10, 20, 45, 0.55) !important;
    border: 1px solid rgba(255, 255, 255, 0.09) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.30);
    backdrop-filter: blur(12px);
    transform: translateZ(0);
}
.stations-page-wrapper .temp-leaderboard-row        { border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important; }
.stations-page-wrapper .temp-leaderboard-row:hover  { background: rgba(255, 255, 255, 0.06) !important; }
.stations-page-wrapper .temp-leaderboard-row a      { color: #e2e8f0 !important; }
.stations-page-wrapper .temp-leaderboard-row a:hover { color: #7dd3fc !important; }
.stations-page-wrapper .temp-leaderboard-row .rank  {
    background: rgba(255, 255, 255, 0.10) !important;
    color: rgba(255, 255, 255, 0.65) !important;
}
.stations-page-wrapper .temp-leaderboard-row .rank.rank-1 { background: rgba(253, 224, 71,  0.20) !important; color: #fde047 !important; }
.stations-page-wrapper .temp-leaderboard-row .rank.rank-2 { background: rgba(203, 213, 225, 0.15) !important; color: #cbd5e1 !important; }
.stations-page-wrapper .temp-leaderboard-row .rank.rank-3 { background: rgba(251, 191, 36,  0.18) !important; color: #fbbf24 !important; }

/* Map */
.stations-page-wrapper #map-placeholder,
.stations-page-wrapper #map {
    border-radius: 16px !important;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}
.stations-page-wrapper .map-placeholder {
    background: rgba(10, 20, 45, 0.60) !important;
    border: 1px solid rgba(255, 255, 255, 0.10) !important;
}
.stations-page-wrapper .map-placeholder .text-muted,
.stations-page-wrapper .text-muted {
    color: rgba(255, 255, 255, 0.45) !important;
}

/* Breadcrumb */
.stations-page-wrapper .breadcrumb-item a       { color: #7dd3fc !important; }
.stations-page-wrapper .breadcrumb-item.active  { color: rgba(255, 255, 255, 0.50) !important; }

/* ============================================================
   Light theme overrides for stations page
   Applies when html:is([data-theme="light"], body.light-mode) is set.
   The branded card header ALWAYS stays dark (intentional).
   ============================================================ */

/* Summary dashboard */
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .summary-dashboard {
    background: rgba(255, 255, 255, 0.92) !important;
    border: 1px solid rgba(148, 163, 184, 0.25) !important;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.08) !important;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .summary-dashboard-header:not(.branded-header) {
    background: linear-gradient(135deg, rgba(224,242,254,0.95) 0%, rgba(219,234,254,0.90) 100%) !important;
}
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .summary-dashboard-header:not(.branded-header) .header-title  { color: #f1f5f9 !important; }
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .summary-dashboard-header:not(.branded-header) .header-subtitle { color: rgba(255, 255, 255, 0.60) !important; }
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .summary-dashboard-header .header-icon {
    background: rgba(255, 255, 255, 0.15) !important;
    color: #7dd3fc !important;
}
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .summary-dashboard-header .live-badge {
    background: rgba(74, 222, 128, 0.20) !important;
    color: #4ade80 !important;
    border: 1px solid rgba(74, 222, 128, 0.35) !important;
}
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .summary-dashboard-header .live-badge .live-dot { color: #4ade80 !important; }
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .summary-dashboard-body {
    background: transparent !important;
}
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .summary-dashboard-footer {
    background: rgba(241,245,249,0.95) !important;
    border-top: 1px solid #e2e8f0 !important;
    color: #64748b !important;
}
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .stat-tile {
    border: 1px solid rgba(0,0,0,0.08) !important;
}
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .extreme-card {
    border: 1px solid rgba(0,0,0,0.08) !important;
}

/* Leaderboard */
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .temp-leaderboard {
    background: #fff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06) !important;
    backdrop-filter: none;
}
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .temp-leaderboard-row {
    border-bottom: 1px solid #f1f5f9 !important;
}
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .temp-leaderboard-row:hover {
    background: #f8fafc !important;
}
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .temp-leaderboard-row a {
    color: #1e293b !important;
}
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .temp-leaderboard-row a:hover {
    color: #0369a1 !important;
}
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .temp-leaderboard-row .rank {
    background: #e2e8f0 !important;
    color: #64748b !important;
}
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .temp-leaderboard-row .rank.rank-1 { background: #fef9c3 !important; color: #854d0e !important; }
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .temp-leaderboard-row .rank.rank-2 { background: #f1f5f9 !important; color: #475569 !important; }
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .temp-leaderboard-row .rank.rank-3 { background: #fef3c7 !important; color: #92400e !important; }

/* Map placeholder */
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .map-placeholder {
    background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%) !important;
    border: 1px solid #e2e8f0 !important;
}
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .map-placeholder .text-muted,
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .text-muted {
    color: #64748b !important;
}

/* Text in card-body tabs */
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .tab-pane,
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .card-body {
    color: #1e293b !important;
}

/* Ensure dark mode tab content is visible (higher specificity than global card rules) */
body.dark-mode .stations-page-wrapper .tab-pane,
body.dark-mode .stations-page-wrapper .card-body {
    color: #cbd5e1 !important;
}

/* Branded header in light theme uses a pale gradient for consistency */
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .summary-dashboard-header.branded-header {
    background: linear-gradient(135deg, rgba(227,242,253,0.95) 0%, rgba(219,234,254,0.95) 100%) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.10) !important;
}
/* On pale branded gradient, use dark text for contrast */
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .summary-dashboard-header.branded-header .header-title  { color: #0f172a !important; }
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .summary-dashboard-header.branded-header .header-subtitle { color: #475569 !important; }
/* Keep pills readable on the blue gradient (subtle translucent white) */
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .summary-dashboard-header .hdr-pill,
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .summary-dashboard-header .hdr-mini {
    background: rgba(255,255,255,0.12) !important;
    color: #f8fafc !important;
    border-color: rgba(255,255,255,0.12) !important;
}

/* Breadcrumb in light mode */
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .breadcrumb-item a      { color: #0369a1 !important; }
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .breadcrumb-item.active  { color: #64748b !important; }

/* Table rows in light mode */
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .table td,
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .table th {
    color: #1e293b !important;
}
:is([data-theme="light"], body.light-mode) .stations-page-wrapper .table a { color: #0369a1 !important; }

.custom-div-icon.leaderboard-highlight {
    z-index: 9999 !important;
}
/* subtle pulsing animation used when leaderboard row is hovered */
.custom-div-icon.leaderboard-highlight .pulse-marker-static {
    animation: leaderboardPulse 1000ms ease-in-out infinite;
}
.pulse-marker-static { transition: box-shadow 160ms ease; }

@keyframes leaderboardPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 6px 20px rgba(14,165,233,0.35);
    }
    50% {
        transform: scale(1.18);
        box-shadow: 0 12px 34px rgba(14,165,233,0.55);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 6px 20px rgba(14,165,233,0.35);
    }
}

/* ============================================================
   DARK MODE: DASHBOARD & MAP CARDS (High Specificity)
   (Overrides for authenticated stations/dashboard area)

   STRATEGY:
   - Target .stations-page-wrapper descendant selectors for higher specificity
   - Override template card/table/header defaults with dark theme colors
   - Match the public layout dark theme appearance
   - Use consistent slate palette (#0f172a, #1e293b, #334155) for backgrounds
   - Light text colors (#cbd5e1, #e2e8f0) for readability

   COMPONENTS COVERED:
   - Cards (headers, bodies, footers)
   - Summary dashboard headers and live badges
   - Temperature leaderboards with rank styling
   - Map placeholders and containers
   - Tables with hover states
   - Breadcrumb navigation
   - Stat tiles and extreme cards

   These rules ensure the authenticated dashboard matches the unified
   dark theme appearance without breaking existing light-mode styling.
   ============================================================ */

/* Dashboard cards in authenticated dark mode */
body.dark-mode .stations-page-wrapper .card {
    background: #1e293b !important;
    border-color: #334155 !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.35) !important;
}

body.dark-mode .stations-page-wrapper .card-header {
    background: #1e293b !important;
    border-bottom: 1px solid #334155 !important;
    color: #e2e8f0 !important;
}

body.dark-mode .stations-page-wrapper .card-body {
    background: #1e293b !important;
    color: #cbd5e1 !important;
}

body.dark-mode .stations-page-wrapper .card-footer {
    background: #1e293b !important;
    border-top: 1px solid #334155 !important;
    color: #94a3b8 !important;
}

/* Summary dashboard header in dark mode */
body.dark-mode .stations-page-wrapper .summary-dashboard-header {
    background: linear-gradient(135deg, #0c4a6e 0%, #075985 100%) !important;
    border-bottom: 1px solid #0369a1 !important;
}

body.dark-mode .stations-page-wrapper .summary-dashboard-header .header-title {
    color: #e0f2fe !important;
}

body.dark-mode .stations-page-wrapper .summary-dashboard-header .header-subtitle {
    color: #7dd3fc !important;
}

body.dark-mode .stations-page-wrapper .summary-dashboard-header .header-icon {
    background: rgba(56, 189, 248, 0.15) !important;
    color: #38bdf8 !important;
}

body.dark-mode .stations-page-wrapper .summary-dashboard-header .live-badge {
    background: rgba(34, 197, 94, 0.15) !important;
    color: #4ade80 !important;
    border: 1px solid rgba(34, 197, 94, 0.30) !important;
}

body.dark-mode .stations-page-wrapper .summary-dashboard-body {
    background: #1e293b !important;
}

body.dark-mode .stations-page-wrapper .summary-dashboard-footer {
    background: #0f172a !important;
    border-top: 1px solid #334155 !important;
    color: #64748b !important;
}

/* Stat tiles and extreme cards */
body.dark-mode .stations-page-wrapper .stat-tile {
    background: #0f172a !important;
    border: 1px solid #334155 !important;
}

body.dark-mode .stations-page-wrapper .extreme-card {
    background: #0f172a !important;
    border: 1px solid #334155 !important;
}

/* Temperature leaderboard in dark mode */
body.dark-mode .stations-page-wrapper .temp-leaderboard {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.35) !important;
}

body.dark-mode .stations-page-wrapper .temp-leaderboard-row {
    border-bottom: 1px solid #334155 !important;
}

body.dark-mode .stations-page-wrapper .temp-leaderboard-row:hover {
    background: #0f172a !important;
}

body.dark-mode .stations-page-wrapper .temp-leaderboard-row a {
    color: #cbd5e1 !important;
}

body.dark-mode .stations-page-wrapper .temp-leaderboard-row a:hover {
    color: #60a5fa !important;
}

body.dark-mode .stations-page-wrapper .temp-leaderboard-row .rank {
    background: #334155 !important;
    color: #94a3b8 !important;
}

body.dark-mode .stations-page-wrapper .temp-leaderboard-row .rank.rank-1 {
    background: #713f12 !important;
    color: #fde047 !important;
}

body.dark-mode .stations-page-wrapper .temp-leaderboard-row .rank.rank-2 {
    background: #475569 !important;
    color: #cbd5e1 !important;
}

body.dark-mode .stations-page-wrapper .temp-leaderboard-row .rank.rank-3 {
    background: #78350f !important;
    color: #fcd34d !important;
}

/* Map placeholder in dark mode */
body.dark-mode .stations-page-wrapper .map-placeholder {
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%) !important;
    border: 1px solid #334155 !important;
}

body.dark-mode .stations-page-wrapper .map-placeholder .text-muted,
body.dark-mode .stations-page-wrapper .text-muted {
    color: #64748b !important;
}

/* Map container (for dashboard map cards) */
body.dark-mode .map-container {
    background: #0f172a !important;
    border-color: #334155 !important;
}

body.dark-mode .map-container .card {
    background: #1e293b !important;
    border-color: #334155 !important;
}

/* Breadcrumbs in dark mode */
body.dark-mode .stations-page-wrapper .breadcrumb-item a {
    color: #60a5fa !important;
}

body.dark-mode .stations-page-wrapper .breadcrumb-item.active {
    color: #94a3b8 !important;
}

/* Tables in dark mode */
body.dark-mode .stations-page-wrapper .table td,
body.dark-mode .stations-page-wrapper .table th {
    color: #cbd5e1 !important;
    border-color: #334155 !important;
}

body.dark-mode .stations-page-wrapper .table th {
    background: #0f172a !important;
    color: #94a3b8 !important;
}

body.dark-mode .stations-page-wrapper .table a {
    color: #60a5fa !important;
}

body.dark-mode .stations-page-wrapper .table-hover tbody tr:hover {
    background: #0f172a !important;
}
