/**
 * ============================================================================
 * TTC DASHBOARD - DESKTOP STYLES
 * ============================================================================
 * 
 * Main stylesheet for the desktop version of the TTC Dashboard. This file
 * contains all styles specific to larger screen layouts (laptops, desktops).
 * 
 * CONTENTS:
 * 1. CSS Variables (Design Tokens) - Colors, glass effects, borders
 * 2. Viewport & Map Styles - Full-screen SVG map container
 * 3. Floating UI Layer - Clock, status indicator, FAB buttons
 * 4. Menu Panel - Slide-out navigation drawer
 * 5. Legend Popup - Map layer toggles
 * 6. Content Panels - Alerts, upcoming, about screens
 * 7. Alert Cards - Individual alert display styling
 * 8. Track & Station SVG - Subway line and station markers
 * 9. Animations - Pulsing alerts, shuttle buses, transitions
 * 10. Light Mode - Theme override styles
 * 
 * DESIGN PRINCIPLES:
 * - Glassmorphism: Frosted glass effect with backdrop-filter blur
 * - Dark mode first, with light mode as an opt-in theme
 * - Responsive: Designed for 1024px+ screens
 * 
 * DEPENDENCIES:
 * - Google Fonts: Inter (400-800 weights)
 * - Font Awesome 6 (icons)
 * 
 * ============================================================================
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ============================================================================
   CSS VARIABLES (Design Tokens)
   These define the core visual properties used throughout the app.
   Changing these will update the entire theme.
   ============================================================================ */
:root {
    --bg-color: #0f1115;
    --surface-glass: rgba(22, 22, 24, 0.85);
    --surface-glass-border: rgba(255, 255, 255, 0.1);
    --l1-color: #FFC425;
    --l2-color: #009639;
    --l4-color: #B5236B;
    --l5-color: #F37021;
    --l6-color: #9ca3af;
    --alert-color: #ef4444;
    --delay-color: #f59e0b;
    --shuttle-color: #3b82f6;
    --text-main: #ffffff;
    --text-muted: #9ca3af;
    --border-color: rgba(255, 255, 255, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    overflow: hidden;
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    position: fixed;
}

/* ==========================================
   VIEWPORT - Full Screen Map
   ========================================== */
/* #map-viewport: GO desktop (go-desktop.html) uses the same id as mobile for one code path in go-mobile.js */
#viewport,
#map-viewport {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
    /* NO dot background - removed */
}

svg {
    width: 100%;
    height: 100%;
    overflow: visible;
    touch-action: none;
}

#map-root {
    cursor: grab;
    transform-origin: 0 0;
}

#map-root:active {
    cursor: grabbing;
}

/* ==========================================
   FLOATING UI LAYER
   ========================================== */
.ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Top Bar */
.top-bar {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: none;
}

/* Top Center Info (Clock & Status) */
.top-center-info {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
    z-index: 101;
}

/* FAB Stack */
.fab-stack {
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    z-index: 501;
}

.fab-stack.left {
    margin-right: auto;
}

/* Animated Hamburger Icon (Squash style) */
.hamburger-icon {
    position: relative;
    width: 48px;
    height: 48px;
    cursor: pointer;
}

/* Prevent fab hover transform from disrupting the icon */
.hamburger-icon:hover {
    transform: none;
}

.hamburger-bar {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 20px;
    height: 2px;
    margin-left: -10px;
    margin-top: -1px;
    background: currentColor;
    border-radius: 2px;
    transition: transform 0.5s cubic-bezier(0.2, 0.6, 0.3, 1),
        opacity 0.5s cubic-bezier(0.2, 0.6, 0.3, 1);
}

.hamburger-bar:nth-child(1) {
    transform: translateY(-6px);
}

.hamburger-bar:nth-child(3) {
    transform: translateY(6px);
}

/* Active state - Squash into X */
.hamburger-icon.is-active .hamburger-bar:nth-child(1) {
    transform: rotate(45deg);
}

.hamburger-icon.is-active .hamburger-bar:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.hamburger-icon.is-active .hamburger-bar:nth-child(3) {
    transform: rotate(-45deg);
}

/* Info button notification dot */
.info-notif-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 14px;
    height: 14px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid var(--surface-glass);
    pointer-events: none;
}

@keyframes notif-pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.3);
        opacity: 0.7;
    }
}

#btn-info-desktop {
    position: relative;
}

/* Floating Action Buttons */
.fab {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--surface-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--surface-glass-border);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 18px;
}

.fab:hover {
    transform: scale(1.05);
    background: rgba(40, 40, 45, 0.9);
}

.fab:active {
    transform: scale(0.95);
}

.fab i {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Header Clock */
.header-clock {
    text-align: center;
    color: var(--text-main);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    background: var(--surface-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--surface-glass-border);
    padding: 10px 20px;
    border-radius: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.clock-time {
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.clock-date {
    font-size: 12px;
    opacity: 0.8;
    margin-top: 4px;
    font-weight: 500;
}

/* Status Indicator */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--surface-glass-border);
    padding: 8px 16px;
    border-radius: 24px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-main);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    pointer-events: auto;
}

.status-indicator.loading .status-spinner {
    display: block;
}

.status-indicator.loading .live-dot {
    display: none;
}

.status-indicator.loading .status-text {
    color: var(--text-muted);
}

.status-indicator.live .status-spinner {
    display: none;
}

.status-indicator.live .live-dot {
    display: block;
}

.status-indicator.live .status-text {
    color: #22c55e;
}

.status-indicator.live {
    border-color: rgba(34, 197, 94, 0.3);
}

.status-spinner {
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--l1-color);
    border-radius: 50%;
    animation: spinnerRotate 0.8s linear infinite;
}

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

.live-dot {
    width: 8px;
    height: 8px;
    min-width: 8px;
    min-height: 8px;
    flex-shrink: 0;
    background: #22c55e;
    border-radius: 50%;
    animation: livePulse 2s ease-in-out infinite;
}

@keyframes livePulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(34, 197, 94, 0);
    }
}

.status-indicator.error .status-spinner,
.status-indicator.error .live-dot {
    display: none;
}

.status-indicator.error .status-text {
    color: #ef4444;
}

.status-indicator.error {
    border-color: rgba(239, 68, 68, 0.3);
}

/* Preview State */
.status-eye {
    display: none;
    color: #f59e0b;
    /* Amber-500 */
    font-size: 14px;
    margin-right: 6px;
    animation: blinkEye 2s infinite;
}

@keyframes blinkEye {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

.status-indicator.preview .status-spinner,
.status-indicator.preview .live-dot {
    display: none;
}

.status-indicator.preview .status-eye {
    display: block;
}

.status-indicator.preview .status-text {
    color: #f59e0b;
}

.status-indicator.preview {
    border-color: rgba(245, 158, 11, 0.3);
}

/* Preview Cancel Button */
.preview-cancel-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #f59e0b;
    cursor: pointer;
    font-size: 10px;
    margin-left: 4px;
    transition: all 0.2s;
}

.preview-cancel-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.status-indicator.error::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #ef4444;
    border-radius: 50%;
    margin-right: 6px;
}

/* Closed State (Subway not operating) */
.status-indicator.closed .status-spinner,
.status-indicator.closed .live-dot {
    display: none;
}

.status-indicator.closed .status-text {
    color: #9ca3af;
    /* Gray-400 */
}

.status-indicator.closed {
    border-color: rgba(156, 163, 175, 0.3);
}

.status-indicator.closed::before {
    content: '\f186';
    /* fa-moon */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 12px;
    color: #9ca3af;
    margin-right: 6px;
}

/* ==========================================
   PULSING ALERT MARKERS
   ========================================== */
.alert-marker-pulse {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 50;
    pointer-events: none;
}

.alert-marker-pulse::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.2);
    animation: pulse-animation 2s infinite;
}

.alert-marker-pulse.red {
    color: #ef4444;
    background: #ef4444;
}

.alert-marker-pulse.yellow {
    color: #FFC425;
    background: #FFC425;
}

@keyframes pulse-animation {
    0% {
        box-shadow: 0 0 0 0px rgba(0, 0, 0, 0.2);
    }

    100% {
        box-shadow: 0 0 0 20px rgba(0, 0, 0, 0);
    }
}

/* SVG Pulse Animation */
@keyframes svg-pulse-red {
    0% {
        r: 6;
        opacity: 0.8;
        stroke-width: 0;
    }

    50% {
        opacity: 0.4;
    }

    100% {
        r: 25;
        opacity: 0;
        stroke-width: 0;
    }
}

@keyframes svg-pulse-yellow {
    0% {
        r: 6;
        opacity: 0.8;
        stroke-width: 0;
    }

    50% {
        opacity: 0.4;
    }

    100% {
        r: 25;
        opacity: 0;
        stroke-width: 0;
    }
}

.svg-alert-pulse {
    pointer-events: none;
}

.svg-alert-pulse.red {
    fill: #ef4444;
    animation: svg-pulse-red 2s infinite;
}

.svg-alert-pulse.yellow {
    fill: #f59e0b;
    animation: svg-pulse-yellow 2s infinite;
}

/* ==========================================
   SLIDE-OUT MENU PANEL
   ========================================== */
.menu-panel {
    position: fixed;
    top: 20px;
    left: 70px;
    width: 260px;
    max-height: calc(100vh - 40px);
    background: var(--surface-glass);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid var(--surface-glass-border);
    border-radius: 20px;
    z-index: 1000;
    display: flex !important;
    flex-direction: column;
    transform: scale(1);
    transform-origin: top left;
    opacity: 1;
    visibility: visible;
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1),
        opacity 0.25s ease,
        visibility 0.3s ease;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
    overflow: hidden;
}

.menu-panel.hidden {
    display: flex !important;
    transform: scale(0.9);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Left FAB transition (no longer shifts) */
.fab-stack.left {
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.menu-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.menu-nav {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
    pointer-events: auto;
}

.menu-item {
    padding: 16px 24px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--text-muted);
    font-size: 15px;
    font-weight: 500;
    pointer-events: auto;
}

.menu-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: white;
}

.menu-item.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border-left: 3px solid var(--l1-color);
}

.menu-item i {
    width: 20px;
    font-size: 16px;
}

.menu-badge {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    padding: 0 6px;
    animation: badge-pulse 2s ease-in-out infinite;
}

.menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 8px 0;
}

.menu-item-toggle {
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    color: var(--text-muted);
    font-size: 15px;
    font-weight: 500;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 16px;
}

.toggle-label i {
    width: 20px;
    font-size: 16px;
}

/* Switch Component - User Provided Fix */
.switch {
    /* switch */
    --switch-width: 46px;
    --switch-height: 24px;
    --switch-bg: rgb(131, 131, 131);
    --switch-checked-bg: var(--l2-color);
    /* Using theme color #009639 matches app better than rgb(0, 218, 80) */
    --switch-offset: calc((var(--switch-height) - var(--circle-diameter)) / 2);
    --switch-transition: all .2s cubic-bezier(0.27, 0.2, 0.25, 1.51);
    /* circle */
    --circle-diameter: 18px;
    --circle-bg: #fff;
    --circle-shadow: 1px 1px 2px rgba(146, 146, 146, 0.45);
    --circle-checked-shadow: -1px 1px 2px rgba(163, 163, 163, 0.45);
    --circle-transition: var(--switch-transition);
    /* icon */
    --icon-transition: all .2s cubic-bezier(0.27, 0.2, 0.25, 1.51);
    --icon-cross-color: var(--switch-bg);
    --icon-cross-size: 6px;
    --icon-checkmark-color: var(--switch-checked-bg);
    --icon-checkmark-size: 10px;
    /* effect line */
    --effect-width: calc(var(--circle-diameter) / 2);
    --effect-height: calc(var(--effect-width) / 2 - 1px);
    --effect-bg: var(--circle-bg);
    --effect-border-radius: 1px;
    --effect-transition: all .2s ease-in-out;

    position: relative;
    display: inline-block;
    width: var(--switch-width);
    height: var(--switch-height);
}

.switch input {
    display: none;
}

.slider {
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    width: var(--switch-width);
    height: var(--switch-height);
    background: var(--switch-bg);
    border-radius: 999px;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    position: relative;
    -webkit-transition: var(--switch-transition);
    -o-transition: var(--switch-transition);
    transition: var(--switch-transition);
    cursor: pointer;
    border: none;
    /* Reset potential border from previous CSS */
}

.circle {
    width: var(--circle-diameter);
    height: var(--circle-diameter);
    background: var(--circle-bg);
    border-radius: inherit;
    -webkit-box-shadow: var(--circle-shadow);
    box-shadow: var(--circle-shadow);
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    -webkit-transition: var(--circle-transition);
    -o-transition: var(--circle-transition);
    transition: var(--circle-transition);
    z-index: 1;
    position: absolute;
    left: var(--switch-offset);
}

.slider::before {
    content: "";
    position: absolute;
    width: var(--effect-width);
    height: var(--effect-height);
    left: calc(var(--switch-offset) + (var(--effect-width) / 2));
    background: var(--effect-bg);
    border-radius: var(--effect-border-radius);
    -webkit-transition: var(--effect-transition);
    -o-transition: var(--effect-transition);
    transition: var(--effect-transition);
}

/* actions */

.switch input:checked+.slider {
    background: var(--switch-checked-bg);
    border-color: var(--switch-checked-bg);
}

.switch input:checked+.slider .circle {
    left: calc(100% - var(--circle-diameter) - var(--switch-offset));
    -webkit-box-shadow: var(--circle-checked-shadow);
    box-shadow: var(--circle-checked-shadow);
}

.switch input:checked+.slider::before {
    left: calc(100% - var(--effect-width) - (var(--effect-width) / 2) - var(--switch-offset));
}

@keyframes badge-pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.menu-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    z-index: 998;
    transition: opacity 0.3s ease;
    pointer-events: auto;
}

.menu-overlay.hidden {
    display: block !important;
    pointer-events: none;
}

/* ==========================================
   LEGEND POPUP
   ========================================== */
.legend-popup {
    position: fixed;
    top: 60px;
    right: 85px;
    /* Position to the left of the layers button with gap */
    width: 195px;
    background: var(--surface-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--surface-glass-border);
    border-radius: 16px;
    padding: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 500;
    pointer-events: auto;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    transform-origin: top right;
    max-height: 80vh;
    overflow-y: auto;
}

.legend-popup.hidden {
    opacity: 0;
    transform: scale(0.9);
    pointer-events: none;
}

.legend-popup-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-main);
}

.legend-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 10px 8px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s, opacity 0.2s;
}

.legend-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.legend-item .toggle-icon {
    font-size: 14px;
    color: var(--l1-color);
    flex-shrink: 0;
    width: 16px;
}

.legend-item svg {
    flex-shrink: 0;
    width: 32px;
    height: 8px;
}

.legend-item span {
    white-space: nowrap;
}

.legend-item:not(.active) {
    opacity: 0.5;
}

.legend-item:not(.active) .toggle-icon {
    color: rgba(255, 255, 255, 0.4);
}

/* ==========================================
   INFO POPUP (Walkthrough)
   ========================================== */
#info-popup-desktop {
    right: 16px;
    top: 140px;
    width: 340px;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
    transform-origin: top right;
    z-index: 499;
}

/* Legend items inline within walkthrough list */
.walkthrough-list .legend-item {
    display: flex !important;
    align-items: center;
    padding-left: 0 !important;
    border-radius: 6px;
    padding: 6px 8px !important;
    margin-left: -8px;
    transition: background 0.2s, opacity 0.2s;
}

.walkthrough-list .legend-item::before {
    display: none !important;
}

.walkthrough-list .legend-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.walkthrough-list .legend-item:not(.active) {
    opacity: 0.4;
}

/* Walkthrough Sections */
.walkthrough-section {
    margin-bottom: 12px;
}

.walkthrough-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.walkthrough-text {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

.walkthrough-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
}

.walkthrough-list li {
    margin-bottom: 4px;
    padding-left: 12px;
    position: relative;
}

.walkthrough-list li::before {
    content: "•";
    color: var(--l1-color);
    position: absolute;
    left: 0;
}

.walkthrough-list li strong {
    color: var(--text-main);
}

.info-popup-footer {
    font-size: 11px;
    color: var(--l1-color);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 10px;
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* Light mode walkthrough */
body.light-mode .walkthrough-title {
    color: #1f2937;
}

body.light-mode .walkthrough-text,
body.light-mode .walkthrough-list {
    color: #4b5563;
}

body.light-mode .walkthrough-list li strong {
    color: #1f2937;
}

body.light-mode .info-popup-footer {
    color: #000000;
    border-top-color: rgba(0, 0, 0, 0.1);
}

/* ==========================================
   CONTENT PANELS (Alerts, Upcoming, About)
   ========================================== */
.content-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 17, 21, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 800;
    display: none;
    flex-direction: column;
    pointer-events: auto;
}

.content-panel.active {
    display: flex;
}

.panel-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h2 {
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.panel-header h2 i {
    color: var(--l1-color);
}

.close-panel-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
}

.close-panel-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

.about-content {
    max-width: 600px;
    margin: 0 auto;
    background: var(--surface-glass);
    border: 1px solid var(--surface-glass-border);
    padding: 32px;
    border-radius: 16px;
}

.about-content h3 {
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.about-content p {
    font-size: 15px;
    line-height: 1.6;
    color: #d1d5db;
}

/* ==========================================
   LINE FILTER BUTTONS
   ========================================== */
.line-filter {
    display: flex;
    gap: 8px;
    padding: 16px 24px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border-color);
}

.filter-btn {
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.filter-btn:hover {
    transform: scale(1.05);
}

.filter-btn.active {
    box-shadow: 0 0 0 2px white;
}

.filter-btn.bg-l1 {
    background: var(--l1-color);
    color: black;
}

.filter-btn.bg-l2 {
    background: var(--l2-color);
    color: white;
}

.filter-btn.bg-l4 {
    background: var(--l4-color);
    color: white;
}

.filter-btn.bg-l5 {
    background: var(--l5-color);
    color: white;
}

.filter-btn.bg-l6 {
    background: var(--l6-color);
    color: white;
}

/* ==========================================
   ALERT CARDS
   ========================================== */
.alert-card {
    background: var(--surface-glass);
    border: 1px solid var(--surface-glass-border);
    border-left: 4px solid var(--alert-color);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
}

.alert-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.alert-line-badge {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
}

.alert-line-badge.line-1 {
    background-color: var(--l1-color);
    color: black;
}

.alert-line-badge.line-2 {
    background-color: var(--l2-color);
    color: white;
}

.alert-line-badge.line-4 {
    background-color: var(--l4-color);
    color: white;
}

.alert-title {
    font-weight: 700;
    font-size: 16px;
    flex: 1;
}

.alert-meta {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.alert-description {
    font-size: 14px;
    color: #d1d5db;
    line-height: 1.5;
}

.shuttle-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background-color: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    margin-top: 8px;
}

/* ==========================================
   TRACK AND STATION STYLES
   ========================================== */
.track {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 12px;
}

.track.line-1 {
    stroke: var(--l1-color);
}

.track.line-2 {
    stroke: var(--l2-color);
}

.track.line-4 {
    stroke: var(--l4-color);
}

.track.line-5 {
    stroke: var(--l5-color);
    /* Line 5 is now open - solid stroke like other lines */
}

.track.line-6 {
    stroke: var(--l6-color);
}

.station-marker {
    cursor: pointer;
    transition: transform 0.2s;
}

.station-marker:hover {
    transform: scale(1.3);
    transform-box: fill-box;
    transform-origin: center;
}

.spadina-inner,
.st-george-inner {
    cursor: pointer;
    transition: transform 0.2s;
}

.spadina-inner:hover,
.st-george-inner:hover {
    transform: scale(1.2);
}

.station-label {
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    font-weight: 600;
    fill: #9ca3af;
    pointer-events: none;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.terminal-label {
    font-size: 14px;
    font-weight: 800;
    fill: white;
}

.terminal-text {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 800;
    text-anchor: middle;
    dominant-baseline: central;
    pointer-events: none;
}

/* Alert animations */
.alert-base {
    fill: none;
    stroke: var(--alert-color);
    stroke-linecap: round;
    filter: drop-shadow(0 0 8px var(--alert-color));
}

.alert-base.delay {
    stroke: var(--delay-color);
    filter: drop-shadow(0 0 8px var(--delay-color));
}

.shuttle-outline {
    fill: none;
    stroke: var(--shuttle-color);
    stroke-width: 26px;
    /* Slightly wider than alert-base (14px) for visible blue border */
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 1;
    filter: drop-shadow(0 0 8px var(--shuttle-color));
}

/* Shuttle outline - SOLID stroke behind dashed red alerts */
.shuttle-outline.flow-forward,
.shuttle-outline.flow-reverse {
    stroke-width: 24px;
    stroke-dasharray: none;
    /* Solid blue outline behind dashed red */
}

/* Solid alerts (both ways) - pulsing blue outline SYNCED with red alert (1.5s) */
.shuttle-outline.pulse-solid {
    stroke-dasharray: none;
    animation: shuttlePulseDesktop 1.5s ease-in-out infinite;
}

@keyframes shuttlePulseDesktop {

    0%,
    100% {
        stroke-opacity: 0.8;
        stroke-width: 22px;
        filter: drop-shadow(0 0 6px var(--shuttle-color));
    }

    50% {
        stroke-opacity: 1;
        stroke-width: 26px;
        filter: drop-shadow(0 0 10px var(--shuttle-color));
    }
}

.flow-forward {
    stroke-width: 14px;
    opacity: 0.9;
    stroke-dasharray: 20, 20;
    animation: dash-fwd 1s linear infinite;
}

.flow-reverse {
    stroke-width: 14px;
    opacity: 0.9;
    stroke-dasharray: 20, 20;
    animation: dash-rev 1s linear infinite;
}

.pulse-solid {
    stroke-dasharray: none;
    animation: pulse-alert 1.5s ease-in-out infinite;
}

.station-alert-glow {
    fill: var(--alert-color);
    stroke: none;
    pointer-events: none;
    animation: stationPulse 2s ease-in-out infinite;
}

.station-alert-dot {
    fill: var(--alert-color);
    fill-opacity: 0.5;
    stroke: none;
    pointer-events: none;
}

@keyframes stationPulse {

    0%,
    100% {
        r: 8px;
        fill-opacity: 0.6;
    }

    50% {
        r: 16px;
        fill-opacity: 0;
    }
}

@keyframes dash-fwd {
    to {
        stroke-dashoffset: -40;
    }
}

@keyframes dash-rev {
    to {
        stroke-dashoffset: 40;
    }
}

@keyframes pulse-alert {
    0% {
        opacity: 0.6;
        stroke-width: 12px;
    }

    50% {
        opacity: 1;
        stroke-width: 16px;
    }

    100% {
        opacity: 0.6;
        stroke-width: 12px;
    }
}

@keyframes slideDown {
    from {
        transform: translateX(-50%) translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* ==========================================
   DISCLAIMER BANNER
   ========================================== */
.disclaimer-banner {
    position: fixed;
    bottom: 30px;
    left: 20px;
    right: 20px;
    width: auto;
    border-radius: 20px;
    background: rgba(22, 25, 31, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--surface-glass-border);
    padding: 16px 20px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transform: translateY(150%);
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.disclaimer-banner.visible {
    transform: translateY(0);
}

.disclaimer-content {
    display: flex;
    align-items: flex-start;
    color: #eee;
    font-size: 13px;
    line-height: 1.5;
}

#btn-accept-disclaimer {
    width: 100%;
    background: white;
    color: black;
    border: none;
    padding: 12px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.1s;
}

#btn-accept-disclaimer:active {
    transform: scale(0.98);
}

/* ==========================================
   LIGHT MODE
   ========================================== */
body.light-mode {
    --bg-color: #e5e7eb;
    --surface-glass: rgba(220, 220, 225, 0.9);
    --surface-glass-border: rgba(0, 0, 0, 0.1);
    --text-main: #1f2937;
    --text-muted: #4b5563;
    --border-color: rgba(0, 0, 0, 0.1);
}

body.light-mode .station-label {
    fill: #4b5563;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
}

body.light-mode .terminal-label {
    fill: #1f2937;
}

body.light-mode .legend-popup-title,
body.light-mode .menu-header span {
    color: var(--text-main);
}

body.light-mode .legend-item {
    color: var(--text-main);
}

body.light-mode .about-content p {
    color: #374151;
}

body.light-mode .alert-description {
    color: #374151;
}

body.light-mode .content-panel {
    background: rgba(229, 231, 235, 0.95);
}

body.light-mode .disclaimer-banner {
    background: rgba(200, 200, 205, 0.98);
    color: #000000;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

body.light-mode .disclaimer-banner .disclaimer-content {
    color: #000000;
}

/* ==========================================
   SUBWAY CLOSED OVERLAY
   ========================================== */
.closed-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.closed-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.closed-content {
    text-align: center;
    padding: 48px 64px;
    background: var(--surface-glass);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid var(--surface-glass-border);
    border-radius: 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: floatIn 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes floatIn {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.closed-icon {
    font-size: 56px;
    color: #6366f1;
    margin-bottom: 20px;
    display: block;
    animation: moonGlow 3s ease-in-out infinite;
}

@keyframes moonGlow {

    0%,
    100% {
        text-shadow: 0 0 20px rgba(99, 102, 241, 0.5);
    }

    50% {
        text-shadow: 0 0 40px rgba(99, 102, 241, 0.8), 0 0 60px rgba(99, 102, 241, 0.4);
    }
}

.closed-title {
    font-size: 32px;
    font-weight: 800;
    color: white;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.closed-subtitle {
    font-size: 18px;
    color: #9ca3af;
    font-weight: 500;
}

.closed-subtitle span {
    color: var(--l1-color);
    font-weight: 700;
}

.closed-divider {
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    margin: 24px auto;
    border-radius: 2px;
}

.closed-note {
    font-size: 14px;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}

.closed-note::before {
    content: '\f05a';
    /* fa-info-circle */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 14px;
}

.closed-hours {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px 20px;
    margin-top: 8px;
}

.hours-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #9ca3af;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.hours-title i {
    color: var(--l1-color);
}

.hours-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.hours-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.hours-day {
    font-size: 14px;
    color: #d1d5db;
    font-weight: 500;
}

.hours-time {
    font-size: 14px;
    color: white;
    font-weight: 600;
}

/* Light mode adjustments for closed overlay */
body.light-mode .closed-overlay {
    background: rgba(255, 255, 255, 0.7);
}

body.light-mode .closed-title {
    color: #1f2937;
}

body.light-mode .closed-subtitle {
    color: #6b7280;
}

body.light-mode .closed-note {
    color: #9ca3af;
}

body.light-mode .closed-hours {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
}

body.light-mode .hours-day {
    color: #4b5563;
}

body.light-mode .hours-time {
    color: #1f2937;
}

body.light-mode .hours-row {
    border-color: rgba(0, 0, 0, 0.05);
}

/* ==========================================
   HIGH CONTRAST MODE
   ========================================== */
body.high-contrast {
    --alert-color: #ff00ff;
    /* Magenta */
    --delay-color: #00ffff;
    /* Cyan */
}

/* Override specific red/yellow classes if they don't use variables */
body.high-contrast .alert-marker-pulse.red,
body.high-contrast .alert-marker-pulse.red::before {
    color: #ff00ff;
    background: #ff00ff;
}

body.high-contrast .alert-marker-pulse.yellow,
body.high-contrast .alert-marker-pulse.yellow::before {
    color: #00ffff;
    background: #00ffff;
}

body.high-contrast .svg-alert-pulse.red {
    fill: #ff00ff;
}

body.high-contrast .svg-alert-pulse.yellow {
    fill: #00ffff;
}

/* Ensure legend and status indicators also update */
body.high-contrast .status-indicator.error .status-text {
    color: #ff00ff;
}

body.high-contrast .status-indicator.error::before {
    background: #ff00ff;
}

body.high-contrast .status-indicator.preview .status-text,
body.high-contrast .status-eye {
    color: #00ffff;
}

/* Update upcoming alert cards border */
body.high-contrast .upcoming-alert-card {
    border-left-color: var(--delay-color) !important;
}

/* Legend Label Toggling */
.hc-label {
    display: none;
}

body.high-contrast .hc-label {
    display: inline;
}

body.high-contrast .normal-label {
    display: none;
}

/* --------------------------------------------------------------------------
   Station arrivals — compact popup near click (TTC + GO desktop)
   -------------------------------------------------------------------------- */
.station-arrivals-backdrop {
    position: fixed;
    inset: 0;
    z-index: 4500;
    background: rgba(0, 0, 0, 0.2);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

.station-arrivals-popup {
    position: fixed;
    z-index: 4501;
    width: min(360px, calc(100vw - 24px));
    max-height: min(420px, 65vh);
    pointer-events: none;
}

.station-arrivals-popup__inner {
    pointer-events: auto;
    background: var(--surface-glass);
    border: 1px solid var(--surface-glass-border);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    backdrop-filter: blur(20px) saturate(160%);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: min(420px, 65vh);
}

.station-arrivals-popup__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.station-arrivals-popup__title {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-main);
    line-height: 1.25;
}

.station-arrivals-popup__close {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease;
}

.station-arrivals-popup__close:hover {
    background: rgba(255, 255, 255, 0.14);
    color: var(--text-main);
}

.station-arrivals-popup__body {
    padding: 10px 12px 14px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

body.light-mode .station-arrivals-popup__inner {
    background: rgba(255, 255, 255, 0.94);
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}