/* ============================================
   FGC SANT QUIRZE STATION DISPLAY
   Professional TV-Optimized Design System
   ============================================ */

/* ============================================
   PROPORTIONAL LAYOUT SYSTEM
   Ensures consistent proportions on ALL screen sizes
   ============================================ */

:root {
    /* ========================================
       VIEWPORT-BASED LAYOUT PROPORTIONS
       ======================================== */

    /* Main layout sections - proportional to viewport height */
    --header-height: 10vh;
    --footer-height: 8vh;
    --main-height: 82vh;
    --alert-height: clamp(60px, 8vh, 120px);

    /* Table row heights - proportional to viewport */
    --arrival-row-height: clamp(80px, 12vh, 160px);

    /* Maximum content width - proportional to viewport width */
    --max-width: 95vw;

    /* ========================================
       PROPORTIONAL COLUMN WIDTHS
       Grid-based percentage system
       ======================================== */

    --col-line: 8%;
    --col-destination: 45%;
    --col-time: 15%;
    --col-countdown: 15%;
    --col-status: 17%;

    /* ========================================
       FLUID TYPOGRAPHY SYSTEM
       Using clamp() for proportional scaling
       ======================================== */

    /* Extra small text - labels, units, metadata */
    --font-size-xs: clamp(10px, 1.5vmin, 14px);

    /* Small text - status badges, footer text */
    --font-size-sm: clamp(12px, 2vmin, 18px);

    /* Medium text - table content, buttons */
    --font-size-md: clamp(14px, 2.5vmin, 22px);

    /* Large text - destinations, times */
    --font-size-lg: clamp(18px, 3vmin, 28px);

    /* Extra large text - station name, countdown */
    --font-size-xl: clamp(24px, 4vmin, 40px);

    /* Hero text - main header */
    --font-size-hero: clamp(32px, 5vmin, 76px);

    /* Display text - clock, major elements */
    --font-size-display: clamp(28px, 4.5vmin, 58px);

    /* ========================================
       FLUID SPACING SYSTEM
       Proportional padding, margins, gaps
       ======================================== */

    /* Extra small spacing - tight gaps */
    --spacing-xs: clamp(4px, 0.5vmin, 8px);

    /* Small spacing - compact elements */
    --spacing-sm: clamp(8px, 1vmin, 16px);

    /* Medium spacing - standard gaps */
    --spacing-md: clamp(12px, 1.5vmin, 24px);

    /* Large spacing - section padding */
    --spacing-lg: clamp(16px, 2vmin, 32px);

    /* Extra large spacing - major sections */
    --spacing-xl: clamp(24px, 3vmin, 48px);

    /* Double extra large spacing */
    --spacing-xxl: clamp(32px, 4vmin, 64px);

    /* Triple extra large spacing */
    --spacing-xxxl: clamp(48px, 6vmin, 96px);

    /* ========================================
       PROPORTIONAL ELEMENT SIZES
       Using aspect ratios and viewport units
       ======================================== */

    /* Logo sizes - proportional to header */
    --logo-size: clamp(40px, 8vh, 100px);

    /* Badge dimensions - consistent aspect ratios */
    --badge-min-width: clamp(60px, 8vmin, 90px);
    --badge-height: clamp(24px, 4vmin, 48px);

    /* Status badge dimensions */
    --status-badge-width: clamp(140px, 18vmin, 260px);

    /* Border radius - proportional to elements */
    --border-radius-sm: clamp(4px, 0.5vmin, 8px);
    --border-radius-md: clamp(6px, 0.8vmin, 12px);
    --border-radius-lg: clamp(10px, 1.2vmin, 20px);
    --border-radius-xl: clamp(14px, 1.6vmin, 24px);

    /* Icon sizes - proportional to context */
    --icon-size-sm: clamp(16px, 2vmin, 24px);
    --icon-size-md: clamp(24px, 3vmin, 36px);
    --icon-size-lg: clamp(36px, 4.5vmin, 52px);
    --icon-size-xl: clamp(60px, 8vmin, 120px);

    /* ========================================
       LEGACY COMPATIBILITY
       Original fixed values kept for fallback
       ======================================== */

    /* Brand Colors - Official FGC Palette */
    --fgc-green: #88BB0B;
    --fgc-green-dark: #6A9308;
    --fgc-green-light: #A0D813;
    --fgc-green-glow: rgba(136, 187, 11, 0.3);

    /* Status Colors - High Contrast for TV */
    --status-on-time: #00C853;
    --status-on-time-bg: #E8F5E9;
    --status-on-time-glow: rgba(0, 200, 83, 0.2);
    --status-delayed: #FF6D00;
    --status-delayed-bg: #FFF3E0;
    --status-delayed-glow: rgba(255, 109, 0, 0.2);
    --status-cancelled: #D32F2F;
    --status-cancelled-bg: #FFEBEE;
    --status-boarding: #FFB300;
    --status-boarding-bg: #FFF8E1;

    /* Neutral Colors - Premium Palette */
    --color-bg-primary: #F8F9FA;
    --color-bg-secondary: #FFFFFF;
    --color-bg-dark: #1A2027;
    --color-bg-card: #FFFFFF;
    --color-text-primary: #1A1A1A;
    --color-text-secondary: #424242;
    --color-text-light: #757575;
    --color-border: #E0E0E0;
    --color-border-light: #F0F0F0;
    --color-alert: #FFC107;
    --color-overlay: rgba(26, 32, 39, 0.05);

    /* Font Weights - Fixed values */
    --font-weight-light: 300;
    --font-weight-regular: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --font-weight-extrabold: 800;

    /* Shadows - Scale independent */

    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --shadow-xl: 0 12px 40px rgba(0,0,0,0.15);
    --shadow-glow: 0 0 20px var(--fgc-green-glow);

    /* Transitions */
    --transition-fast: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 600ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ============================================
   DARK MODE VARIABLES
   ============================================ */

body.dark-mode {
    /* Dark Mode Backgrounds */
    --color-bg-primary: #1a1a2e;
    --color-bg-secondary: #16213e;
    --color-bg-dark: #0f1419;
    --color-bg-card: #16213e;

    /* Dark Mode Text Colors */
    --color-text-primary: #ffffff;
    --color-text-secondary: #a0a0a0;
    --color-text-light: #808080;

    /* Dark Mode Borders */
    --color-border: #2a2a3e;
    --color-border-light: #222236;
    --color-overlay: rgba(255, 255, 255, 0.05);

    /* Dark Mode Shadows */
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
    --shadow-xl: 0 12px 40px rgba(0,0,0,0.6);

    /* Keep FGC green accent unchanged */
    --fgc-green: #88BB0B;

    /* Dark Mode Status Colors - Slightly adjusted for dark backgrounds */
    --status-on-time-bg: rgba(0, 200, 83, 0.15);
    --status-delayed-bg: rgba(255, 109, 0, 0.15);
    --status-cancelled-bg: rgba(211, 47, 47, 0.15);
    --status-boarding-bg: rgba(255, 179, 0, 0.15);
}

/* ============================================
   RESET & BASE STYLES
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: linear-gradient(135deg, var(--color-bg-primary) 0%, var(--color-bg-secondary) 100%);
    color: var(--color-text-primary);
    overflow-x: hidden;
    line-height: 1.4;
    min-height: 100vh;
    width: 100%;
    position: relative;
    transition: background var(--transition-base), color var(--transition-base);
}

/* Light Mode Gradient Override */
body:not(.dark-mode) {
    background: linear-gradient(135deg, #F8F9FA 0%, #E9ECEF 100%);
}

/* Background Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 50%, rgba(136, 187, 11, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(136, 187, 11, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
    transition: opacity var(--transition-base);
}

/* Dark Mode Background Pattern */
body.dark-mode::before {
    opacity: 0.5;
}

/* ============================================
   STATION HEADER - REDESIGNED (Clean & Modern)
   ============================================ */

.station-header {
    background: #1a7f37; /* Flat solid green */
    color: white;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 24px;
    padding: 12px 24px;
    min-height: 64px;
}

/* Logo */
.header-logo {
    flex-shrink: 0;
}

.fgc-logo {
    background: white;
    color: #1a7f37;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    letter-spacing: -0.5px;
}

.fgc-logo .logo-text {
    font-family: var(--font-primary);
}

/* Station Selector Wrapper (contains display + overlay select) */
.station-selector-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.station-selector-wrapper:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Visual display (station name + chevron) */
.station-selector-display {
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.station-selector-display .station-name {
    font-size: clamp(18px, 4vw, 28px);
    font-weight: 700;
    letter-spacing: -0.5px;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: white;
}

.station-selector-display .station-chevron {
    flex-shrink: 0;
    opacity: 0.8;
    color: white;
}

/* Overlay select - covers the wrapper but is transparent */
.station-select-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    font-size: 16px; /* Prevents iOS zoom */
}

/* Line badges next to station name */
.station-selector-wrapper .station-lines {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.station-selector-wrapper .line-badge,
.station-lines .line-badge {
    font-size: 12px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    line-height: 1.2;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    position: relative;
    z-index: 10;
}

.station-lines .line-badge:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Active filter state for line badges */
.station-lines .line-badge.active-filter {
    outline: 2px solid white;
    outline-offset: 2px;
    transform: scale(1.05);
}

.station-lines .line-badge:not(.active-filter) {
    opacity: 0.6;
}

/* When no filter is active, all badges are full opacity */
.station-lines:not(:has(.active-filter)) .line-badge {
    opacity: 1;
}

/* Header Controls (right side) */
.header-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Time Display */
.header-time {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-variant-numeric: tabular-nums;
}

.header-time .time-value {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.header-time .date-value {
    font-size: 13px;
    opacity: 0.8;
    text-transform: lowercase;
}

/* Language Selector (compact inline) */
.header-lang {
    display: flex;
    gap: 2px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 2px;
}

.header-lang .lang-btn {
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.header-lang .lang-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.header-lang .lang-btn.active {
    background: white;
    color: #1a7f37;
}

/* Menu Button */
.header-menu {
    position: relative;
}

.menu-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: background 0.15s ease;
}

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

.menu-btn:focus-visible {
    outline: 2px solid white;
    outline-offset: 2px;
}

/* ============================================================================
   MENU DROPDOWN - Improved UI with logical groupings
   ============================================================================ */
.menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 260px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.95);
    transform-origin: top right;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1001;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.header-menu.open .menu-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Group Labels */
.menu-group-label {
    padding: 8px 16px 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #9ca3af;
}

/* Base Menu Item */
.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    border-radius: 10px;
    color: #1f2937;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
}

.menu-item:hover {
    background: #f3f4f6;
    transform: translateX(2px);
}

.menu-item:active {
    transform: scale(0.98);
}

.menu-item svg {
    flex-shrink: 0;
    color: #6b7280;
    transition: color 0.15s ease;
}

.menu-item:hover svg {
    color: #374151;
}

/* Favorite Button - Primary Action */
.menu-item-favorite {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #fbbf24;
    margin-bottom: 4px;
}

.menu-item-favorite:hover {
    background: linear-gradient(135deg, #fde68a 0%, #fcd34d 100%);
    transform: translateX(2px);
}

.menu-item-favorite svg {
    color: #d97706;
}

.menu-item-favorite.is-favorite {
    background: linear-gradient(135deg, #fcd34d 0%, #f59e0b 100%);
}

.menu-item-favorite.is-favorite svg {
    fill: #d97706;
    color: #d97706;
}

/* Account/Login Item */
.menu-item-account {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    border: 1px solid #38bdf8;
}

.menu-item-account:hover {
    background: linear-gradient(135deg, #bae6fd 0%, #7dd3fc 100%);
}

.menu-item-account svg {
    color: #0284c7;
}

.menu-item-arrow {
    margin-left: auto;
    color: #9ca3af;
}

.menu-item-account:hover .menu-item-arrow {
    color: #0284c7;
    transform: translateX(2px);
}

/* Menu Divider */
.menu-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, #e5e7eb 20%, #e5e7eb 80%, transparent 100%);
    margin: 8px 12px;
}

/* Toggle Switch (for dark mode, notifications) */
.menu-toggle {
    justify-content: flex-start;
    cursor: default;
}

.menu-toggle:hover {
    background: #f9fafb;
    transform: none;
}

.toggle-switch {
    margin-left: auto;
    width: 44px;
    height: 24px;
    background: #d1d5db;
    border: none;
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.toggle-switch:hover {
    background: #9ca3af;
}

.toggle-switch[aria-pressed="true"] {
    background: var(--fgc-green, #1a7f37);
}

.toggle-switch[aria-pressed="true"]:hover {
    background: var(--fgc-green-dark, #166534);
}

.toggle-switch .toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-switch[aria-pressed="true"] .toggle-thumb {
    transform: translateX(20px);
}

/* Station Picker Modal */
.station-picker-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 80px;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.station-picker-modal.open {
    opacity: 1;
    visibility: visible;
}

.station-picker {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    max-height: 70vh;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    transform: translateY(-16px) scale(0.95);
    transition: transform 0.2s ease;
}

.station-picker-modal.open .station-picker {
    transform: translateY(0) scale(1);
}

.station-picker-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
}

.station-picker-search {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
    outline: none;
}

.station-picker-search:focus {
    border-color: #1a7f37;
    box-shadow: 0 0 0 3px rgba(26, 127, 55, 0.1);
}

.station-picker-list {
    max-height: calc(70vh - 80px);
    overflow-y: auto;
    padding: 8px;
}

.station-picker-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    border-radius: 8px;
    text-align: left;
    cursor: pointer;
    transition: background 0.1s ease;
}

.station-picker-item:hover {
    background: #f3f4f6;
}

.station-picker-item.selected {
    background: #ecfdf5;
}

.station-picker-item .station-name {
    font-weight: 500;
    color: #1f2937;
}

.station-picker-item .station-lines {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

/* Dark mode support for menu */
[data-theme="dark"] .menu-dropdown {
    background: #1f2937;
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .menu-group-label {
    color: #6b7280;
}

[data-theme="dark"] .menu-item {
    color: #f3f4f6;
}

[data-theme="dark"] .menu-item:hover {
    background: #374151;
}

[data-theme="dark"] .menu-item svg {
    color: #9ca3af;
}

[data-theme="dark"] .menu-item:hover svg {
    color: #d1d5db;
}

[data-theme="dark"] .menu-divider {
    background: linear-gradient(90deg, transparent 0%, #374151 20%, #374151 80%, transparent 100%);
}

[data-theme="dark"] .menu-item-favorite {
    background: linear-gradient(135deg, #422006 0%, #713f12 100%);
    border-color: #a16207;
}

[data-theme="dark"] .menu-item-favorite:hover {
    background: linear-gradient(135deg, #713f12 0%, #a16207 100%);
}

[data-theme="dark"] .menu-item-favorite svg {
    color: #fbbf24;
}

[data-theme="dark"] .menu-item-account {
    background: linear-gradient(135deg, #0c4a6e 0%, #075985 100%);
    border-color: #0284c7;
}

[data-theme="dark"] .menu-item-account:hover {
    background: linear-gradient(135deg, #075985 0%, #0369a1 100%);
}

[data-theme="dark"] .menu-item-account svg {
    color: #38bdf8;
}

[data-theme="dark"] .toggle-switch {
    background: #4b5563;
}

[data-theme="dark"] .toggle-switch:hover {
    background: #6b7280;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .header-content {
        grid-template-columns: auto 1fr auto;
        gap: 12px;
        padding: 8px 16px;
        min-height: 56px;
    }

    .fgc-logo {
        width: 40px;
        height: 40px;
        font-size: 12px;
    }

    .station-selector-btn .station-name {
        font-size: 16px;
    }

    .header-time {
        display: none;
    }

    .header-lang {
        display: none;
    }

    .menu-btn {
        width: 40px;
        height: 40px;
    }
}

.header-dropdown.open .header-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Dropdown Items */
.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    border: none;
    background: transparent;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
    color: var(--color-text-primary);
    font-size: var(--font-size-md);
    text-align: left;
}

.dropdown-item:hover {
    background: var(--color-background-secondary);
}

.dropdown-item:active {
    background: var(--color-border-light);
}

.dropdown-item-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.dropdown-item-text {
    flex: 1;
    font-weight: var(--font-weight-medium);
}

/* Dropdown Divider */
.dropdown-divider {
    height: 1px;
    background: var(--color-border-light);
    margin: var(--spacing-xs) 0;
}

/* Dark Mode Toggle Switch in Dropdown */
.dark-mode-item {
    cursor: default;
}

.dark-mode-toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--color-border);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    margin-left: auto;
}

.dark-mode-toggle-switch .toggle-track {
    position: absolute;
    inset: 0;
    border-radius: 12px;
    transition: background 0.2s ease;
}

.dark-mode-toggle-switch .toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
}

.dark-mode-toggle-switch[aria-pressed="true"] {
    background: var(--fgc-green);
}

.dark-mode-toggle-switch[aria-pressed="true"] .toggle-thumb {
    transform: translateX(20px);
}

/* Language Selector in Dropdown */
.language-item {
    cursor: default;
    padding-bottom: var(--spacing-xs);
}

.dropdown-language-selector {
    display: flex;
    gap: 4px;
    padding: 0 var(--spacing-md) var(--spacing-sm);
}

.dropdown-language-selector .lang-btn {
    flex: 1;
    padding: var(--spacing-xs) var(--spacing-sm);
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    background: transparent;
    color: var(--color-text-secondary);
    font-size: var(--font-size-small);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    transition: all 0.15s ease;
}

.dropdown-language-selector .lang-btn:hover {
    border-color: var(--fgc-green);
    color: var(--fgc-green);
}

.dropdown-language-selector .lang-btn.active {
    background: var(--fgc-green);
    border-color: var(--fgc-green);
    color: white;
}

/* Dark mode styles for dropdowns */
[data-theme="dark"] .header-dropdown-menu {
    background: var(--color-background-secondary);
    border: 1px solid var(--color-border);
}

[data-theme="dark"] .dropdown-item:hover {
    background: var(--color-background-tertiary);
}

[data-theme="dark"] .dropdown-language-selector .lang-btn {
    border-color: var(--color-border);
    color: var(--color-text-secondary);
}

[data-theme="dark"] .dropdown-language-selector .lang-btn:hover {
    border-color: var(--fgc-green);
    color: var(--fgc-green);
}

/* Mobile responsive dropdown */
@media (max-width: 768px) {
    .header-dropdown-menu {
        min-width: 180px;
    }

    .header-dropdown-btn {
        padding: var(--spacing-xs) var(--spacing-sm);
        min-height: 36px;
    }

    .header-dropdown-btn .icon {
        font-size: 16px;
    }
}

.fgc-logo {
    background: white;
    width: var(--logo-size);
    height: var(--logo-size);
    aspect-ratio: 1 / 1;
    border-radius: var(--border-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg), 0 0 30px rgba(255,255,255,0.3);
    transition: transform var(--transition-base);
    flex-shrink: 0;
}

.fgc-logo:hover {
    transform: scale(1.05) rotate(2deg);
}

.logo-square {
    font-size: clamp(14px, 2.5vmin, 36px);
    font-weight: var(--font-weight-extrabold);
    color: var(--fgc-green);
    letter-spacing: clamp(1px, 0.2vmin, 2px);
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.station-details {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    overflow: visible; /* Don't clip station name */
    flex: 1 1 auto;
    min-width: 0;
}

/* Line Filter Badges */
.line-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.line-filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: clamp(9px, 1vw, 12px);
    font-weight: 700;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1.5px solid transparent;
    text-transform: uppercase;
    min-width: 28px;
    user-select: none;
}

/* Active state - full color */
.line-filter-badge.active {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Inactive state - dimmed */
.line-filter-badge:not(.active) {
    opacity: 0.4;
    transform: scale(0.9);
    filter: grayscale(50%);
}

.line-filter-badge:hover {
    opacity: 1;
    transform: scale(1.05);
    filter: none;
}

/* OFFICIAL FGC Line Colors - Same as table .line-badge */
/* Barcelona-Vallès Lines */
.line-filter-badge[data-line="L6"] { background: linear-gradient(135deg, #847DC6 0%, #6A64A0 100%); color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.line-filter-badge[data-line="L7"] { background: linear-gradient(135deg, #AE6118 0%, #8B4E13 100%); color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.line-filter-badge[data-line="L12"] { background: linear-gradient(135deg, #B6B3E1 0%, #9290B4 100%); color: #1a1a1a; text-shadow: 0 1px 2px rgba(255,255,255,0.3); }
.line-filter-badge[data-line="S1"] { background: linear-gradient(135deg, #F47216 0%, #C35B12 100%); color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.line-filter-badge[data-line="S2"] { background: linear-gradient(135deg, #59C134 0%, #479A2A 100%); color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.line-filter-badge[data-line="S5"] { background: linear-gradient(135deg, #4F99D9 0%, #3F7AAD 100%); color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.line-filter-badge[data-line="S6"] { background: linear-gradient(135deg, #E40143 0%, #B60136 100%); color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.line-filter-badge[data-line="S7"] { background: linear-gradient(135deg, #A22140 0%, #821A33 100%); color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
/* Llobregat-Anoia Lines */
.line-filter-badge[data-line="L8"] { background: linear-gradient(135deg, #E659B4 0%, #B84790 100%); color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.line-filter-badge[data-line="S3"] { background: linear-gradient(135deg, #E659B4 0%, #B84790 100%); color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.line-filter-badge[data-line="S4"] { background: linear-gradient(135deg, #8E7F21 0%, #71661A 100%); color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.line-filter-badge[data-line="S8"] { background: linear-gradient(135deg, #4DC4DB 0%, #3E9DAF 100%); color: #1a1a1a; text-shadow: 0 1px 2px rgba(255,255,255,0.3); }
.line-filter-badge[data-line="S9"] { background: linear-gradient(135deg, #4DC4DB 0%, #3E9DAF 100%); color: #1a1a1a; text-shadow: 0 1px 2px rgba(255,255,255,0.3); }
.line-filter-badge[data-line="R5"] { background: linear-gradient(135deg, #4FC4BB 0%, #3F9D96 100%); color: #1a1a1a; text-shadow: 0 1px 2px rgba(255,255,255,0.3); }
.line-filter-badge[data-line="R50"] { background: linear-gradient(135deg, #007D9B 0%, #00647C 100%); color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.line-filter-badge[data-line="R6"] { background: linear-gradient(135deg, #9EA1A6 0%, #7E8185 100%); color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.line-filter-badge[data-line="R60"] { background: linear-gradient(135deg, #585A63 0%, #46484F 100%); color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.line-filter-badge[data-line="R63"] { background: linear-gradient(135deg, #585A63 0%, #46484F 100%); color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.line-filter-badge[data-line="R53"] { background: linear-gradient(135deg, #4FC4BB 0%, #3F9D96 100%); color: #1a1a1a; text-shadow: 0 1px 2px rgba(255,255,255,0.3); }
/* Lleida Lines */
.line-filter-badge[data-line="RL1"] { background: linear-gradient(135deg, #6B8E23 0%, #56721C 100%); color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.line-filter-badge[data-line="RL2"] { background: linear-gradient(135deg, #32CD32 0%, #28A428 100%); color: #1a1a1a; text-shadow: 0 1px 2px rgba(255,255,255,0.3); }

/* Default color for unknown lines */
.line-filter-badge { background: linear-gradient(135deg, #666 0%, #444 100%); color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }

/* ============================================================================
   OFFICIAL FGC LINE COLORS - Updated to match official FGC branding
   ============================================================================ */

/* Barcelona-Vallès Lines */
.line-badge[data-line="L6"],
.line-badge.line-l6 { background: linear-gradient(135deg, #847DC6 0%, #6A64A0 100%); color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }

.line-badge[data-line="L7"],
.line-badge.line-l7 { background: linear-gradient(135deg, #AE6118 0%, #8B4E13 100%); color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }

.line-badge[data-line="L12"],
.line-badge.line-l12 { background: linear-gradient(135deg, #B6B3E1 0%, #9290B4 100%); color: #1a1a1a; text-shadow: 0 1px 2px rgba(255,255,255,0.3); }

.line-badge[data-line="S1"],
.line-badge.line-s1 { background: linear-gradient(135deg, #F47216 0%, #C35B12 100%); color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }

.line-badge[data-line="S2"],
.line-badge.line-s2 { background: linear-gradient(135deg, #59C134 0%, #479A2A 100%); color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }

.line-badge[data-line="S5"],
.line-badge.line-s5 { background: linear-gradient(135deg, #4F99D9 0%, #3F7AAD 100%); color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }

.line-badge[data-line="S6"],
.line-badge.line-s6 { background: linear-gradient(135deg, #E40143 0%, #B60136 100%); color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }

.line-badge[data-line="S7"],
.line-badge.line-s7 { background: linear-gradient(135deg, #A22140 0%, #821A33 100%); color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }

/* Llobregat-Anoia Lines */
.line-badge[data-line="L8"],
.line-badge.line-l8 { background: linear-gradient(135deg, #E659B4 0%, #B84790 100%); color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }

.line-badge[data-line="S3"],
.line-badge.line-s3 { background: linear-gradient(135deg, #E659B4 0%, #B84790 100%); color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }

.line-badge[data-line="S4"],
.line-badge.line-s4 { background: linear-gradient(135deg, #8E7F21 0%, #71661A 100%); color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }

.line-badge[data-line="S8"],
.line-badge.line-s8 { background: linear-gradient(135deg, #4DC4DB 0%, #3E9DAF 100%); color: #1a1a1a; text-shadow: 0 1px 2px rgba(255,255,255,0.3); }

.line-badge[data-line="S9"],
.line-badge.line-s9 { background: linear-gradient(135deg, #4DC4DB 0%, #3E9DAF 100%); color: #1a1a1a; text-shadow: 0 1px 2px rgba(255,255,255,0.3); }

.line-badge[data-line="R5"],
.line-badge.line-r5 { background: linear-gradient(135deg, #4FC4BB 0%, #3F9D96 100%); color: #1a1a1a; text-shadow: 0 1px 2px rgba(255,255,255,0.3); }

.line-badge[data-line="R50"],
.line-badge.line-r50 { background: linear-gradient(135deg, #007D9B 0%, #00647C 100%); color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }

.line-badge[data-line="R6"],
.line-badge.line-r6 { background: linear-gradient(135deg, #9EA1A6 0%, #7E8185 100%); color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }

.line-badge[data-line="R60"],
.line-badge.line-r60 { background: linear-gradient(135deg, #585A63 0%, #46484F 100%); color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }

.line-badge[data-line="R53"],
.line-badge.line-r53 { background: linear-gradient(135deg, #4FC4BB 0%, #3F9D96 100%); color: #1a1a1a; text-shadow: 0 1px 2px rgba(255,255,255,0.3); }

.line-badge[data-line="R63"],
.line-badge.line-r63 { background: linear-gradient(135deg, #585A63 0%, #46484F 100%); color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }

/* Lleida Lines */
.line-badge[data-line="RL1"],
.line-badge.line-rl1 { background: linear-gradient(135deg, #6B8E23 0%, #56721C 100%); color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }

.line-badge[data-line="RL2"],
.line-badge.line-rl2 { background: linear-gradient(135deg, #32CD32 0%, #28A428 100%); color: #1a1a1a; text-shadow: 0 1px 2px rgba(255,255,255,0.3); }

.station-name {
    /* SMALL FIXED SIZE - ensures ALL station names fit without cropping */
    font-size: clamp(11px, 1.5vw, 24px);
    font-weight: var(--font-weight-extrabold);
    letter-spacing: 0;
    text-transform: uppercase;
    line-height: 1.2;
    text-shadow:
        0 1px 2px rgba(0,0,0,0.2);
    animation: fadeInDown var(--transition-slow) ease-out;

    /* Full name always visible */
    white-space: nowrap;
    overflow: visible;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.station-line {
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    opacity: 0.95;
    text-transform: uppercase;
    letter-spacing: clamp(1px, 0.3vmin, 3px);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.station-line::before {
    content: '';
    width: clamp(6px, 0.8vmin, 8px);
    height: clamp(6px, 0.8vmin, 8px);
    aspect-ratio: 1 / 1;
    background: var(--fgc-green-light);
    border-radius: 50%;
    box-shadow: 0 0 12px var(--fgc-green-light);
    animation: pulse 2s ease-in-out infinite;
}

.current-time {
    text-align: right;
    position: relative;
    z-index: 1;
}

/* Header clock - FGC corporate style */
#currentTime {
    font-family: 'Roboto Mono', 'Montserrat', monospace;
    font-size: var(--font-size-display);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: clamp(1px, 0.3vmin, 3px);
    line-height: 1;
    color: white !important;
    text-shadow:
        0 2px 4px rgba(0,0,0,0.2);
    animation: fadeInDown var(--transition-slow) 0.2s ease-out;
}

#currentDate {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-regular);
    margin-top: var(--spacing-sm);
    color: white !important;
    opacity: 0.9;
    text-transform: capitalize;
    letter-spacing: clamp(0.5px, 0.1vmin, 1px);
}

/* ============================================
   LANGUAGE SELECTOR
   ============================================ */

.language-selector {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    position: relative;
    z-index: 1;
}

.language-selector button {
    background: none;
    border: none;
    color: white;
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    letter-spacing: clamp(1px, 0.2vmin, 2px);
    text-transform: uppercase;
    cursor: pointer;
    padding: var(--spacing-sm) var(--spacing-md);
    position: relative;
    opacity: 0.7;
    transition: all var(--transition-base);
    min-width: clamp(38px, 5vmin, 44px);
    min-height: clamp(38px, 5vmin, 44px);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-sm);
}

/* Hover state */
.language-selector button:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.1);
}

/* Active language styling */
.language-selector button.active {
    opacity: 1;
    font-weight: var(--font-weight-bold);
    color: white;
}

/* Active underline indicator */
.language-selector button.active::after {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 70%;
    height: 4px;
    background: var(--fgc-green-light);
    border-radius: 2px;
    box-shadow: 0 0 12px var(--fgc-green-light), 0 2px 6px rgba(0, 0, 0, 0.2);
    animation: slideInUnderline var(--transition-base) ease-out;
}

@keyframes slideInUnderline {
    from {
        width: 0;
        opacity: 0;
    }
    to {
        width: 70%;
        opacity: 1;
    }
}

/* Focus state for accessibility */
.language-selector button:focus-visible {
    outline: 3px solid white;
    outline-offset: 4px;
    opacity: 1;
    background: rgba(255, 255, 255, 0.15);
}

/* Separator between language buttons */
.language-selector button:not(:last-child)::before {
    content: '';
    position: absolute;
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 20px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 1px;
}

/* Active state removes separator opacity */
.language-selector button.active + button::before {
    opacity: 0.5;
}

/* Language button pressed state */
.language-selector button:active {
    transform: translateY(0);
    opacity: 0.85;
}

/* Responsive adjustments for language selector */
@media (max-width: 1365px) {
    .language-selector {
        gap: var(--spacing-sm);
    }

    .language-selector button {
        font-size: var(--font-size-small);
        padding: var(--spacing-xs) var(--spacing-sm);
    }
}

@media (max-width: 1023px) {
    .language-selector {
        gap: var(--spacing-xs);
    }

    .language-selector button {
        font-size: var(--font-size-xsmall);
        min-width: 40px;
        min-height: 40px;
    }
}

@media (max-width: 767px) {
    .language-selector {
        flex-direction: row;
        gap: 4px;
        margin-top: var(--spacing-xs);
    }

    .language-selector button {
        font-size: 14px;
        padding: 6px 10px;
        min-width: 38px;
        min-height: 38px;
        letter-spacing: 1px;
    }

    .language-selector button.active::after {
        bottom: 3px;
        height: 3px;
    }

    .language-selector button:not(:last-child)::before {
        right: -2px;
        height: 14px;
        width: 1px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .language-selector button {
        border: 2px solid transparent;
    }

    .language-selector button.active {
        border-color: white;
        background: rgba(255, 255, 255, 0.2);
    }

    .language-selector button.active::after {
        height: 6px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .language-selector button {
        transition: opacity 0.01ms;
    }

    .language-selector button:hover {
        transform: none;
    }

    .language-selector button.active::after {
        animation: none;
    }
}

/* ============================================
   SERVICE ALERTS BANNER
   ============================================ */

.alerts-banner {
    background: linear-gradient(135deg, var(--color-alert) 0%, #FFB300 100%);
    color: var(--color-text-primary);
    min-height: var(--alert-height);
    display: flex;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-xl);
    box-shadow: var(--shadow-md);
    animation: slideDown var(--transition-slow);
    border-left: 6px solid #F57C00;
    position: relative;
    overflow: hidden;
}

.alerts-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.alert-icon {
    font-size: var(--icon-size-lg);
    margin-right: var(--spacing-lg);
    animation: pulse 2s ease-in-out infinite;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

.alert-message {
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    flex: 1;
    line-height: 1.4;
}

/* ============================================
   ROUTE MAP VISUALIZATION
   ============================================ */

.route-map-container {
    background: var(--color-bg-card);
    border-bottom: 2px solid var(--color-border-light);
    box-shadow: var(--shadow-sm);
    position: relative;
    z-index: 999;
    overflow: hidden;
    transition: all var(--transition-base);
}

.route-map-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(8px, 1vmin, 16px);
    padding: clamp(12px, 2vmin, 20px);
    background: linear-gradient(135deg, var(--fgc-green) 0%, var(--fgc-green-dark) 100%);
    border: none;
    color: white;
    font-family: 'Montserrat', sans-serif;
    font-size: clamp(13px, 2vmin, 18px);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: clamp(0.5px, 0.1vmin, 1px);
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
}

.route-map-toggle:hover {
    background: linear-gradient(135deg, var(--fgc-green-light) 0%, var(--fgc-green) 100%);
    box-shadow: var(--shadow-md);
}

.route-map-toggle:active {
    transform: scale(0.98);
}

.route-map-toggle .toggle-icon {
    width: clamp(18px, 2.5vmin, 24px);
    height: clamp(18px, 2.5vmin, 24px);
    transition: transform var(--transition-base);
}

.route-map-toggle .toggle-arrow {
    width: clamp(14px, 2vmin, 18px);
    height: clamp(14px, 2vmin, 18px);
    transition: transform var(--transition-base);
}

.route-map-toggle[aria-expanded="true"] .toggle-arrow {
    transform: rotate(180deg);
}

.route-map-toggle[aria-expanded="true"] .toggle-icon {
    transform: scale(1.1);
}

.route-map-content {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height var(--transition-slow), opacity var(--transition-base), padding var(--transition-base);
    padding: 0 clamp(16px, 2vmin, 32px);
}

.route-map-content[aria-hidden="false"] {
    max-height: 300px;
    opacity: 1;
    padding: clamp(20px, 3vmin, 40px) clamp(16px, 2vmin, 32px);
}

.route-map {
    width: 100%;
    height: auto;
    display: block;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.1));
}

/* Line paths */
.line-path {
    transition: stroke-width var(--transition-base), opacity var(--transition-base);
}

.line-path:hover {
    stroke-width: 8;
    opacity: 1;
}

/* Station markers */
.station-marker {
    cursor: pointer;
    transition: all var(--transition-base);
}

.station-marker:hover {
    transform: scale(1.1);
}

.station-marker:hover circle:first-child {
    filter: drop-shadow(0 0 8px var(--fgc-green));
}

.station-marker circle:first-child {
    transition: all var(--transition-base);
}

/* Active station highlighting */
.station-marker.active circle:first-child {
    fill: var(--fgc-green);
    stroke: var(--fgc-green-dark);
    stroke-width: 5;
    filter: drop-shadow(0 0 12px var(--fgc-green));
}

.station-marker.active .station-pulse {
    opacity: 1;
    animation: pulse-ring 2s ease-out infinite;
}

@keyframes pulse-ring {
    0% {
        r: 12;
        opacity: 1;
    }
    100% {
        r: 24;
        opacity: 0;
    }
}

/* Station labels */
.station-label {
    font-family: 'Montserrat', sans-serif;
    font-size: clamp(10px, 1.5vmin, 14px);
    font-weight: 600;
    fill: var(--color-text-primary);
    pointer-events: none;
    transition: fill var(--transition-base);
}

.station-line-label {
    font-family: 'Roboto Mono', monospace;
    font-size: clamp(8px, 1.2vmin, 11px);
    font-weight: 700;
    fill: var(--fgc-green);
    opacity: 0.9;
    pointer-events: none;
}

/* Legend */
.route-legend {
    opacity: 0.85;
}

.legend-text {
    font-family: 'Montserrat', sans-serif;
    font-size: clamp(8px, 1.2vmin, 12px);
    font-weight: 500;
    fill: var(--color-text-secondary);
}

/* Dark mode adjustments */
body.dark-mode .route-map-container {
    background: var(--color-bg-card);
    border-bottom: 2px solid var(--color-border);
}

body.dark-mode .station-marker circle:first-child {
    fill: var(--color-bg-card);
}

body.dark-mode .station-marker.active circle:first-child {
    fill: var(--fgc-green);
}

body.dark-mode .station-label {
    fill: var(--color-text-primary);
}

body.dark-mode .legend-text {
    fill: var(--color-text-secondary);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .route-map-content[aria-hidden="false"] {
        max-height: 250px;
        padding: clamp(16px, 2vmin, 24px) clamp(12px, 1.5vmin, 20px);
    }

    .route-map-toggle {
        padding: clamp(14px, 2.5vmin, 18px);
        font-size: clamp(12px, 2vmin, 15px);
    }

    .station-label {
        font-size: clamp(9px, 1.3vmin, 12px);
    }

    .legend-text {
        font-size: clamp(7px, 1vmin, 10px);
    }
}

@media (max-width: 480px) {
    .route-map-content[aria-hidden="false"] {
        max-height: 220px;
    }

    .route-map {
        margin: 0 -8px;
    }

    /* Hide some labels on very small screens */
    .station-line-label {
        display: none;
    }
}

/* ============================================
   ARRIVALS BOARD
   ============================================ */

.arrivals-container {
    max-width: var(--max-width);
    margin: var(--spacing-xl) auto;
    padding: 0 var(--spacing-xl);
    min-height: calc(100vh - var(--header-height) - var(--footer-height) - 100px);
    position: relative;
    z-index: 1;
}

.board-header {
    display: grid;
    grid-template-columns: var(--col-line) var(--col-time) var(--col-countdown) var(--col-destination) var(--col-status);
    gap: var(--spacing-md);
    padding: var(--spacing-lg) var(--spacing-xl);
    background: linear-gradient(135deg, var(--color-bg-dark) 0%, #263238 100%);
    color: white;
    border-radius: var(--border-radius-xl) var(--border-radius-xl) 0 0;
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-bold);
    text-transform: uppercase;
    letter-spacing: clamp(1px, 0.2vmin, 2px);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.board-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg,
        var(--fgc-green) 0%,
        var(--fgc-green-light) 50%,
        var(--fgc-green) 100%);
}

.arrivals-list {
    background: var(--color-bg-card);
    border-radius: 0 0 var(--border-radius-xl) var(--border-radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    backdrop-filter: blur(10px);
}

/* ============================================
   ARRIVAL ITEMS
   ============================================ */

.arrival-item {
    display: grid;
    grid-template-columns: var(--col-line) var(--col-time) var(--col-countdown) var(--col-destination) var(--col-status);
    gap: var(--spacing-md);
    padding: var(--spacing-xl);
    border-bottom: 2px solid var(--color-border-light);
    align-items: center;
    transition: all var(--transition-base);
    min-height: var(--arrival-row-height);
    position: relative;
    background: var(--color-bg-secondary);
}

.arrival-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    transition: all var(--transition-base);
}

.arrival-item:last-child {
    border-bottom: none;
}

.arrival-item:hover {
    background: linear-gradient(90deg, var(--color-overlay) 0%, transparent 100%);
    transform: translateX(8px);
}

/* Alternating row styling for better readability */
.arrival-item:nth-child(even) {
    background: linear-gradient(90deg,
        rgba(248, 249, 250, 0.5) 0%,
        transparent 100%);
}

/* Animate new arrivals */
.arrival-item.new-item {
    animation: slideInRight var(--transition-slow);
}

@keyframes slideInRight {
    from {
        transform: translateX(-30px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Status-based styling */
.arrival-item.status-on-time::before {
    background: linear-gradient(180deg, var(--status-on-time) 0%, #00E676 100%);
    box-shadow: 0 0 20px var(--status-on-time-glow);
}

.arrival-item.status-delayed::before {
    background: linear-gradient(180deg, var(--status-delayed) 0%, #FF9100 100%);
    box-shadow: 0 0 20px var(--status-delayed-glow);
}

.arrival-item.status-cancelled::before {
    background: linear-gradient(180deg, var(--status-cancelled) 0%, #E57373 100%);
    opacity: 0.7;
}

.arrival-item.status-boarding::before {
    background: linear-gradient(180deg, var(--status-boarding) 0%, #FFD54F 100%);
    animation: pulse 1.5s ease-in-out infinite;
}

/* ============================================
   COLUMN STYLES
   ============================================ */

.col-line {
    display: flex;
    align-items: center;
    justify-content: center;
}

.line-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--fgc-green) 0%, var(--fgc-green-dark) 100%);
    color: white;
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-extrabold);
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--border-radius-lg);
    min-width: var(--badge-min-width);
    aspect-ratio: 2 / 1;
    text-align: center;
    box-shadow: var(--shadow-md), var(--shadow-glow);
    letter-spacing: clamp(1px, 0.2vmin, 2px);
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.line-badge::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left var(--transition-slow);
}

.line-badge:hover::before {
    left: 100%;
}

.col-time {
    display: flex;
    align-items: center;
    justify-content: center;
}

.scheduled-time {
    font-family: 'Roboto Mono', 'Courier New', monospace;
    font-size: var(--font-size-lg);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: var(--color-text-primary);
    letter-spacing: clamp(0.5px, 0.1vmin, 1px);
}

.cancelled-time {
    text-decoration: line-through;
    opacity: 0.4;
    color: var(--color-text-light);
}

.col-countdown {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: var(--spacing-xs);
}

.countdown-value {
    font-family: 'Montserrat', 'Helvetica Neue', sans-serif;
    font-size: var(--font-size-lg);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--fgc-green);
    letter-spacing: clamp(0.5px, 0.1vmin, 1px);
    text-shadow: 0 2px 8px var(--fgc-green-glow);
    transition: all var(--transition-base);
}

.countdown-unit {
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-secondary);
}

.cancelled-countdown {
    color: var(--color-text-light);
    opacity: 0.4;
}

/* Countdown urgency styling */
.countdown-urgent {
    color: var(--status-delayed) !important;
    animation: urgentPulse 1.5s ease-in-out infinite;
    text-shadow: 0 2px 12px var(--status-delayed-glow) !important;
}

@keyframes urgentPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.08);
        opacity: 0.9;
    }
}

/* "Now" indicator */
.countdown-now {
    color: var(--status-boarding) !important;
    animation: boarding 1s ease-in-out infinite;
    font-weight: var(--font-weight-extrabold);
}

@keyframes boarding {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.15);
    }
}

.col-destination {
    display: flex;
    align-items: center;
    padding-left: var(--spacing-md);
}

.destination-name {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
    line-height: 1.3;
    letter-spacing: clamp(0.3px, 0.05vmin, 0.5px);
}

.cancelled-destination {
    text-decoration: line-through;
    opacity: 0.4;
    color: var(--color-text-light);
}

.col-status {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--border-radius-md);
    text-transform: uppercase;
    letter-spacing: clamp(0.5px, 0.1vmin, 1px);
    min-width: var(--status-badge-width);
    text-align: center;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
}

.status-on-time-badge {
    background: var(--status-on-time-bg);
    color: var(--status-on-time);
    border: 3px solid var(--status-on-time);
}

.status-delayed-badge {
    background: var(--status-delayed-bg);
    color: var(--status-delayed);
    border: 3px solid var(--status-delayed);
}

.status-cancelled-badge {
    background: var(--status-cancelled-bg);
    color: var(--status-cancelled);
    border: 3px solid var(--status-cancelled);
    opacity: 0.8;
}

.status-boarding-badge {
    background: var(--status-boarding-bg);
    color: var(--status-boarding);
    border: 3px solid var(--status-boarding);
    animation: pulse 1.5s ease-in-out infinite;
}

/* ============================================
   EMPTY STATE
   ============================================ */

.empty-state {
    background: var(--color-bg-card);
    border-radius: 0 0 var(--border-radius-xl) var(--border-radius-xl);
    padding: var(--spacing-xxxl);
    text-align: center;
    box-shadow: var(--shadow-xl);
}

.empty-icon {
    font-size: var(--icon-size-xl);
    margin-bottom: var(--spacing-lg);
    opacity: 0.3;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(clamp(-10px, -2vmin, -20px));
    }
}

.empty-message {
    font-size: var(--font-size-lg);
    color: var(--color-text-secondary);
    font-weight: var(--font-weight-medium);
}

/* ============================================
   FOOTER
   ============================================ */

.station-footer {
    background: linear-gradient(135deg, var(--color-bg-dark) 0%, #263238 100%);
    color: white;
    min-height: var(--footer-height);
    margin-top: var(--spacing-xxl);
    box-shadow: var(--shadow-xl);
    border-top: 4px solid var(--fgc-green);
    position: relative;
}

.station-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg,
        var(--fgc-green) 0%,
        var(--fgc-green-light) 50%,
        var(--fgc-green) 100%);
}

.footer-content {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg) var(--spacing-xl);
}

.footer-info,
.footer-refresh {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    font-size: var(--font-size-sm);
}

.info-icon,
.refresh-icon {
    font-size: var(--icon-size-md);
    opacity: 0.9;
}

.refresh-icon {
    animation: rotate 3s linear infinite;
}

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

.info-text,
.refresh-text {
    font-weight: var(--font-weight-regular);
    opacity: 0.95;
}

.info-text strong {
    font-weight: var(--font-weight-bold);
    color: var(--fgc-green-light);
}

/* ============================================
   LOADING STATE
   ============================================ */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(248, 249, 250, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(10px);
}

.loading-spinner {
    width: clamp(30px, 4vmin, 40px);
    height: clamp(30px, 4vmin, 40px);
    aspect-ratio: 1 / 1;
    border: clamp(3px, 0.4vmin, 4px) solid var(--color-border);
    border-top-color: var(--fgc-green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    margin-top: var(--spacing-lg);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
}

/* ============================================
   SKELETON LOADING SCREENS
   ============================================ */

/* Skeleton shimmer animation */
@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Base skeleton element */
.skeleton {
    background: #d0d0d0;
    background-image: linear-gradient(90deg, #d0d0d0 25%, #e8e8e8 50%, #d0d0d0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite;
    border-radius: var(--border-radius-md);
    min-height: 20px;
}

/* Skeleton loading container */
.skeleton-loading {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--spacing-xl);
}

/* Skeleton departure card wrapper */
.skeleton-card {
    background: var(--color-bg-card);
    border-radius: var(--border-radius-xl);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
    box-shadow: var(--shadow-md);
    display: grid;
    grid-template-columns: var(--col-line) var(--col-destination) var(--col-time) var(--col-countdown) var(--col-status);
    gap: var(--spacing-md);
    align-items: center;
    min-height: var(--arrival-row-height);
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stagger animation for skeleton cards */
.skeleton-card:nth-child(1) { animation-delay: 0s; }
.skeleton-card:nth-child(2) { animation-delay: 0.1s; }
.skeleton-card:nth-child(3) { animation-delay: 0.2s; }
.skeleton-card:nth-child(4) { animation-delay: 0.3s; }
.skeleton-card:nth-child(5) { animation-delay: 0.4s; }

/* Skeleton line badge */
.skeleton-line-badge {
    width: clamp(50px, 7vmin, 70px);
    height: var(--badge-height);
    border-radius: var(--border-radius-md);
}

/* Skeleton destination */
.skeleton-destination {
    width: 85%;
    height: clamp(20px, 3vmin, 28px);
    border-radius: var(--border-radius-sm);
}

/* Skeleton time */
.skeleton-time {
    width: 75%;
    height: clamp(18px, 2.8vmin, 26px);
    border-radius: var(--border-radius-sm);
}

/* Skeleton countdown */
.skeleton-countdown {
    width: 80%;
    height: clamp(18px, 2.8vmin, 26px);
    border-radius: var(--border-radius-sm);
}

/* Skeleton status badge */
.skeleton-status {
    width: var(--status-badge-width);
    height: var(--badge-height);
    border-radius: var(--border-radius-lg);
}

/* Skeleton header elements */
.skeleton-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.skeleton-station-name {
    width: clamp(150px, 25vw, 300px);
    height: clamp(24px, 4vmin, 40px);
    border-radius: var(--border-radius-md);
}

.skeleton-line-filter {
    display: flex;
    gap: var(--spacing-xs);
}

.skeleton-line-filter-badge {
    width: clamp(40px, 6vmin, 60px);
    height: clamp(20px, 3vmin, 32px);
    border-radius: var(--border-radius-sm);
}

/* Mobile responsive adjustments */
@media (max-width: 767px) {
    .skeleton-card {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
        padding: var(--spacing-md);
        min-height: auto;
    }

    .skeleton-line-badge,
    .skeleton-destination,
    .skeleton-time,
    .skeleton-countdown,
    .skeleton-status {
        width: 100%;
        max-width: 100%;
    }

    .skeleton-line-badge {
        width: 60px;
    }

    .skeleton-status {
        width: 140px;
    }
}

/* ============================================
   RESPONSIVE DESIGN (SIMPLIFIED)
   Proportional system handles most scaling automatically
   ============================================ */

/* Fine-tune for extreme aspect ratios */
@media (max-aspect-ratio: 4/5) {
    /* Portrait mode - stack elements more vertically */
    :root {
        --max-width: 100vw;
    }
}

@media (min-aspect-ratio: 21/9) {
    /* Ultra-wide screens - limit max width */
    :root {
        --max-width: 90vw;
    }
}

/* ============================================
   MOBILE & TABLET RESPONSIVE (ENHANCED)
   ============================================ */

/* Tablet Portrait & Phone Landscape (< 768px) */
@media (max-width: 767px) {
    :root {
        /* Optimized typography for mobile viewing distance (30-40cm) */
        --font-size-hero: 24px;
        --font-size-xlarge: 22px;
        --font-size-large: 20px;
        --font-size-medium: 16px;
        --font-size-base: 15px;
        --font-size-small: 13px;
        --font-size-xsmall: 12px;

        /* Layout dimensions */
        --header-height: 110px;
        --footer-height: auto;
        --arrival-row-height: auto;

        /* Optimized spacing for mobile */
        --spacing-xs: 6px;
        --spacing-sm: 12px;
        --spacing-md: 16px;
        --spacing-lg: 20px;
        --spacing-xl: 24px;
        --spacing-xxl: 32px;
        --spacing-xxxl: 48px;
    }

    /* Header enhancements */
    .header-content {
        padding: var(--spacing-sm) var(--spacing-md);
        flex-wrap: wrap;
        gap: var(--spacing-sm);
    }

    .station-info {
        flex: 1 1 100%;
        justify-content: center;
        gap: var(--spacing-md);
    }

    .header-right {
        flex: 1 1 100%;
        justify-content: space-between;
        align-items: center;
    }

    .fgc-logo {
        width: 45px;
        height: 45px;
    }

    .logo-square {
        font-size: 14px;
    }

    .station-name {
        letter-spacing: 0;
    }

    .station-line {
        font-size: 14px;
        letter-spacing: 1px;
    }

    .station-line::before {
        width: 6px;
        height: 6px;
    }

    /* Time display */
    .current-time {
        order: 1;
        text-align: left;
    }

    /* Language selector - maintain touch targets */
    .language-selector {
        order: 2;
        gap: 6px;
    }

    /* Main container width constraints */
    .departures-main {
        padding: var(--spacing-md);
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    .departures-container {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }

    /* Departures table - MOBILE CSS GRID LAYOUT */
    .departures-table {
        display: block !important;
        width: 100% !important;
        overflow: hidden !important;
        table-layout: auto !important; /* Override desktop fixed layout */
        border-collapse: separate !important;
    }

    .departures-table thead {
        display: none !important; /* Hide headers on mobile - saves space */
    }

    .departures-table tbody {
        display: block !important;
        width: 100% !important;
    }

    .departures-table tbody tr {
        display: grid !important; /* CSS GRID for proper layout control */
        grid-template-columns: auto minmax(0, 1fr) auto auto; /* Magic: minmax(0, 1fr) allows destination to shrink to 0 */
        grid-template-rows: auto auto; /* Two rows: main content + status */
        gap: 4px 6px; /* Tighter gaps: vertical horizontal */
        align-items: center !important;
        width: 100% !important;
        padding: 6px 6px !important; /* Much smaller padding for vertical phones */
        margin-bottom: 6px;
        border-radius: var(--border-radius-sm) !important;
        border-left: 3px solid var(--fgc-green) !important;
        border-bottom: none !important; /* Remove desktop border */
        background: white !important;
        box-sizing: border-box !important; /* Critical for width calculation */
        overflow: hidden;
        box-shadow: 0 1px 2px rgba(0,0,0,0.08) !important;
        transform: none !important; /* Reset desktop transform */
    }

    .departures-table tbody tr:hover {
        transform: none !important;
        box-shadow: 0 2px 6px rgba(0,0,0,0.15) !important;
        background: white !important; /* Override desktop hover gradient */
    }

    .departures-table tbody td {
        display: block !important; /* Reset table-cell display */
        padding: 0 !important; /* Override desktop padding */
        box-sizing: border-box !important;
        width: auto !important; /* Override desktop fixed widths */
        vertical-align: baseline !important;
        border: none !important;
    }

    /* Grid positioning for mobile layout */
    .col-line {
        grid-column: 1;
        grid-row: 1;
        justify-self: center;
    }

    .col-destination {
        grid-column: 2;
        grid-row: 1;
        min-width: 0; /* Critical: allows text to shrink below intrinsic width */
        overflow: hidden;
    }

    .col-time {
        grid-column: 3;
        grid-row: 1;
        justify-self: center;
    }

    .col-countdown {
        grid-column: 4;
        grid-row: 1;
        justify-self: end;
    }

    .col-status {
        grid-column: 1 / -1; /* Span all columns (full width) */
        grid-row: 2;
        justify-self: stretch;
        width: 100%;
    }

    /* Component sizing for mobile - more compact for vertical phones */
    .line-badge,
    .line-badge-sm {
        min-width: 36px;
        max-width: 36px;
        padding: 3px 4px;
        font-size: 10px;
        text-align: center;
        white-space: nowrap;
        font-weight: 700;
    }

    .destination,
    .destination-name {
        font-size: 13px; /* Smaller for vertical */
        font-weight: 600;
        line-height: 1.2;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important; /* Force single line with ellipsis */
        max-width: 100%;
        display: block;
    }

    .time-display,
    .scheduled-time,
    .estimated-time {
        font-size: 12px; /* Smaller for vertical */
        font-weight: 700;
        white-space: nowrap;
    }

    .countdown {
        font-size: 11px;
        font-weight: 700;
        padding: 4px 6px; /* Smaller padding */
        min-width: 50px;
        max-width: 65px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 2px;
        white-space: nowrap;
        border-radius: 5px;
        background: rgba(136, 187, 11, 0.1);
        border: 1.5px solid var(--fgc-green);
    }

    .countdown-value {
        font-size: 13px; /* Smaller */
    }

    .countdown-unit {
        font-size: 9px; /* Smaller */
    }

    .status-badge {
        width: 100%;
        max-width: none;
        font-size: 10px; /* Smaller */
        padding: 4px 8px; /* Smaller padding */
        justify-content: center;
        text-align: center;
        margin-top: 2px;
    }

    /* Footer optimization */
    .footer-content {
        flex-direction: column;
        gap: var(--spacing-md);
        text-align: center;
        padding: var(--spacing-md);
    }

    .footer-info,
    .footer-refresh,
    .footer-status {
        font-size: 13px;
    }

    .info-icon,
    .refresh-icon {
        font-size: 16px;
    }

    /* Alerts banner */
    .alerts-banner {
        padding: var(--spacing-sm) var(--spacing-md);
        min-height: auto;
    }

    .alert-message {
        font-size: var(--font-size-small);
    }

    /* Loading and error states */
    .loading-state,
    .error-state {
        min-height: 300px;
        padding: var(--spacing-xl);
    }

    /* Empty state */
    .no-departures {
        padding: var(--spacing-xl);
        min-height: 300px;
    }

    .no-departures .empty-icon {
        font-size: 60px;
    }

    .no-departures p {
        font-size: 16px;
    }
}

/* Large Phone Portrait (< 600px) */
@media (max-width: 599px) {
    :root {
        /* Further reduced typography */
        --font-size-hero: 22px;
        --font-size-xlarge: 20px;
        --font-size-large: 18px;
        --font-size-medium: 15px;
        --font-size-base: 14px;
        --font-size-small: 12px;
        --font-size-xsmall: 11px;

        /* Tighter spacing */
        --spacing-xs: 4px;
        --spacing-sm: 8px;
        --spacing-md: 12px;
        --spacing-lg: 16px;
        --spacing-xl: 20px;
        --spacing-xxl: 24px;
        --spacing-xxxl: 32px;

        --header-height: 105px;
    }

    /* Tighter header */
    .fgc-logo {
        width: 42px;
        height: 42px;
    }

    .logo-square {
        font-size: 13px;
    }

    .station-line {
        font-size: 13px;
    }

    /* Tighter horizontal layout for smaller phones */
    .departures-table tbody tr {
        padding: 10px 8px !important;
        margin-bottom: 6px;
    }

    .col-line {
        margin-right: 6px;
    }

    .col-destination {
        margin-right: 6px;
    }

    .col-time {
        margin-right: 4px;
    }

    .line-badge,
    .line-badge-sm {
        min-width: 38px;
        max-width: 38px;
        padding: 3px 5px;
        font-size: 11px;
    }

    .destination,
    .destination-name {
        font-size: 14px;
    }

    .time-display,
    .scheduled-time,
    .estimated-time {
        font-size: 13px;
    }

    .countdown {
        font-size: 13px;
        padding: 5px 8px;
        min-width: 55px;
        max-width: 70px;
    }

    .countdown-value {
        font-size: 15px;
    }

    .countdown-unit {
        font-size: 10px;
    }

    .status-badge {
        font-size: 11px;
        padding: 5px 10px;
    }

    /* Language selector */
    .language-selector {
        gap: 4px;
    }

    .lang-btn {
        min-width: 42px;
        min-height: 42px;
        padding: 8px 12px;
        font-size: 13px;
    }

    /* Footer */
    .footer-info,
    .footer-refresh {
        flex-direction: column;
        gap: var(--spacing-xs);
    }

    .info-text,
    .refresh-text {
        font-size: 12px;
    }
}

/* Small Phone Portrait (< 480px) - Compact Layout */
@media (max-width: 479px) {
    :root {
        /* Minimum viable typography */
        --font-size-hero: 20px;
        --font-size-xlarge: 18px;
        --font-size-large: 16px;
        --font-size-medium: 14px;
        --font-size-base: 13px;
        --font-size-small: 11px;
        --font-size-xsmall: 10px;

        /* Minimal spacing */
        --spacing-xs: 4px;
        --spacing-sm: 6px;
        --spacing-md: 10px;
        --spacing-lg: 12px;
        --spacing-xl: 16px;
        --spacing-xxl: 20px;
        --spacing-xxxl: 24px;

        --header-height: 100px;
    }

    /* Compact header */
    .fgc-logo {
        width: 40px;
        height: 40px;
    }

    .logo-square {
        font-size: 12px;
    }

    .station-line::before {
        display: none; /* Hide animated dot on very small screens */
    }

    /* Extra compact horizontal layout for very small phones */
    .departures-table tbody tr {
        padding: 8px 6px !important;
        margin-bottom: 6px;
    }

    .col-line {
        margin-right: 4px;
    }

    .col-destination {
        margin-right: 4px;
    }

    .col-time {
        margin-right: 3px;
    }

    .line-badge,
    .line-badge-sm {
        min-width: 36px;
        max-width: 36px;
        padding: 3px 4px;
        font-size: 10px;
    }

    .destination,
    .destination-name {
        font-size: 13px;
        line-height: 1.2;
    }

    .time-display,
    .scheduled-time,
    .estimated-time {
        font-size: 12px;
    }

    .countdown {
        font-size: 12px;
        padding: 4px 6px;
        min-width: 50px;
        max-width: 65px;
    }

    .countdown-value {
        font-size: 14px;
    }

    .countdown-unit {
        font-size: 9px;
    }

    .status-badge {
        font-size: 11px;
        padding: 5px 10px;
        margin-top: 6px;
    }

    /* Language selector */
    .lang-btn {
        min-width: 38px;
        min-height: 38px;
        padding: 6px 10px;
        font-size: 12px;
    }

    /* Loading/error states */
    .loading-state,
    .error-state,
    .no-departures {
        min-height: 250px;
        padding: var(--spacing-xl);
    }

    .no-departures .empty-icon {
        font-size: 50px;
    }

    .no-departures p {
        font-size: 14px;
    }
}

/* ============================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================ */

/* Touch-specific enhancements for all screen sizes */
@media (pointer: coarse) {
    /* Ensure minimum 44x44px touch targets (WCAG 2.5.5) */
    .language-selector button,
    .lang-btn,
    .retry-button {
        min-width: 44px;
        min-height: 44px;
        padding: 12px 16px;
    }

    /* Increase spacing between touch targets */
    .language-selector {
        gap: 8px;
    }

    /* Enhanced active/pressed states for touch feedback */
    .lang-btn:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }

    .retry-button:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }

    /* Remove hover effects that don't work well on touch */
    .arrival-item:hover {
        transform: none;
        box-shadow: none;
    }

    /* Larger tap area for language buttons */
    .lang-btn {
        position: relative;
    }

    .lang-btn::after {
        content: '';
        position: absolute;
        top: -4px;
        left: -4px;
        right: -4px;
        bottom: -4px;
        /* Invisible expanded touch target */
    }

    /* Prevent text selection on UI elements */
    .lang-btn,
    .status-badge,
    .line-badge,
    .station-name,
    .countdown {
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }
}

/* Touch optimizations on mobile specifically */
@media (pointer: coarse) and (max-width: 767px) {
    /* Extra padding for touch-friendly table rows */
    .arrival-item {
        padding: var(--spacing-lg) var(--spacing-md);
        border-bottom: 2px solid var(--color-border-light);
    }

    /* Larger badges for easier reading */
    .line-badge,
    .status-badge {
        padding: 10px 16px;
    }

    /* Enable smooth scrolling */
    html {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }
}

/* ============================================
   MOBILE PERFORMANCE OPTIMIZATIONS
   ============================================ */

/* Reduce animations on mobile for better performance */
@media (max-width: 767px) {
    /* Disable decorative animations */
    .header-content::before,
    .header-content::after,
    .alerts-banner::before {
        animation: none;
    }

    .station-line::before {
        animation-duration: 4s; /* Slow down from 2s */
    }

    /* Simplify refresh icon animation */
    .refresh-icon {
        animation-duration: 6s; /* Slow down from 3s */
    }

    /* Keep only critical functional animations */
    .countdown-imminent,
    .status-boarding-badge {
        animation: pulse 1.5s ease-in-out infinite;
    }

    /* Optimize for GPU acceleration */
    .arrival-item {
        transform: translateZ(0);
        will-change: auto;
    }
}

/* Battery-saving mode - respect system preferences */
@media (prefers-reduced-motion: reduce) {
    .station-line::before,
    .refresh-icon,
    .empty-icon {
        animation: none;
    }
}

/* Landscape orientation on mobile - optimize horizontal space */
@media (max-width: 767px) and (orientation: landscape) {
    :root {
        --header-height: 70px; /* Even smaller in landscape */
    }

    .header-content {
        padding: 6px 12px;
        flex-wrap: nowrap;
    }

    .station-info {
        flex: 0 1 auto;
        flex-direction: row;
    }

    .header-right {
        flex: 0 1 auto;
        flex-direction: row;
        gap: 12px;
    }

    .current-time {
        flex-direction: row;
        gap: 8px;
        text-align: left;
    }

    .time-display {
        margin-bottom: 0;
        font-size: 16px;
    }

    /* Keep grid but adjust for landscape - more items on one row */
    .departures-table tbody tr {
        padding: 5px 8px;
        grid-template-columns: auto minmax(0, 1fr) auto auto auto; /* 5 columns in landscape */
        grid-template-rows: auto; /* Single row */
        margin-bottom: 4px;
    }

    /* All on same row in landscape */
    .col-status {
        grid-column: 5;
        grid-row: 1;
        justify-self: end;
        width: auto;
        margin-top: 0;
    }

    .status-badge {
        width: auto;
        min-width: 60px;
        font-size: 9px;
        padding: 3px 6px;
    }

    /* Slightly larger sizes for landscape since more horizontal space */
    .line-badge,
    .line-badge-sm {
        min-width: 38px;
        max-width: 38px;
        font-size: 11px;
    }

    .destination,
    .destination-name {
        font-size: 14px;
    }

    .time-display {
        font-size: 13px;
    }

    .countdown {
        font-size: 12px;
        padding: 4px 7px;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* High contrast mode */
@media (prefers-contrast: high) {
    .arrival-item {
        border-bottom: 3px solid var(--color-text-primary);
    }

    .status-badge {
        border-width: 4px;
    }

    .line-badge {
        border: 2px solid white;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles */
*:focus-visible {
    outline: 4px solid var(--fgc-green);
    outline-offset: 2px;
    border-radius: var(--border-radius-sm);
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    body::before,
    .station-header,
    .station-footer,
    .alerts-banner {
        display: none;
    }

    .arrivals-container {
        margin: 0;
        padding: 0;
    }

    .arrival-item {
        break-inside: avoid;
        border: 1px solid var(--color-border);
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.fade-in {
    animation: fadeIn var(--transition-base);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.fade-out {
    animation: fadeOut var(--transition-base);
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

.slide-up {
    animation: slideUp var(--transition-base);
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.hidden {
    display: none !important;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ============================================
   SPECIAL EFFECTS
   ============================================ */

/* Train arrival animation effect */
@keyframes trainArrival {
    0% {
        transform: translateX(-100%);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

.train-arriving {
    animation: trainArrival var(--transition-slow) ease-out;
}

/* Next train highlight effect */
.next-train {
    position: relative;
    background: linear-gradient(90deg,
        rgba(136, 187, 11, 0.08) 0%,
        transparent 100%) !important;
    box-shadow: inset 0 0 0 2px var(--fgc-green-light);
}

.next-train::after {
    content: 'PROPER TREN';
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    background: var(--fgc-green);
    color: white;
    font-size: var(--font-size-xsmall);
    font-weight: var(--font-weight-bold);
    padding: 4px 12px;
    border-radius: var(--border-radius-sm);
    letter-spacing: 1px;
    box-shadow: var(--shadow-md);
}

/* ============================================
   TABLE-BASED DEPARTURES LAYOUT
   ============================================ */

.departures-main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--spacing-xl);
    min-height: calc(100vh - var(--header-height) - var(--footer-height));
    /* CRITICAL: Prevent horizontal overflow */
    overflow-x: hidden;
    box-sizing: border-box;
    width: 100%;
}

.loading-state,
.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xxxl);
    text-align: center;
    min-height: 50vh;
    background: linear-gradient(180deg, rgba(136, 187, 11, 0.03) 0%, transparent 100%);
    border-radius: var(--border-radius-xl);
}

.loading-state {
    color: var(--color-text-secondary);
    background: var(--color-bg-primary, #ffffff);
    min-height: 300px;
}

.loading-train-icon {
    font-size: clamp(60px, 12vmin, 120px);
    animation: trainBounce 1.5s ease-in-out infinite;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
    margin-bottom: var(--spacing-lg);
}

@keyframes trainBounce {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    25% {
        transform: translateY(-8px) scale(1.02);
    }
    50% {
        transform: translateY(0) scale(1);
    }
    75% {
        transform: translateY(-4px) scale(1.01);
    }
}

.loading-text {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-secondary);
    margin-top: var(--spacing-md);
}

.error-state {
    background: var(--status-cancelled-bg);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-xxxl);
}

.error-icon {
    font-size: var(--icon-size-xl);
    margin-bottom: var(--spacing-lg);
}

.error-state h2 {
    color: var(--status-cancelled);
    font-size: var(--font-size-xl);
    margin-bottom: var(--spacing-md);
}

.error-state p {
    font-size: var(--font-size-md);
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-lg);
}

.retry-button {
    background: var(--fgc-green);
    color: white;
    border: none;
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-md);
    min-width: clamp(120px, 15vmin, 200px);
    min-height: clamp(38px, 5vmin, 48px);
}

.retry-button:hover {
    background: var(--fgc-green-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.departures-table {
    width: 100%;
    max-width: 100%; /* Prevent overflow */
    border-collapse: collapse;
    table-layout: fixed; /* CRITICAL: Forces consistent column widths */
    background: white;
    border-radius: var(--border-radius-lg);
    box-sizing: border-box;
    overflow: hidden; /* Clip any overflow */
    box-shadow: var(--shadow-lg);
}

.departures-table thead {
    background: linear-gradient(135deg, #2C3E50 0%, #34495E 100%);
    color: white;
}

.departures-table thead tr {
    display: table-row;
}

.departures-table thead th {
    display: table-cell;
    padding: var(--spacing-lg) var(--spacing-md);
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    text-align: center;
    text-transform: none;
    letter-spacing: clamp(0.3px, 0.05vmin, 0.5px);
    opacity: 0.95;
    vertical-align: middle;
    white-space: nowrap;
    box-sizing: border-box;
}

.departures-table tbody tr {
    display: table-row;
    border-bottom: 1px solid var(--color-border-light);
    transition: all var(--transition-base);
    animation: slideUp var(--transition-base);
    background: white;
}

.departures-table tbody tr:nth-child(even) {
    background: linear-gradient(90deg, rgba(248, 249, 250, 0.6) 0%, white 50%);
}

.departures-table tbody tr:hover {
    background: linear-gradient(90deg, rgba(136, 187, 11, 0.08) 0%, white 50%);
    transform: translateX(clamp(2px, 0.3vmin, 3px));
    box-shadow: clamp(-3px, -0.4vmin, -4px) 0 0 0 var(--fgc-green);
}

.departures-table tbody tr:last-child {
    border-bottom: none;
}

.departures-table tbody td {
    display: table-cell;
    padding: var(--spacing-lg) var(--spacing-md);
    font-size: var(--font-size-lg);
    vertical-align: middle;
    box-sizing: border-box;
}

.line-badge-sm {
    display: inline-block;
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--border-radius-lg);
    font-weight: var(--font-weight-extrabold);
    font-size: var(--font-size-md);
    text-align: center;
    min-width: var(--badge-min-width);
    aspect-ratio: 2 / 1;
    box-shadow: var(--shadow-md);
    letter-spacing: clamp(1px, 0.2vmin, 2px);
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.destination {
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-lg);
    color: var(--color-text-primary);
    line-height: 1.3;
}

.time-display {
    font-family: 'Roboto Mono', 'Courier New', monospace;
    font-size: var(--font-size-lg);
    font-weight: 500;
    color: var(--color-text-primary);
    letter-spacing: clamp(0.5px, 0.1vmin, 1px);
    font-variant-numeric: tabular-nums;
}

.countdown {
    display: inline-block;
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--border-radius-lg);
    font-family: 'Montserrat', 'Helvetica Neue', sans-serif;
    font-weight: 700;
    font-size: var(--font-size-lg);
    text-align: center;
    min-width: clamp(100px, 14vmin, 140px);
    aspect-ratio: 3 / 1;
    box-shadow: var(--shadow-sm);
    border: clamp(2px, 0.3vmin, 3px) solid transparent;
    font-variant-numeric: tabular-nums;
}

.countdown-imminent {
    background: var(--status-boarding-bg);
    color: var(--status-boarding);
    border-color: var(--status-boarding);
    animation: pulseGlow 1.5s ease-in-out infinite;
}

.countdown-soon {
    background: var(--status-on-time-bg);
    color: var(--status-on-time);
    border-color: var(--status-on-time);
}

.countdown-later {
    background: #F5F5F5;
    color: var(--color-text-primary);
    border-color: #E0E0E0;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

@keyframes pulseGlow {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(232, 93, 4, 0);
    }
    50% {
        opacity: 0.85;
        box-shadow: 0 0 8px 2px rgba(232, 93, 4, 0.4);
    }
}

/* Next Day Badge Styles */
.next-day-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
    padding: 1px 4px;
    font-size: 9px;
    font-weight: 700;
    color: white;
    background: #6366f1;
    border-radius: 4px;
    vertical-align: super;
    line-height: 1;
    letter-spacing: 0;
}

.next-day-row {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.05) 0%, transparent 100%);
}

.next-day-row:hover {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.1) 0%, rgba(136, 187, 11, 0.05) 100%);
}

/* Show More Button Styles */
.show-more-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-lg) var(--spacing-md);
    background: linear-gradient(180deg, transparent 0%, rgba(136, 187, 11, 0.03) 100%);
    border-top: 1px solid var(--border-light);
}

.show-more-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-xl);
    min-height: 44px;
    font-family: inherit;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-bold);
    color: white;
    background: #88BB0B;
    border: none;
    border-radius: var(--border-radius-lg);
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 3px 10px rgba(136, 187, 11, 0.35);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.show-more-btn:hover:not(:disabled) {
    background: #6d9a08;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(136, 187, 11, 0.5);
}

.show-more-btn:active:not(:disabled) {
    background: #5a7d06;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(136, 187, 11, 0.4);
}

.show-more-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.show-more-btn.loading .show-more-icon {
    animation: spin 1s linear infinite;
}

.show-more-btn.loading .show-more-text::after {
    content: '...';
    animation: ellipsis 1.5s infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes ellipsis {
    0% { content: '.'; }
    33% { content: '..'; }
    66% { content: '...'; }
}

.show-more-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.show-more-btn:hover:not(:disabled) .show-more-icon {
    transform: translateY(2px);
}

.departures-count {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    font-weight: var(--font-weight-medium);
}

/* Mobile adjustments for show more */
@media (max-width: 768px) {
    .show-more-container {
        padding: var(--spacing-md);
    }

    .show-more-btn {
        width: 100%;
        max-width: 280px;
        padding: var(--spacing-md) var(--spacing-xl);
    }
}

.no-departures {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xxxl);
    text-align: center;
    color: var(--color-text-secondary);
    min-height: 40vh;
    background: linear-gradient(180deg, rgba(136, 187, 11, 0.02) 0%, transparent 100%);
    border-radius: var(--border-radius-xl);
}

.no-departures .empty-icon {
    font-size: clamp(60px, 12vmin, 120px);
    margin-bottom: var(--spacing-lg);
    opacity: 0.5;
    filter: grayscale(20%);
}

.no-departures p {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-secondary);
}

.footer-status {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    align-items: center;
}

.status-bar {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.status-indicator {
    width: clamp(10px, 1.2vmin, 12px);
    height: clamp(10px, 1.2vmin, 12px);
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background: var(--status-on-time);
    box-shadow: 0 0 10px var(--status-on-time-glow);
    animation: blink 2s ease-in-out infinite;
}

.status-indicator.error {
    background: var(--status-cancelled);
    box-shadow: 0 0 10px rgba(211, 47, 47, 0.3);
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-message {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
}

.last-update {
    font-size: var(--font-size-xs);
    opacity: 0.8;
}

/* Column widths - Apply to BOTH th and td for perfect alignment */
.departures-table th.col-line,
.departures-table td.col-line {
    width: var(--col-line);
    text-align: center;
}

.departures-table th.col-destination,
.departures-table td.col-destination {
    width: var(--col-destination);
    text-align: left;
}

.departures-table th.col-time,
.departures-table td.col-time {
    width: var(--col-time);
    text-align: center;
}

.departures-table th.col-countdown,
.departures-table td.col-countdown {
    width: var(--col-countdown);
    text-align: center;
}

.departures-table th.col-status,
.departures-table td.col-status {
    width: var(--col-status);
    text-align: center;
}

/* Ensure all headers are centered by default */
.departures-table thead th {
    text-align: center !important;
}

/* Override for left-aligned destination header */
.departures-table thead th.col-destination {
    text-align: left !important;
    padding-left: calc(var(--spacing-md) + var(--spacing-sm));
}

/* Status badge improvements */
.status-badge {
    font-size: var(--font-size-md);
    padding: var(--spacing-sm) var(--spacing-lg);
    min-width: auto;
    border-width: clamp(2px, 0.25vmin, 3px);
}

/* Hide on-time status to reduce clutter */
.status-on-time-badge {
    display: none;
}

/* Show only important status badges */
.status-delayed-badge,
.status-cancelled-badge {
    display: inline-flex;
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-extrabold);
    padding: var(--spacing-md) var(--spacing-xl);
}

/* ============================================
   PROPORTIONAL LAYOUT SYSTEM - SUMMARY
   ============================================

   This CSS implements a complete proportional/fluid layout system
   that maintains EXACT proportions across all screen sizes.

   KEY FEATURES:

   1. VIEWPORT-BASED LAYOUT
      - Header: 10vh (10% of viewport height)
      - Footer: 8vh (8% of viewport height)
      - Main: 82vh (fills remaining space)
      - All elements scale proportionally to viewport size

   2. PERCENTAGE-BASED GRID COLUMNS
      - Line: 8%
      - Destination: 45%
      - Time: 15%
      - Countdown: 15%
      - Status: 17%
      - Total: 100% - maintains exact proportions

   3. FLUID TYPOGRAPHY (clamp function)
      - --font-size-xs: 10px → 14px
      - --font-size-sm: 12px → 18px
      - --font-size-md: 14px → 22px
      - --font-size-lg: 18px → 28px
      - --font-size-xl: 24px → 40px
      - --font-size-hero: 32px → 76px
      - --font-size-display: 28px → 58px
      - Scales smoothly using vmin (viewport minimum)

   4. FLUID SPACING SYSTEM
      - All spacing uses clamp() for proportional scaling
      - --spacing-xs: 4px → 8px
      - --spacing-sm: 8px → 16px
      - --spacing-md: 12px → 24px
      - --spacing-lg: 16px → 32px
      - --spacing-xl: 24px → 48px
      - --spacing-xxl: 32px → 64px
      - --spacing-xxxl: 48px → 96px

   5. ASPECT RATIOS FOR CONSISTENT SHAPES
      - Logo: aspect-ratio: 1/1 (perfect square)
      - Line badge: aspect-ratio: 2/1 (horizontal)
      - Countdown: aspect-ratio: 3/1 (wide horizontal)
      - Status indicator: aspect-ratio: 1/1 (circle)
      - All shapes maintain proportions at any size

   6. PROPORTIONAL ELEMENT SIZES
      - Logo: clamp(40px, 8vh, 100px)
      - Icons: clamp ranges based on context
      - Badges: min-widths use clamp()
      - All border-radius values use clamp()

   7. MINIMAL MEDIA QUERIES
      - Removed device-specific breakpoints
      - Only aspect-ratio adjustments for extreme cases
      - System auto-scales from 320px phones to 4K TVs

   RESULT: The interface looks IDENTICAL proportionally
   whether viewed on a 320px phone, 768px tablet, 1920px TV,
   or 4K display. All elements maintain their relative sizes
   and spacing perfectly.

   ============================================ */

/* ============================================
   iPHONE 15 PRO MAX OPTIMIZED STYLES
   Portrait: 430px | Landscape: 932px
   ============================================ */

/* iPhone 15 Pro Max Portrait Mode (430px width) */
@media screen and (max-width: 440px) and (orientation: portrait) {
    :root {
        --header-height: auto;
        --footer-height: auto;
    }

    /* Compact header for portrait */
    .station-header {
        height: auto;
        padding: 12px 0;
    }

    .header-content {
        flex-direction: column;
        gap: 10px;
        padding: 0 12px;
    }

    .station-info {
        flex-direction: row;
        justify-content: flex-start;
        width: 100%;
        gap: 10px;
    }

    .fgc-logo {
        width: 44px;
        height: 44px;
        min-width: 44px;
        border-radius: 8px;
    }

    .logo-square {
        font-size: 14px;
    }

    .station-details {
        flex: 1;
        min-width: 0;
    }

    .station-name {
        font-size: 16px;
        letter-spacing: 0.5px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .line-filter {
        margin-top: 4px;
    }

    .line-filter-badge {
        padding: 3px 8px;
        font-size: 10px;
        min-width: 32px;
        min-height: 24px;
    }

    .header-right {
        width: 100%;
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
    }

    /* Station selector - full width and touch-friendly */
    .station-selector-wrapper {
        flex: 1;
        max-width: 200px;
    }

    .station-selector-label {
        display: none;
    }

    .station-select-container {
        width: 100%;
        min-width: unset;
    }

    .station-select {
        width: 100%;
        min-height: 44px;
        font-size: 13px;
        padding: 10px 32px 10px 12px;
        border-radius: 8px;
    }

    /* Time display */
    .current-time {
        text-align: center;
    }

    #currentTime {
        font-size: 20px;
    }

    #currentDate {
        font-size: 11px;
        margin-top: 2px;
    }

    /* Language selector - touch-friendly */
    .language-selector {
        gap: 4px;
    }

    .lang-btn {
        min-width: 44px;
        min-height: 44px;
        padding: 8px;
        font-size: 12px;
        border-radius: 8px;
    }

    /* Main content area */
    .departures-main {
        padding: 10px;
    }

    /* Card-based departure layout for portrait */
    .departures-table {
        display: block !important;
        border-radius: 12px;
        overflow: hidden;
    }

    .departures-table thead {
        display: none !important;
    }

    .departures-table tbody {
        display: flex !important;
        flex-direction: column;
        gap: 8px;
    }

    .departures-table tbody tr {
        display: flex !important;
        flex-direction: column;
        padding: 12px !important;
        margin: 0 !important;
        border-radius: 12px !important;
        border-left: 4px solid var(--fgc-green) !important;
        background: white !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.08) !important;
    }

    .departures-table tbody tr:hover {
        transform: none !important;
        box-shadow: 0 4px 12px rgba(0,0,0,0.12) !important;
    }

    .departures-table tbody td {
        display: block !important;
        width: 100% !important;
        padding: 0 !important;
    }

    /* Card layout - Top row: Line + Destination + Time */
    .departures-table tbody tr {
        display: grid !important;
        grid-template-columns: auto 1fr auto;
        grid-template-rows: auto auto;
        gap: 8px 10px;
        align-items: center;
    }

    .col-line {
        grid-column: 1;
        grid-row: 1;
    }

    .col-destination {
        grid-column: 2;
        grid-row: 1;
        min-width: 0;
    }

    .col-time {
        grid-column: 3;
        grid-row: 1;
    }

    /* Bottom row: Countdown + Status */
    .col-countdown {
        grid-column: 1 / 3;
        grid-row: 2;
        justify-self: start;
    }

    .col-status {
        grid-column: 3;
        grid-row: 2;
        justify-self: end;
    }

    /* Component sizing */
    .line-badge,
    .line-badge-sm {
        min-width: 42px;
        max-width: 42px;
        padding: 6px 8px;
        font-size: 12px;
        font-weight: 800;
        border-radius: 8px;
        aspect-ratio: auto;
    }

    .destination,
    .destination-name {
        font-size: 15px;
        font-weight: 600;
        line-height: 1.3;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .time-display,
    .scheduled-time {
        font-size: 14px;
        font-weight: 600;
    }

    .countdown {
        font-size: 14px;
        font-weight: 700;
        padding: 8px 14px;
        min-width: 90px;
        border-radius: 8px;
        aspect-ratio: auto;
    }

    .status-badge {
        font-size: 10px;
        padding: 6px 10px;
        min-width: auto;
        border-radius: 6px;
    }

    /* Next day badge */
    .next-day-badge {
        font-size: 10px;
        padding: 2px 5px;
        margin-left: 6px;
    }

    /* Show more button */
    .show-more-container {
        padding: 12px;
    }

    .show-more-btn {
        width: 100%;
        max-width: 100%;
        min-height: 48px;
        font-size: 15px;
        border-radius: 10px;
    }

    .departures-count {
        font-size: 12px;
    }

    /* Footer */
    .station-footer {
        margin-top: 16px;
    }

    .footer-content {
        flex-direction: column;
        gap: 12px;
        padding: 12px;
        text-align: center;
    }

    .footer-info,
    .footer-refresh,
    .footer-status {
        font-size: 12px;
        flex-direction: column;
        gap: 4px;
    }

    .info-icon,
    .refresh-icon {
        font-size: 18px;
    }

    /* Loading and empty states */
    .loading-state,
    .error-state,
    .no-departures {
        min-height: 50vh;
        padding: 24px;
    }

    .loading-train-icon {
        font-size: 60px;
    }

    .loading-text {
        font-size: 16px;
    }

    .retry-button {
        min-width: 140px;
        min-height: 48px;
        font-size: 15px;
        border-radius: 10px;
    }
}

/* iPhone 15 Pro Max Landscape Mode (~932px width) */
@media screen and (min-width: 800px) and (max-width: 1000px) and (orientation: landscape) {
    :root {
        --header-height: 60px;
    }

    .station-header {
        height: var(--header-height);
    }

    .header-content {
        flex-wrap: nowrap;
        padding: 0 16px;
        gap: 16px;
    }

    .station-info {
        flex: 0 1 auto;
        gap: 12px;
    }

    .fgc-logo {
        width: 40px;
        height: 40px;
    }

    .logo-square {
        font-size: 12px;
    }

    .station-name {
        font-size: 16px;
    }

    .line-filter-badge {
        padding: 2px 6px;
        font-size: 9px;
        min-width: 28px;
    }

    .header-right {
        flex: 0 1 auto;
        gap: 12px;
    }

    .station-selector-wrapper {
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }

    .station-selector-label {
        display: none;
    }

    .station-select {
        min-height: 36px;
        font-size: 12px;
        padding: 6px 28px 6px 10px;
    }

    #currentTime {
        font-size: 18px;
    }

    #currentDate {
        font-size: 10px;
        margin-top: 2px;
    }

    .lang-btn {
        min-width: 36px;
        min-height: 36px;
        font-size: 11px;
        padding: 6px;
    }

    /* Table layout for landscape - more compact */
    .departures-main {
        padding: 12px 16px;
    }

    .departures-table thead th {
        padding: 10px 8px;
        font-size: 12px;
    }

    .departures-table tbody td {
        padding: 10px 8px;
    }

    .line-badge,
    .line-badge-sm {
        min-width: 45px;
        padding: 4px 8px;
        font-size: 11px;
    }

    .destination,
    .destination-name {
        font-size: 14px;
    }

    .time-display {
        font-size: 13px;
    }

    .countdown {
        font-size: 13px;
        padding: 6px 10px;
        min-width: 80px;
    }

    .status-badge {
        font-size: 10px;
        padding: 4px 8px;
    }

    /* Compact footer for landscape */
    .station-footer {
        margin-top: 12px;
    }

    .footer-content {
        padding: 8px 16px;
    }

    .footer-info,
    .footer-refresh,
    .footer-status {
        font-size: 11px;
    }
}

/* Safe area insets for iPhone notch/dynamic island */
@supports (padding: max(0px)) {
    .station-header {
        padding-top: max(0px, env(safe-area-inset-top));
    }

    .header-content {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
    }

    .station-footer {
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }

    .footer-content {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
    }

    .departures-main {
        padding-left: max(10px, env(safe-area-inset-left));
        padding-right: max(10px, env(safe-area-inset-right));
    }
}

/* Prevent iOS zoom on input focus */
@media screen and (max-width: 767px) {
    input, select, textarea {
        font-size: 16px !important;
    }

    .station-select {
        font-size: 16px !important;
    }
}

/* Smooth scrolling for iOS */
@supports (-webkit-overflow-scrolling: touch) {
    .departures-main {
        -webkit-overflow-scrolling: touch;
    }
}

/* Dark mode support (optional - follows system preference) */
@media (prefers-color-scheme: dark) {
    /* Uncomment to enable dark mode
    :root {
        --color-bg-primary: #1a1a1a;
        --color-bg-secondary: #2d2d2d;
        --color-bg-card: #2d2d2d;
        --color-text-primary: #ffffff;
        --color-text-secondary: #b0b0b0;
        --color-border: #404040;
        --color-border-light: #333333;
    }

    body {
        background: #1a1a1a;
    }

    .departures-table tbody tr {
        background: #2d2d2d !important;
    }
    */
}

/* ============================================
   PHASE 5: PERFORMANCE OPTIMIZATIONS
   Touch interactions, animations, containment
   ============================================ */

/* Touch interaction optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Mobile-specific touch optimizations */
    .departures-main {
        touch-action: pan-y;
        overscroll-behavior-y: contain;
    }

    /* Faster tap response - remove 300ms delay */
    .lang-btn,
    .show-more-btn,
    .station-select,
    .line-filter-badge,
    .retry-button {
        touch-action: manipulation;
    }

    /* Active state feedback for touch */
    .lang-btn:active,
    .show-more-btn:active,
    .retry-button:active {
        transform: scale(0.95);
        opacity: 0.9;
    }

    .station-select:active {
        transform: scale(0.98);
    }

    .line-filter-badge:active {
        transform: scale(0.92);
    }

    /* Departure card touch feedback */
    .departures-table tbody tr:active {
        transform: scale(0.98) !important;
        opacity: 0.95;
    }
}

/* GPU-accelerated animations */
.departures-table tbody tr,
.line-badge,
.countdown,
.status-badge,
.show-more-btn,
.lang-btn {
    will-change: transform, opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Layout containment for better performance */
.departures-table tbody tr {
    contain: layout style paint;
}

.line-badge,
.countdown,
.status-badge {
    contain: layout style;
}

/* Smooth card entrance animations for mobile */
@media screen and (max-width: 440px) {
    @keyframes cardSlideIn {
        from {
            opacity: 0;
            transform: translateY(10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .departures-table tbody tr {
        animation: cardSlideIn 0.3s ease-out;
        animation-fill-mode: both;
    }

    .departures-table tbody tr:nth-child(1) { animation-delay: 0.05s; }
    .departures-table tbody tr:nth-child(2) { animation-delay: 0.1s; }
    .departures-table tbody tr:nth-child(3) { animation-delay: 0.15s; }
    .departures-table tbody tr:nth-child(4) { animation-delay: 0.2s; }
    .departures-table tbody tr:nth-child(5) { animation-delay: 0.25s; }
    .departures-table tbody tr:nth-child(n+6) { animation-delay: 0.3s; }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .departures-table tbody tr {
        animation: none !important;
    }
}

/* Loading state pulse animation */
@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(136, 187, 11, 0.4);
    }
    50% {
        box-shadow: 0 0 20px 10px rgba(136, 187, 11, 0.2);
    }
}

.loading-train-icon {
    animation: pulseGlow 1.5s ease-in-out infinite;
}

/* Countdown urgency animations */
@keyframes urgentPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

.countdown.urgent {
    animation: urgentPulse 1s ease-in-out infinite;
}

/* Status indicator pulse */
@keyframes statusPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.status-indicator.online {
    animation: statusPulse 2s ease-in-out infinite;
}

/* Pull-to-refresh visual indicator (for future implementation) */
.pull-refresh-indicator {
    position: fixed;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--fgc-green);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: top 0.3s ease, opacity 0.3s ease;
    z-index: 1000;
}

.pull-refresh-indicator.visible {
    top: 20px;
    opacity: 1;
}

.pull-refresh-indicator.refreshing {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: translateX(-50%) rotate(0deg); }
    to { transform: translateX(-50%) rotate(360deg); }
}

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

@media screen and (max-width: 440px) {
    html {
        scroll-padding-top: 80px;
    }
}

/* Focus visible for accessibility */
.lang-btn:focus-visible,
.show-more-btn:focus-visible,
.station-select:focus-visible,
.retry-button:focus-visible {
    outline: 3px solid rgba(136, 187, 11, 0.5);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .line-badge,
    .countdown,
    .status-badge {
        border: 2px solid currentColor;
    }

    .departures-table tbody tr {
        border: 2px solid #333;
    }
}

/* Print styles for mobile */
@media print {
    .station-header,
    .station-footer,
    .show-more-container,
    .language-selector {
        display: none !important;
    }

    .departures-main {
        padding: 0;
    }

    .departures-table tbody tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* JavaScript touch feedback class */
.touch-active {
    transform: scale(0.95) !important;
    opacity: 0.85 !important;
    transition: transform 0.1s ease, opacity 0.1s ease !important;
}

/* Mobile body classes set by JavaScript */
body.is-mobile {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

body.is-pwa {
    /* Standalone PWA mode adjustments */
    overscroll-behavior: none;
}

/* Orientation-specific body classes */
body.portrait .header-content {
    /* Portrait-specific header adjustments handled in media queries */
}

body.landscape .header-content {
    /* Landscape-specific header adjustments handled in media queries */
}

/* ============================================================================
   GLASSMORPHISM EFFECTS
   Premium frosted glass visual effects for modern UI
   ============================================================================ */

/* CSS Variables for Glass Effects */
:root {
    /* Light mode glass variables */
    --glass-bg-light: rgba(255, 255, 255, 0.15);
    --glass-bg-light-strong: rgba(255, 255, 255, 0.25);
    --glass-border-light: rgba(255, 255, 255, 0.2);
    --glass-border-light-strong: rgba(255, 255, 255, 0.3);
    
    /* Dark mode glass variables */
    --glass-bg-dark: rgba(255, 255, 255, 0.1);
    --glass-bg-dark-strong: rgba(255, 255, 255, 0.18);
    --glass-border-dark: rgba(255, 255, 255, 0.15);
    --glass-border-dark-strong: rgba(255, 255, 255, 0.25);
    
    /* Glass blur intensity */
    --glass-blur-sm: 8px;
    --glass-blur-md: 10px;
    --glass-blur-lg: 15px;
    --glass-blur-xl: 20px;
}

/* Header - Flat Design (no glassmorphism) */
/* Note: Main header styles are defined at line 268 with flat #1a7f37 background */

/* Departure Table Rows - Subtle Glass Effect */
.departures-table tbody tr {
    background: linear-gradient(90deg, 
        rgba(255, 255, 255, 0.7) 0%, 
        rgba(255, 255, 255, 0.85) 50%,
        rgba(255, 255, 255, 0.7) 100%);
    backdrop-filter: blur(var(--glass-blur-sm));
    -webkit-backdrop-filter: blur(var(--glass-blur-sm));
    border: 1px solid var(--glass-border-light);
    border-left: none;
    border-right: none;
}

.departures-table tbody tr:nth-child(even) {
    background: linear-gradient(90deg, 
        rgba(248, 249, 250, 0.6) 0%, 
        rgba(255, 255, 255, 0.8) 50%,
        rgba(248, 249, 250, 0.6) 100%);
    backdrop-filter: blur(var(--glass-blur-sm));
    -webkit-backdrop-filter: blur(var(--glass-blur-sm));
}

.departures-table tbody tr:hover {
    background: linear-gradient(90deg, 
        rgba(136, 187, 11, 0.12) 0%, 
        rgba(255, 255, 255, 0.9) 50%,
        rgba(136, 187, 11, 0.08) 100%);
    backdrop-filter: blur(var(--glass-blur-md));
    -webkit-backdrop-filter: blur(var(--glass-blur-md));
    border: 1px solid rgba(136, 187, 11, 0.3);
    border-left: none;
    border-right: none;
}

/* Footer Glassmorphism - Dark Glass Effect */
.station-footer {
    background: linear-gradient(135deg, 
        rgba(38, 50, 56, 0.85) 0%, 
        rgba(55, 71, 79, 0.9) 100%);
    backdrop-filter: blur(var(--glass-blur-lg));
    -webkit-backdrop-filter: blur(var(--glass-blur-lg));
    border-top: 2px solid var(--glass-border-light);
    position: relative;
}

.station-footer::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--glass-bg-dark);
    backdrop-filter: blur(var(--glass-blur-md));
    -webkit-backdrop-filter: blur(var(--glass-blur-md));
    pointer-events: none;
    z-index: 0;
}

.footer-content {
    position: relative;
    z-index: 1;
}

/* Enhanced Glass Cards for Special Elements */
.glass-card {
    background: var(--glass-bg-light);
    backdrop-filter: blur(var(--glass-blur-md));
    -webkit-backdrop-filter: blur(var(--glass-blur-md));
    border: 1px solid var(--glass-border-light);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
}

.glass-card-dark {
    background: var(--glass-bg-dark);
    backdrop-filter: blur(var(--glass-blur-md));
    -webkit-backdrop-filter: blur(var(--glass-blur-md));
    border: 1px solid var(--glass-border-dark);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.25);
}

/* Responsive Glass Effects */
@media screen and (max-width: 768px) {
    :root {
        /* Reduce blur intensity on mobile for better performance */
        --glass-blur-sm: 6px;
        --glass-blur-md: 8px;
        --glass-blur-lg: 12px;
        --glass-blur-xl: 16px;
    }
}

/* Reduced Motion Accessibility */
@media (prefers-reduced-motion: reduce) {
    .station-footer,
    .departures-table tbody tr {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
}

/* High Performance Mode - Disable blur on low-end devices */
@media (prefers-reduced-transparency: reduce) {
    .station-footer::after,
    .departures-table tbody tr,
    .glass-card,
    .glass-card-dark {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(255, 255, 255, 0.95);
    }
    
    .station-footer::after {
        background: rgba(38, 50, 56, 0.95);
    }
}

/* Dark Mode Glass Adjustments */
@media (prefers-color-scheme: dark) {
    .departures-table tbody tr {
        background: linear-gradient(90deg, 
            rgba(255, 255, 255, 0.08) 0%, 
            rgba(255, 255, 255, 0.12) 50%,
            rgba(255, 255, 255, 0.08) 100%);
        border: 1px solid var(--glass-border-dark);
        border-left: none;
        border-right: none;
    }
    
    .departures-table tbody tr:nth-child(even) {
        background: linear-gradient(90deg, 
            rgba(255, 255, 255, 0.05) 0%, 
            rgba(255, 255, 255, 0.1) 50%,
            rgba(255, 255, 255, 0.05) 100%);
    }
    
    .departures-table tbody tr:hover {
        background: linear-gradient(90deg, 
            rgba(136, 187, 11, 0.15) 0%, 
            rgba(255, 255, 255, 0.15) 50%,
            rgba(136, 187, 11, 0.1) 100%);
        border: 1px solid rgba(136, 187, 11, 0.4);
        border-left: none;
        border-right: none;
    }
}

/* Enhanced Glass Shadow Effects */
.station-footer {
    box-shadow:
        0 8px 32px 0 rgba(31, 38, 135, 0.15),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.1);
}

/* Glass Shine Animation (Optional Enhancement) */
@keyframes glass-shine {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }
    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
    }
}

.station-footer:hover::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 70%
    );
    animation: glass-shine 3s ease-in-out;
    pointer-events: none;
    z-index: 2;
}

/* ============================================
   DARK MODE TOGGLE BUTTON
   ============================================ */

.dark-mode-toggle {
    background: rgba(0, 0, 0, 0.2);
    border: 1.5px solid rgba(255, 255, 255, 0.5);
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: clamp(38px, 5vmin, 44px);
    min-height: clamp(38px, 5vmin, 44px);
    color: white;
    position: relative;
}

.dark-mode-toggle:hover {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.8);
    transform: translateY(-1px);
}

.dark-mode-toggle:active {
    transform: translateY(0);
}

/* Icon styles */
.dark-mode-toggle .icon {
    font-size: 18px;
    line-height: 1;
    transition: transform 0.3s ease;
}

/* Rotate icon when toggling */
.dark-mode-toggle:active .icon {
    transform: rotate(180deg);
}

/* Tooltip */
.dark-mode-toggle::after {
    content: attr(aria-label);
    position: absolute;
    bottom: -32px;
    left: 50%;
    transform: translateX(-50%) scale(0);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 1000;
}

.dark-mode-toggle:hover::after {
    transform: translateX(-50%) scale(1);
    opacity: 1;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .dark-mode-toggle {
        padding: 5px 10px;
    }
}

@media (max-width: 480px) {
    .dark-mode-toggle {
        padding: 4px 8px;
        min-width: 38px;
        min-height: 38px;
    }
    
    .dark-mode-toggle .icon {
        font-size: 16px;
    }
}

/* Dark mode specific styles for the toggle button */
body.dark-mode .dark-mode-toggle {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

body.dark-mode .dark-mode-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
}

/* ============================================
   FAVORITE STATION BUTTON
   ============================================ */

.station-select-with-favorite {
    display: flex;
    align-items: center;
    gap: 8px;
}

.favorite-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 6px;
    padding: 6px 8px;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    opacity: 0.5;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    min-height: 38px;
    color: #FFD700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.favorite-btn:hover {
    opacity: 0.8;
    transform: scale(1.2);
    border-color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.favorite-btn.active {
    opacity: 1;
    transform: scale(1.1);
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    animation: starPulse 0.3s ease-out;
}

.favorite-btn:active {
    transform: scale(0.95);
}

@keyframes starPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.3);
    }
    100% {
        transform: scale(1.1);
    }
}

/* Favorite option styles in dropdown */
.favorite-option {
    font-weight: 700;
    background: linear-gradient(90deg, #FFF9E6 0%, #FFFFFF 100%);
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .station-select-with-favorite {
        gap: 6px;
    }

    .favorite-btn {
        font-size: 18px;
        min-width: 40px;
        min-height: 40px;
    }
}

@media (max-width: 480px) {
    .favorite-btn {
        font-size: 16px;
        min-width: 36px;
        min-height: 36px;
        padding: 4px 6px;
    }
}

/* Dark mode favorite button */
body.dark-mode .favorite-btn {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

body.dark-mode .favorite-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

body.dark-mode .favorite-btn.active {
    background: rgba(255, 215, 0, 0.2);
    border-color: #FFD700;
}

/* ============================================
   PREMIUM ANIMATIONS
   ============================================ */

/* Animated Train Icon - Moving/Shaking for Arriving Soon (< 3 min) */
.train-arriving {
    animation: trainMove 0.6s ease-in-out infinite;
    display: inline-block;
}

@keyframes trainMove {
    0%, 100% {
        transform: translateX(0) rotate(0deg);
    }
    25% {
        transform: translateX(3px) rotate(1deg);
    }
    50% {
        transform: translateX(0) rotate(0deg);
    }
    75% {
        transform: translateX(-3px) rotate(-1deg);
    }
}

/* Urgent Pulse Animation - Red Glow for Imminent Trains (< 2 min) */
.countdown-urgent {
    animation: urgentPulse 1.5s ease-in-out infinite;
    position: relative;
}

@keyframes urgentPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7),
                    0 0 10px 2px rgba(239, 68, 68, 0.3);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 20px 10px rgba(239, 68, 68, 0.2),
                    0 0 30px 15px rgba(239, 68, 68, 0.1);
        transform: scale(1.02);
    }
}

/* Warning Pulse Animation - Yellow Glow for Soon Trains (2-5 min) */
.countdown-warning {
    animation: warningPulse 2s ease-in-out infinite;
    position: relative;
}

@keyframes warningPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(234, 179, 8, 0.6),
                    0 0 8px 2px rgba(234, 179, 8, 0.3);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 15px 8px rgba(234, 179, 8, 0.2),
                    0 0 25px 12px rgba(234, 179, 8, 0.1);
        transform: scale(1.015);
    }
}

/* Train Arrived - Celebration Animation with Scale Bounce */
.train-arrived {
    animation: celebrationBounce 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
}

@keyframes celebrationBounce {
    0% {
        transform: scale(1) rotate(0deg);
    }
    25% {
        transform: scale(1.2) rotate(-5deg);
    }
    50% {
        transform: scale(1.3) rotate(5deg);
    }
    75% {
        transform: scale(1.1) rotate(-3deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
    }
}

/* Confetti Effect for Train Arrival */
.train-arrived::before,
.train-arrived::after {
    content: '🎉';
    position: absolute;
    font-size: 24px;
    animation: confettiFall 1s ease-out forwards;
    pointer-events: none;
    z-index: 10;
}

.train-arrived::before {
    left: -30px;
    top: -10px;
    animation-delay: 0s;
}

.train-arrived::after {
    right: -30px;
    top: -10px;
    animation-delay: 0.2s;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg) scale(0);
        opacity: 1;
    }
    50% {
        transform: translateY(-20px) rotate(180deg) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translateY(40px) rotate(360deg) scale(0.5);
        opacity: 0;
    }
}

/* Smooth Card Hover Effect - Lift Animation */
.card-hover {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.card-hover:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow:
        0 12px 24px -8px rgba(0, 0, 0, 0.15),
        0 8px 16px -6px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    z-index: 2;
}

.card-hover:active {
    transform: translateY(-2px) scale(1.005);
    transition: all 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Smooth Hover for Interactive Elements */
.interactive-hover {
    transition: all 0.25s ease;
    cursor: pointer;
}

.interactive-hover:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

.interactive-hover:active {
    transform: scale(0.98);
}

/* Button Ripple Effect */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-ripple:active::after {
    width: 300px;
    height: 300px;
}

/* Shimmer Loading Effect */
.shimmer-loading {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.05) 0%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0.05) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Fade In Animation */
.fade-in {
    animation: fadeIn 0.4s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slide In From Right Animation */
.slide-in-right {
    animation: slideInRight 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Pulse Animation for Notifications */
.pulse-notification {
    animation: pulseNotification 2s ease-in-out infinite;
}

@keyframes pulseNotification {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

/* Shake Animation for Errors */
.shake-error {
    animation: shakeError 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes shakeError {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-8px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(8px);
    }
}

/* Glow Effect for Active Elements */
.glow-active {
    animation: glowActive 2s ease-in-out infinite;
}

@keyframes glowActive {
    0%, 100% {
        box-shadow: 0 0 5px rgba(136, 187, 11, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(136, 187, 11, 0.8),
                    0 0 30px rgba(136, 187, 11, 0.4);
    }
}

/* Rotate Animation for Refresh Icons */
.rotate-refresh {
    animation: rotateRefresh 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes rotateRefresh {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Bounce Animation for Success */
.bounce-success {
    animation: bounceSuccess 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes bounceSuccess {
    0%, 100% {
        transform: translateY(0);
    }
    25% {
        transform: translateY(-15px);
    }
    50% {
        transform: translateY(-7px);
    }
    75% {
        transform: translateY(-12px);
    }
}

/* Dark Mode Specific Animation Adjustments */
body.dark-mode .countdown-urgent {
    animation: urgentPulseDark 1.5s ease-in-out infinite;
}

@keyframes urgentPulseDark {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.8),
                    0 0 15px 3px rgba(248, 113, 113, 0.4);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 25px 12px rgba(248, 113, 113, 0.3),
                    0 0 35px 18px rgba(248, 113, 113, 0.15);
        transform: scale(1.02);
    }
}

body.dark-mode .countdown-warning {
    animation: warningPulseDark 2s ease-in-out infinite;
}

@keyframes warningPulseDark {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(250, 204, 21, 0.7),
                    0 0 12px 3px rgba(250, 204, 21, 0.4);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 20px 10px rgba(250, 204, 21, 0.3),
                    0 0 30px 15px rgba(250, 204, 21, 0.15);
        transform: scale(1.015);
    }
}

body.dark-mode .card-hover:hover {
    box-shadow:
        0 12px 24px -8px rgba(0, 0, 0, 0.3),
        0 8px 16px -6px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.15);
}

body.dark-mode .glow-active {
    animation: glowActiveDark 2s ease-in-out infinite;
}

@keyframes glowActiveDark {
    0%, 100% {
        box-shadow: 0 0 8px rgba(163, 230, 53, 0.6);
    }
    50% {
        box-shadow: 0 0 25px rgba(163, 230, 53, 0.9),
                    0 0 40px rgba(163, 230, 53, 0.5);
    }
}

/* Reduced Motion Support - Respect User Preferences */
@media (prefers-reduced-motion: reduce) {
    .train-arriving,
    .countdown-urgent,
    .countdown-warning,
    .train-arrived,
    .card-hover,
    .interactive-hover,
    .shimmer-loading,
    .pulse-notification,
    .glow-active,
    .rotate-refresh,
    .bounce-success {
        animation: none !important;
        transition: none !important;
    }

    .card-hover:hover {
        transform: none;
    }

    .train-arrived::before,
    .train-arrived::after {
        display: none;
    }
}

/* ============================================
   JOURNEY PLANNER STYLES
   ============================================ */

/* Planner Button in Header */
.planner-btn {
    width: clamp(36px, 5vmin, 48px);
    height: clamp(36px, 5vmin, 48px);
    aspect-ratio: 1 / 1;
    border-radius: var(--border-radius-lg);
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.planner-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.planner-btn:active {
    transform: translateY(0);
}

.planner-btn .icon {
    font-size: clamp(18px, 2.5vmin, 24px);
}

/* Map Button in Header (same style as planner) */
.map-btn {
    width: clamp(36px, 5vmin, 48px);
    height: clamp(36px, 5vmin, 48px);
    aspect-ratio: 1 / 1;
    border-radius: var(--border-radius-lg);
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.map-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.map-btn:active {
    transform: translateY(0);
}

.map-btn .icon {
    font-size: clamp(18px, 2.5vmin, 24px);
}

/* Planner Modal */
.planner-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.planner-modal.active {
    opacity: 1;
    visibility: visible;
}

.planner-modal-content {
    background: var(--color-bg-card);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-xl);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9) translateY(20px);
    transition: transform var(--transition-base);
}

.planner-modal.active .planner-modal-content {
    transform: scale(1) translateY(0);
}

.planner-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-lg);
    border-bottom: 2px solid var(--color-border);
    background: linear-gradient(135deg, var(--fgc-green) 0%, var(--fgc-green-dark) 100%);
    border-radius: var(--border-radius-xl) var(--border-radius-xl) 0 0;
}

.planner-title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: white;
    margin: 0;
}

.planner-close {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    font-size: 28px;
    color: white;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.planner-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.planner-form {
    padding: var(--spacing-xl);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.planner-form-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.planner-label {
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
}

.planner-select {
    width: 100%;
    padding: var(--spacing-md);
    font-size: var(--font-size-md);
    font-family: inherit;
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius-md);
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.planner-select:hover {
    border-color: var(--fgc-green);
}

.planner-select:focus {
    outline: none;
    border-color: var(--fgc-green);
    box-shadow: 0 0 0 3px var(--fgc-green-glow);
}

.planner-time-options {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.planner-radio-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.planner-radio-label:hover {
    background: var(--color-overlay);
}

.planner-radio-label input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.planner-time-input {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-md);
    font-family: inherit;
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius-md);
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
    transition: all var(--transition-fast);
    flex: 1;
}

.planner-time-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.planner-time-input:focus {
    outline: none;
    border-color: var(--fgc-green);
    box-shadow: 0 0 0 3px var(--fgc-green-glow);
}

.planner-submit {
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    background: linear-gradient(135deg, var(--fgc-green) 0%, var(--fgc-green-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-md);
}

.planner-submit:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.planner-submit:active {
    transform: translateY(0);
}

.planner-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Planner Results */
.planner-results {
    padding: var(--spacing-xl);
    border-top: 2px solid var(--color-border);
    animation: fadeIn var(--transition-base);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.planner-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    padding: var(--spacing-xl);
    color: var(--color-text-secondary);
}

.planner-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-xl);
    text-align: center;
}

.planner-error .error-icon {
    font-size: var(--font-size-xl);
}

.planner-no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-xl);
    text-align: center;
    color: var(--color-text-secondary);
}

.planner-no-results .empty-icon {
    font-size: var(--font-size-xl);
}

.journey-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-md);
    background: var(--color-overlay);
    border-radius: var(--border-radius-md);
}

.journey-stat {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.stat-label {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    font-weight: var(--font-weight-medium);
}

.stat-value {
    font-size: var(--font-size-lg);
    color: var(--color-text-primary);
    font-weight: var(--font-weight-bold);
}

.journey-section-title {
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-md);
}

.journey-departures {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.journey-departure {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: var(--spacing-md);
    align-items: center;
    padding: var(--spacing-md);
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-md);
    transition: all var(--transition-fast);
    animation: slideIn var(--transition-base) ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.journey-departure:hover {
    background: var(--color-overlay);
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.journey-dep-line {
    display: flex;
    align-items: center;
}

.journey-dep-time {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.time-main {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    font-family: 'Roboto Mono', monospace;
    color: var(--color-text-primary);
}

.journey-dep-dest {
    font-size: var(--font-size-md);
    color: var(--color-text-secondary);
    text-align: right;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .planner-modal {
        padding: 0;
    }

    .planner-modal-content {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .planner-header {
        border-radius: 0;
    }

    .journey-info {
        grid-template-columns: 1fr;
    }

    .journey-departure {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
    }

    .journey-dep-dest {
        text-align: left;
    }
}

/* Dark Mode Adjustments */
body.dark-mode .planner-modal-content {
    background: var(--color-bg-card);
}

body.dark-mode .planner-select,
body.dark-mode .planner-time-input {
    background: var(--color-bg-dark);
    border-color: var(--color-border);
}

body.dark-mode .journey-departure {
    background: var(--color-bg-dark);
    border-color: var(--color-border);
}

body.dark-mode .journey-departure:hover {
    background: var(--color-bg-secondary);
}

/* ============================================
   SHARE FUNCTIONALITY
   ============================================ */

/* Share Button */
.share-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-sm) var(--spacing-md);
    color: white;
    font-size: var(--font-size-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: clamp(40px, 5vmin, 60px);
    min-height: clamp(40px, 5vmin, 60px);
}

.share-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.share-btn:active {
    transform: translateY(0);
}

.share-btn .icon {
    font-size: var(--font-size-xl);
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: var(--spacing-lg);
    animation: fadeIn var(--transition-fast);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Modal Content */
.modal-content {
    background: var(--color-bg-card);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-xl);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp var(--transition-base);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Modal Header */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--color-border);
}

.modal-title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: var(--font-size-xl);
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: var(--spacing-sm);
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.modal-close:hover {
    background: var(--color-overlay);
    color: var(--color-text-primary);
}

/* Modal Body */
.modal-body {
    padding: var(--spacing-lg);
}

.share-description {
    margin: 0 0 var(--spacing-lg) 0;
    color: var(--color-text-secondary);
    font-size: var(--font-size-md);
    text-align: center;
}

/* Share Options */
.share-options {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.share-option-btn {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--color-bg-secondary);
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
}

.share-option-btn:hover {
    background: var(--color-overlay);
    border-color: var(--fgc-green);
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.share-option-btn:active {
    transform: translateX(2px);
}

.share-icon {
    font-size: var(--font-size-xl);
    flex-shrink: 0;
}

.share-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.share-label {
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
}

.share-sublabel {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
}

/* QR Code Container */
.qr-code-container {
    margin-top: var(--spacing-lg);
    padding: var(--spacing-lg);
    background: var(--color-bg-secondary);
    border-radius: var(--border-radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
    animation: slideDown var(--transition-base);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#qrCodeCanvas {
    border: 4px solid white;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-md);
}

.qr-code-url {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    word-break: break-all;
    text-align: center;
    margin: 0;
    padding: var(--spacing-sm);
    background: white;
    border-radius: var(--border-radius-sm);
}

/* Share Success Message */
.share-success {
    margin-top: var(--spacing-lg);
    padding: var(--spacing-md);
    background: var(--status-on-time-bg);
    border: 2px solid var(--status-on-time);
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    animation: bounceIn var(--transition-bounce);
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

.success-icon {
    font-size: var(--font-size-xl);
    color: var(--status-on-time);
}

.success-text {
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    color: var(--status-on-time);
}

/* Dark Mode Adjustments */
body.dark-mode .modal-content {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
}

body.dark-mode .share-option-btn {
    background: var(--color-bg-dark);
}

body.dark-mode .qr-code-container {
    background: var(--color-bg-dark);
}

body.dark-mode .qr-code-url {
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .modal-content {
        max-width: 95vw;
        margin: var(--spacing-md);
    }

    .modal-header {
        padding: var(--spacing-md);
    }

    .modal-body {
        padding: var(--spacing-md);
    }

    .share-option-btn {
        padding: var(--spacing-md);
    }

    #qrCodeCanvas {
        max-width: 180px;
        height: auto;
    }
}

@media (max-width: 480px) {
    .modal-title {
        font-size: var(--font-size-lg);
    }

    .share-icon {
        font-size: var(--font-size-lg);
    }

    .share-label {
        font-size: var(--font-size-sm);
    }

    .share-sublabel {
        font-size: var(--font-size-xs);
    }

    #qrCodeCanvas {
        max-width: 160px;
    }
}

/* ============================================
   MULTI-STATION COMPARISON FEATURE
   ============================================ */

/* Compare Button */
.compare-btn {
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid rgba(136, 187, 11, 0.3);
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #88BB0B;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.compare-btn:hover {
    background: #88BB0B;
    color: white;
    border-color: #88BB0B;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(136, 187, 11, 0.3);
}

.compare-btn:active {
    transform: translateY(0);
}

.compare-btn svg {
    width: 20px;
    height: 20px;
}

/* Station Select with Favorite Layout */
.station-select-with-favorite {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Comparison Modal Styles */
.compare-modal {
    max-width: 600px;
    width: 90vw;
}

.compare-description {
    color: var(--color-text-secondary);
    font-size: var(--font-size-md);
    margin-bottom: var(--spacing-lg);
    text-align: center;
}

.compare-selector {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

/* Selected Stations List */
.compare-stations-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    min-height: 100px;
}

.compare-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100px;
    color: var(--color-text-light);
    font-size: var(--font-size-md);
    border: 2px dashed var(--color-border);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-lg);
}

.compare-station-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--color-bg-secondary);
    border-radius: var(--border-radius-md);
    border-left-width: 4px;
    border-left-style: solid;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    animation: slideInRight 0.3s ease;
}

.compare-station-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateX(4px);
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.compare-station-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
}

.compare-station-name {
    flex: 1;
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
    font-size: var(--font-size-md);
}

.compare-station-remove {
    background: none;
    border: none;
    color: var(--color-text-light);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--border-radius-sm);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.compare-station-remove:hover {
    background: rgba(211, 47, 47, 0.1);
    color: #D32F2F;
}

/* Add Station Controls */
.compare-add-station {
    display: flex;
    gap: var(--spacing-sm);
}

.compare-station-select {
    flex: 1;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius-md);
    font-size: var(--font-size-md);
    font-family: inherit;
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.compare-station-select:focus {
    outline: none;
    border-color: var(--fgc-green);
    box-shadow: 0 0 0 3px rgba(136, 187, 11, 0.1);
}

.compare-add-btn {
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--fgc-green);
    color: white;
    border: none;
    border-radius: var(--border-radius-md);
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.compare-add-btn:hover:not(:disabled) {
    background: var(--fgc-green-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.compare-add-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Comparison Actions */
.compare-actions {
    display: flex;
    justify-content: center;
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--color-border);
}

.compare-start-btn {
    padding: var(--spacing-md) var(--spacing-xl);
    background: var(--fgc-green);
    color: white;
    border: none;
    border-radius: var(--border-radius-lg);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
}

.compare-start-btn:hover:not(:disabled) {
    background: var(--fgc-green-dark);
    transform: translateY(-2px) scale(1.02);
    box-shadow: var(--shadow-lg);
}

.compare-start-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Multi-Station View Container */
.multi-station-view {
    min-height: 100vh;
    padding: var(--spacing-lg);
    background: var(--color-bg-primary);
}

.multi-station-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-lg);
    background: var(--color-bg-secondary);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
}

.multi-station-title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    margin: 0;
}

.exit-compare-btn {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--color-bg-primary);
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius-md);
    color: var(--color-text-secondary);
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    transition: all 0.2s ease;
}

.exit-compare-btn:hover {
    border-color: #D32F2F;
    color: #D32F2F;
    background: rgba(211, 47, 47, 0.05);
}

.exit-compare-btn svg {
    width: 16px;
    height: 16px;
}

/* Mobile Tabs */
.multi-station-tabs {
    display: none;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-lg);
    overflow-x: auto;
    padding-bottom: var(--spacing-xs);
}

.multi-station-tab {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--color-bg-secondary);
    border: none;
    border-bottom-width: 3px;
    border-bottom-style: solid;
    border-radius: var(--border-radius-md) var(--border-radius-md) 0 0;
    color: var(--color-text-primary);
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    opacity: 0.6;
}

.multi-station-tab.active {
    opacity: 1;
    background: var(--color-bg-card);
    box-shadow: var(--shadow-sm);
}

.tab-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Station Grid */
.multi-station-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-lg);
}

@media (min-width: 768px) {
    .multi-station-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1200px) {
    .multi-station-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 1400px) and (max-width: 1799px) {
    .multi-station-grid.has-3-stations {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Station Column */
.station-column {
    display: none;
    background: var(--color-bg-secondary);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: all 0.3s ease;
    animation: fadeInUp 0.5s ease;
}

.station-column.active {
    display: block;
}

@media (min-width: 768px) {
    .station-column {
        display: block;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.station-column:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* Station Column Header */
.station-column-header {
    padding: var(--spacing-lg);
    color: white;
    position: relative;
    overflow: hidden;
}

.station-column-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    pointer-events: none;
}

.station-column-color {
    width: 24px;
    height: 4px;
    border-radius: 2px;
    margin-bottom: var(--spacing-sm);
}

.station-column-name {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    margin: 0 0 var(--spacing-xs) 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.station-column-count {
    font-size: var(--font-size-sm);
    opacity: 0.9;
    font-weight: var(--font-weight-medium);
}

/* Station Column Body */
.station-column-body {
    padding: var(--spacing-md);
    max-height: 600px;
    overflow-y: auto;
}

.station-column-body::-webkit-scrollbar {
    width: 6px;
}

.station-column-body::-webkit-scrollbar-track {
    background: var(--color-bg-primary);
    border-radius: 3px;
}

.station-column-body::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 3px;
}

.station-column-body::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-light);
}

/* Comparison Departure Item */
.comparison-departure-item {
    background: var(--color-bg-card);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    border: 1px solid var(--color-border-light);
    transition: all 0.2s ease;
    animation: slideInUp 0.3s ease;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.comparison-departure-item:hover {
    box-shadow: var(--shadow-sm);
    transform: translateX(4px);
    border-color: var(--color-border);
}

.comparison-departure-item:last-child {
    margin-bottom: 0;
}

.comp-dep-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
}

.comp-dep-time {
    font-family: 'Roboto Mono', monospace;
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
}

.comp-dep-destination {
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-sm);
}

.comp-dep-destination.cancelled {
    text-decoration: line-through;
    opacity: 0.6;
}

.comp-dep-footer {
    display: flex;
    justify-content: flex-start;
}

/* Empty States */
.station-no-departures,
.station-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl);
    text-align: center;
    color: var(--color-text-light);
    min-height: 200px;
}

.station-no-departures .empty-icon,
.station-error .error-icon {
    font-size: 48px;
    margin-bottom: var(--spacing-md);
    opacity: 0.5;
}

.station-error {
    color: #D32F2F;
}

/* Loading Spinner for Comparison */
.loading-spinner-small {
    width: 24px;
    height: 24px;
    border: 3px solid var(--color-border);
    border-top-color: var(--fgc-green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--spacing-md);
}

/* Responsive Adjustments */
@media (max-width: 767px) {
    .multi-station-tabs {
        display: flex;
    }

    .multi-station-grid {
        grid-template-columns: 1fr;
    }

    .station-column {
        display: none;
    }

    .station-column.active {
        display: block;
    }

    .multi-station-header {
        flex-direction: column;
        gap: var(--spacing-md);
        text-align: center;
    }

    .multi-station-title {
        font-size: var(--font-size-lg);
    }

    .compare-modal {
        width: 95vw;
        max-width: none;
    }

    .compare-add-station {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .compare-btn {
        width: 36px;
        height: 36px;
    }

    .compare-btn svg {
        width: 18px;
        height: 18px;
    }

    .station-select-with-favorite {
        gap: 6px;
    }

    .multi-station-view {
        padding: var(--spacing-sm);
    }

    .comparison-departure-item {
        padding: var(--spacing-sm);
    }

    .comp-dep-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-xs);
    }
}

/* Dark Mode Adjustments */
body.dark-mode .compare-btn {
    background: rgba(22, 33, 62, 0.95);
    border-color: rgba(136, 187, 11, 0.3);
}

body.dark-mode .compare-btn:hover {
    background: #88BB0B;
}

body.dark-mode .comparison-departure-item {
    background: var(--color-bg-dark);
    border-color: var(--color-border);
}

body.dark-mode .comparison-departure-item:hover {
    background: var(--color-bg-secondary);
}

