/* ==========================================================================
   RAILBHARAT V3 - PREMIUM NTES & ENQUIRY EXPERIENCE
   iOS 18 + Material 3 Fusion | Advanced Rail Intelligence
   ========================================================================== */

/* ==========================================================================
   SPLASH SCREEN - Animated Steam Engine Logo
   ========================================================================== */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #f5f5f5 0%, #e8e8e8 50%, #d5d5d5 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

body.dark .splash-screen {
    background: linear-gradient(180deg, #1C1C1E 0%, #2C2C2E 50%, #1a1a1a 100%);
}

.splash-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.splash-content {
    text-align: center;
    animation: splashFadeIn 0.8s ease-out;
}

@keyframes splashFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.splash-logo {
    margin-bottom: -15px;
}

.splash-train-img {
    width: 280px;
    height: auto;
    max-width: 90vw;
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.15));
}

.splash-title {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
    font-size: 42px;
    font-weight: 800;
    margin: 0 0 8px 0;
    letter-spacing: -1px;
}

.splash-tagline {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
    font-size: 13px;
    color: #666;
    margin: 15px 0 0 0;
    letter-spacing: 1px;
}

body.dark .splash-tagline {
    color: #8E8E93;
}

.splash-loader {
    width: 200px;
    height: 4px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    margin: 0 auto;
    overflow: hidden;
}

body.dark .splash-loader {
    background: rgba(255, 255, 255, 0.1);
}

.splash-loader-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #FF6B35, #FF9933, #138808);
    border-radius: 4px;
    animation: splashLoaderProgress 2s ease-out forwards;
}

@keyframes splashLoaderProgress {
    0% {
        width: 0%;
    }

    20% {
        width: 30%;
    }

    50% {
        width: 60%;
    }

    80% {
        width: 85%;
    }

    100% {
        width: 100%;
    }
}

/* ==========================================================================
   END SPLASH SCREEN
   ========================================================================== */

:root {
    /* --- COLOR PALETTE (iOS 18 / Material 3 Style) --- */
    --ios-blue: #007AFF;
    --ios-blue-light: rgba(0, 122, 255, 0.12);
    --ios-green: #34C759;
    --ios-green-light: rgba(52, 199, 89, 0.12);
    --ios-red: #FF3B30;
    --ios-red-light: rgba(255, 59, 48, 0.12);
    --ios-orange: #FF9500;
    --ios-orange-light: rgba(255, 149, 0, 0.12);
    --ios-purple: #AF52DE;
    --ios-purple-light: rgba(175, 82, 222, 0.12);
    --ios-indigo: #5856D6;

    /* --- THEME COLORS (Day) --- */
    --bg-primary: #F2F2F7;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #E5E5EA;
    /* Glass Effects - Enhanced */
    --glass-bg: rgba(255, 255, 255, 0.3);
    --glass-bg-heavy: rgba(255, 255, 255, 0.5);
    --glass-bg-light: rgba(255, 255, 255, 0.2);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-blur: blur(20px);
    --glass-blur-heavy: blur(40px);
    --text-primary: #1C1C1E;
    --text-secondary: #8E8E93;
    --text-tertiary: #C7C7CC;

    /* --- SYSTEM LAYOUT --- */
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-full: 999px;

    /* --- SHADOWS --- */
    /* Enhanced Shadows with Glass Effect */
    --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(255, 255, 255, 0.15) inset;
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(255, 255, 255, 0.2) inset;

    /* --- ANIMATIONS (Flutter-inspired Curves) --- */
    --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --duration-fast: 200ms;
    --duration-normal: 400ms;

    /* --- PREMIUM DESIGN TOKENS --- */
    --grad-indigo: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --grad-emerald: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
    --grad-sunset: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    --grad-ocean: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
    --premium-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body.dark {
    --bg-primary: #000000;
    --bg-secondary: #1C1C1E;
    --bg-tertiary: #2C2C2E;
    --glass-bg: rgba(28, 28, 30, 0.4);
    --glass-bg-heavy: rgba(28, 28, 30, 0.6);
    --glass-bg-light: rgba(28, 28, 30, 0.25);
    --glass-border: rgba(255, 255, 255, 0.12);
    --text-primary: #FFFFFF;
    --text-secondary: #AEAEB2;
    --text-tertiary: #48484A;

    /* --- DARK MODE PREMIUM --- */
    --glass-bg-premium: rgba(28, 28, 30, 0.8);
    --glass-border-premium: rgba(255, 255, 255, 0.1);

    /* --- STATUS COLORS --- */
    --status-avl: #34c759;
    --status-rac: #ffcc00;
    --status-wl: #ff9500;
    --status-regret: #ff3b30;
    --status-day-bg: rgba(0, 122, 255, 0.1);
    --status-day-color: #007aff;

    --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
    background: transparent;
    /* Changed to transparent to show mesh gradients */
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    position: relative;
}

/* Base background color layer */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -3;
    background: var(--bg-primary);
}

/* Vibrant Mesh Background for Glassmorphism */
.glass-bg-mesh {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    z-index: -2;
    background: radial-gradient(circle at center, var(--ios-blue) 0%, transparent 50%),
        radial-gradient(circle at 20% 30%, var(--ios-purple) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, var(--ios-orange) 0%, transparent 40%),
        radial-gradient(circle at 70% 20%, var(--ios-green) 0%, transparent 40%),
        radial-gradient(circle at 30% 80%, var(--ios-red) 0%, transparent 40%);
    filter: blur(100px);
    opacity: 0.25;
    animation: meshRotate 40s linear infinite;
    pointer-events: none;
}

body.dark .glass-bg-mesh {
    opacity: 0.3;
    /* Increased for more vibrancy in dark mode */
}

@keyframes meshRotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Glass Blobs for extra depth */
.glass-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.glass-blob {
    position: absolute;
    width: 300px;
    height: 300px;
    background: var(--grad-indigo);
    filter: blur(100px);
    border-radius: 50%;
    opacity: 0.15;
    animation: blobFloat 25s infinite alternate ease-in-out;
}

.glass-blob-2 {
    width: 400px;
    height: 400px;
    background: var(--grad-sunset);
    right: -100px;
    top: 20%;
    animation-delay: -5s;
}

.glass-blob-3 {
    width: 350px;
    height: 350px;
    background: var(--grad-emerald);
    left: 10%;
    bottom: -50px;
    animation-delay: -12s;
}

@keyframes blobFloat {
    from {
        transform: translate(0, 0) scale(1);
    }

    to {
        transform: translate(100px, 100px) scale(1.2);
    }
}

#app {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.ios-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 60px 24px 16px;
    background: var(--glass-bg-heavy);
    backdrop-filter: var(--glass-blur-heavy) saturate(180%);
    -webkit-backdrop-filter: var(--glass-blur-heavy) saturate(180%);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ios-header h1 {
    font-size: 24px;
    font-weight: 800;
    margin: 0;
    display: flex;
    align-items: center;
}

/* Branded Text - RailBharat with Shine Effect */
.brand-rail {
    background: linear-gradient(90deg,
            #FF6B35 0%,
            #FF6B35 40%,
            #FFFFFF 50%,
            #FF6B35 60%,
            #FF6B35 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
    animation: brandShine 3s ease-in-out infinite;
}

.brand-bharat {
    background: linear-gradient(90deg,
            #138808 0%,
            #138808 40%,
            #FFFFFF 50%,
            #138808 60%,
            #138808 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
    animation: brandShine 3s ease-in-out infinite;
    animation-delay: 0.5s;
}

@keyframes brandShine {
    0% {
        background-position: 100% 50%;
    }

    100% {
        background-position: -100% 50%;
    }
}

/* Header train icons */
.header-train-icon-left,
.header-train-icon-right {
    font-size: 20px;
    color: #FF6B35;
    display: inline-block !important;
    visibility: visible !important;
}

.header-train-icon-left {
    margin-right: 8px;
}

.header-train-icon-right {
    margin-left: 8px;
    transform: scaleX(-1);
    color: #138808;
}

#header-title {
    display: flex !important;
    align-items: center !important;
}

/* Header train icon (legacy) */
.header-train-icon {
    display: inline-block;
    margin-right: 4px;
    animation: trainShakeHeader 0.5s ease-in-out infinite;
}

@keyframes trainShakeHeader {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(1px);
    }

    75% {
        transform: translateX(-1px);
    }
}

/* Dark mode brand colors */
body.dark .brand-rail {
    background: linear-gradient(90deg,
            #FF8C5A 0%,
            #FF8C5A 40%,
            #FFFFFF 50%,
            #FF8C5A 60%,
            #FF8C5A 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.dark .brand-bharat {
    background: linear-gradient(90deg,
            #2ECC71 0%,
            #2ECC71 40%,
            #FFFFFF 50%,
            #2ECC71 60%,
            #2ECC71 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Page Footer Logo */
.page-footer-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px 110px 20px;
    margin-top: 20px;
}

.page-footer-logo img {
    width: 120px;
    height: auto;
    margin-bottom: -15px;
    opacity: 0.8;
}

.page-footer-logo .footer-brand {
    font-size: 20px;
    font-weight: 800;
}

.page-footer-logo .footer-tagline {
    font-size: 10px;
    color: var(--text-tertiary);
    margin-top: 4px;
    letter-spacing: 1px;
}

.header-right {
    display: flex;
    gap: 12px;
}

.header-btn,
.glass-btn-v3,
.action-btn {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
}

.header-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
}

/* Language Button */
.lang-btn {
    width: auto;
    padding: 0 12px;
    border-radius: 20px;
    gap: 6px;
    font-size: 14px;
}

.lang-btn span {
    font-size: 12px;
    font-weight: 700;
    color: var(--ios-blue);
}

/* Language Modal */
.language-modal {
    background: var(--bg-secondary);
    border-radius: 20px;
    width: 90%;
    max-width: 380px;
    max-height: 80vh;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.language-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--glass-border);
}

.language-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.language-modal-header h3 i {
    color: var(--ios-blue);
}

.language-list {
    max-height: 50vh;
    overflow-y: auto;
    padding: 8px 0;
}

.language-item {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    cursor: pointer;
    transition: background 0.2s;
}

.language-item:hover {
    background: var(--bg-tertiary);
}

.language-item.selected {
    background: var(--ios-blue-light);
}

.lang-name {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.lang-native {
    font-size: 14px;
    color: var(--text-secondary);
    margin-right: 12px;
}

.lang-check {
    color: var(--ios-green);
    font-size: 16px;
    opacity: 0;
    transition: opacity 0.2s;
}

.language-item.selected .lang-check {
    opacity: 1;
}

.language-modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--glass-border);
    text-align: center;
}

.language-modal-footer p {
    margin: 0;
    font-size: 12px;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* ==================== About Modal ==================== */
#about-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

#about-modal.active {
    display: flex;
}

.about-modal-content {
    background: var(--glass-bg);
    border-radius: 20px;
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.about-modal-header {
    padding: 30px 24px 20px;
    text-align: center;
    background: linear-gradient(135deg, var(--primary-color), #5856D6);
    color: white;
    position: relative;
}

.about-modal-header .modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.about-modal-header .modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.about-logo {
    width: 70px;
    height: 70px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 32px;
    overflow: hidden;
}

.about-logo img {
    width: 80px;
    height: 80px;
}

.about-modal-header h2 {
    margin: 0 0 8px;
    font-size: 28px;
    font-weight: 700;
    display: flex;
    justify-content: center;
}

.about-tagline {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
}

.about-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

.about-section {
    margin-bottom: 24px;
}

.about-section:last-child {
    margin-bottom: 0;
}

.about-section h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.about-section h3 i {
    color: var(--primary-color);
    font-size: 14px;
}

.about-features {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.about-features li {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--card-bg);
    border-radius: 10px;
}

.about-features li i {
    color: var(--primary-color);
    font-size: 12px;
    width: 16px;
}

.about-sources {
    list-style: none;
    padding: 0;
    margin: 8px 0 0;
}

.about-sources li {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 6px 0;
    padding-left: 20px;
    position: relative;
}

.about-sources li::before {
    content: '•';
    position: absolute;
    left: 6px;
    color: var(--primary-color);
}

.about-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

.disclaimer-section {
    background: rgba(255, 149, 0, 0.1);
    padding: 16px;
    border-radius: 12px;
    border-left: 4px solid #FF9500;
}

.disclaimer-section h3 {
    color: #FF9500;
}

.disclaimer-section h3 i {
    color: #FF9500;
}

.about-disclaimer {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 10px;
}

.about-disclaimer:last-child {
    margin-bottom: 0;
}

.about-disclaimer strong {
    color: var(--text-primary);
}

.about-disclaimer a {
    color: var(--primary-color);
    text-decoration: none;
}

.about-disclaimer a:hover {
    text-decoration: underline;
}

.about-modal-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--glass-border);
    text-align: center;
    background: var(--card-bg);
}

.about-copyright {
    margin-bottom: 16px;
}

.about-copyright p {
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary);
}

.about-version {
    font-size: 11px !important;
    color: var(--text-tertiary) !important;
    margin-top: 4px !important;
}

.about-links {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 16px;
}

.about-link {
    font-size: 12px;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: var(--glass-bg);
    border-radius: 20px;
    transition: all 0.2s ease;
}

.about-link:hover {
    background: var(--primary-color);
    color: white;
}

.about-made-with {
    font-size: 12px;
    color: var(--text-tertiary);
    margin: 0;
}

/* Gray gradient for About card */
.gray-grad {
    background: linear-gradient(135deg, #8E8E93, #636366);
}

/* Red gradient for News card */
.red-grad {
    background: linear-gradient(135deg, #FF3B30, #FF6B6B);
}

/* About card special styling */
.about-card {
    grid-column: span 2;
    flex-direction: row !important;
    justify-content: flex-start !important;
    padding: 16px 20px !important;
}

.about-card .card-icon-wrapper {
    margin-bottom: 0 !important;
    margin-right: 16px;
}

.about-card .card-icon {
    width: 44px;
    height: 44px;
}

.about-card .card-icon i {
    font-size: 20px;
}

.about-card span {
    font-size: 15px;
}

.about-card small {
    margin-left: auto;
    color: var(--text-tertiary);
}

/* ==================== Railway News Section ==================== */
.news-header-card {
    background: linear-gradient(135deg, #FF3B30, #FF6B6B);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
}

.news-header-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.news-header-content>i {
    font-size: 32px;
    opacity: 0.9;
}

.news-header-text h3 {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 600;
}

.news-header-text p {
    margin: 0;
    font-size: 13px;
    opacity: 0.9;
}

.news-refresh-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.news-refresh-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(180deg);
}

.news-refresh-btn.loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

/* News Filter Tabs */
.news-filter-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
}

.news-tab {
    padding: 10px 16px;
    border-radius: 20px;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.news-tab i {
    font-size: 12px;
}

.news-tab:hover {
    background: var(--glass-bg);
}

.news-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* News Loading State */
.news-loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.news-loading-spinner {
    font-size: 40px;
    color: var(--primary-color);
    margin-bottom: 16px;
}

.news-loading p {
    margin: 0;
    font-size: 14px;
}

/* News List */
.news-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* News Item Card */
.news-item {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
    border-radius: 16px;
    padding: 16px;
    transition: all 0.2s ease;
}

.news-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.news-item-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.news-type-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.news-type-badge.cancelled {
    background: rgba(255, 59, 48, 0.15);
    color: #FF3B30;
}

.news-type-badge.diverted {
    background: rgba(255, 149, 0, 0.15);
    color: #FF9500;
}

.news-type-badge.rescheduled {
    background: rgba(88, 86, 214, 0.15);
    color: #5856D6;
}

.news-type-badge.delayed {
    background: rgba(255, 204, 0, 0.15);
    color: #CC9900;
}

.news-type-badge.restored {
    background: rgba(52, 199, 89, 0.15);
    color: #34C759;
}

.news-type-badge.general {
    background: rgba(0, 122, 255, 0.15);
    color: #007AFF;
}

.news-item-title {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

.news-item-body {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
}

.news-item-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-tertiary);
    padding-top: 12px;
    border-top: 1px solid var(--glass-border);
}

.news-item-date {
    display: flex;
    align-items: center;
    gap: 6px;
}

.news-item-source {
    display: flex;
    align-items: center;
    gap: 6px;
}

.news-affected-trains {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.affected-train-chip {
    padding: 4px 10px;
    background: var(--glass-bg);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
}

/* News Empty State */
.news-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.news-empty i {
    font-size: 60px;
    color: #34C759;
    margin-bottom: 20px;
}

.news-empty h4 {
    margin: 0 0 8px;
    font-size: 18px;
    color: var(--text-primary);
}

.news-empty p {
    margin: 0;
    font-size: 14px;
}

/* News Sources Card */
.news-sources-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    margin-top: 20px;
    border: 1px solid var(--glass-border);
}

.news-sources-card h4 {
    margin: 0 0 16px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.news-sources-card h4 i {
    color: var(--primary-color);
}

.news-source-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.news-source-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--glass-bg);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.news-source-link:hover {
    background: var(--primary-color);
    color: white;
}

.news-source-link>i:first-child {
    width: 24px;
    text-align: center;
    font-size: 16px;
}

.news-source-link span {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
}

.news-source-link>i:last-child {
    font-size: 12px;
    opacity: 0.6;
}

/* Disclaimer Badge */
.disclaimer-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.disclaimer-badge:hover {
    background: var(--ios-orange-light);
}

.disclaimer-badge i:first-child {
    color: var(--ios-orange);
    font-size: 16px;
}

.disclaimer-badge span {
    flex: 1;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.disclaimer-badge i:last-child {
    color: var(--text-tertiary);
    font-size: 12px;
}

/* Hide Google Translate Banner and prevent it from blocking clicks */
.goog-te-banner-frame,
.skiptranslate,
#goog-gt-tt,
.goog-te-balloon-frame,
.goog-te-gadget,
#google_translate_element,
iframe.goog-te-menu-frame,
.goog-te-menu-frame {
    display: none !important;
    pointer-events: none !important;
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    left: -9999px !important;
    visibility: hidden !important;
}

/* Prevent Google Translate iframe overlay */
body>iframe,
body>.skiptranslate {
    display: none !important;
    pointer-events: none !important;
}

body {
    top: 0 !important;
    position: relative !important;
}

.goog-text-highlight {
    background: none !important;
    box-shadow: none !important;
}

main {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px 100px;
}

.view {
    display: none;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    will-change: transform, opacity;
}

.view.active {
    display: block;
    animation: fade-up 0.35s var(--ease-smooth) forwards;
}

@keyframes fade-up {
    from {
        opacity: 0;
        transform: translate3d(0, 15px, 0);
    }

    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

/* --- DASHBOARD --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.menu-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.05);
    border: 1px solid var(--glass-border);
    cursor: pointer;
    position: relative;
    transition: all 0.3s var(--ease-spring);
    z-index: 1;
    pointer-events: auto;
}

body.dark .menu-card {
    background: rgba(44, 44, 46, 0.6);
}

.menu-card:hover {
    background: var(--glass-bg-heavy);
    box-shadow: 0 20px 60px rgba(0, 122, 255, 0.2),
        0 0 0 2px rgba(255, 255, 255, 0.3) inset;
    transform: translateY(-8px) scale(1.03);
}

.menu-card:active {
    transform: scale(0.98);
}

/* Menu Info Button */
.menu-info-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 1px solid var(--glass-border);
    color: var(--text-tertiary);
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 2;
}

.menu-info-btn:hover {
    background: var(--ios-blue);
    color: white;
    border-color: var(--ios-blue);
}

.card-icon-wrapper {
    display: flex;
    justify-content: center;
    width: 100%;
}

.card-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
}

.menu-card span {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
}

.menu-card small {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.3;
}

.blue-grad {
    background: linear-gradient(135deg, #007AFF, #5856D6);
}

.orange-grad {
    background: linear-gradient(135deg, #FF9500, #FFB340);
}

.green-grad {
    background: linear-gradient(135deg, #34C759, #30D158);
}

.purple-grad {
    background: linear-gradient(135deg, #AF52DE, #D6A4FF);
}

.red-grad {
    background: linear-gradient(135deg, #FF3B30, #FF6B60);
}

.scanner-grad {
    background: linear-gradient(135deg, #00C853, #64DD17);
    box-shadow: 0 0 15px rgba(0, 200, 83, 0.4);
}

/* --- MENU INFO MODAL --- */
.menu-info-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5000;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.menu-info-content {
    background: var(--bg-secondary);
    border-radius: 20px;
    max-width: 340px;
    width: 100%;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.menu-info-header {
    padding: 24px;
    text-align: center;
    color: white;
}

.menu-info-header i {
    font-size: 36px;
    margin-bottom: 12px;
    display: block;
}

.menu-info-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
}

.menu-info-body {
    padding: 20px 24px;
}

.menu-info-body ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu-info-body li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--glass-border);
}

.menu-info-body li:last-child {
    border-bottom: none;
}

.menu-info-body li i {
    flex-shrink: 0;
    margin-top: 2px;
}

.menu-info-close {
    width: 100%;
    padding: 16px;
    background: var(--bg-tertiary);
    border: none;
    color: var(--ios-blue);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

.menu-info-close:hover {
    background: var(--ios-blue);
    color: white;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- SEARCH & RECENT --- */
.search-box {
    position: relative;
    margin-bottom: 24px;
    background: var(--glass-bg-heavy);
    backdrop-filter: var(--glass-blur) saturate(200%);
    -webkit-backdrop-filter: var(--glass-blur) saturate(200%);
    border: 2px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    border-radius: 24px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    transition: all 0.3s var(--ease-smooth);
}

.search-box:focus-within {
    border-color: var(--ios-blue);
    box-shadow: 0 0 0 4px var(--ios-blue-light), 0 8px 32px rgba(0, 0, 0, 0.12);
}

.search-box i.fa-search,
.search-box i.fa-building {
    font-size: 18px;
    color: var(--text-secondary);
    margin-right: 12px;
}

.search-box input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    outline: none;
    padding: 8px 0;
}

/* Voice Search Button */
.search-mic-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--ios-blue-light);
    color: var(--ios-blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    margin-right: 8px;
}

.search-mic-btn:hover {
    background: var(--ios-blue);
    color: white;
}

.search-mic-btn.listening {
    background: var(--ios-red);
    color: white;
    animation: mic-pulse 1s infinite alternate;
}

@keyframes mic-pulse {
    from {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.4);
    }

    to {
        transform: scale(1.15);
        box-shadow: 0 0 0 10px rgba(255, 59, 48, 0);
    }
}

/* --- RESULT LISTS (CARD STYLE) --- */
.result-list {
    margin-top: 16px;
}

.train-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    margin-bottom: 12px;
    cursor: pointer;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s var(--ease-spring);
}

.train-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--ios-blue);
}

.train-item:active {
    transform: scale(0.97);
}

.train-badge {
    padding: 6px 12px;
    background: linear-gradient(135deg, var(--ios-blue), var(--ios-indigo));
    color: white;
    font-size: 14px;
    font-weight: 800;
    border-radius: 10px;
    min-width: 70px;
    text-align: center;
}

.train-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.train-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.train-route {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
}

.recent-bar {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.recent-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.recent-header:hover {
    background: var(--bg-primary);
}

.recent-header i {
    color: var(--text-secondary);
    transition: transform 0.3s var(--ease-spring);
}

.recent-header i.rotated {
    transform: rotate(180deg);
}

.recent-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.recent-label i {
    color: var(--ios-blue);
}

.recent-chips {
    display: flex;
    flex-direction: column;
    max-height: 320px;
    overflow-y: auto;
    transition: max-height 0.3s var(--ease-smooth), padding 0.3s;
    padding: 0 12px 12px 12px;
}

.recent-chips.collapsed {
    max-height: 0;
    padding: 0 12px;
    overflow: hidden;
}

.recent-chip-v3 {
    background: var(--bg-primary);
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid var(--glass-border);
    cursor: pointer;
    transition: all 0.2s var(--ease-spring);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.recent-chip-v3:last-child {
    margin-bottom: 0;
}

.recent-chip-v3:hover {
    background: var(--ios-blue-light);
    border-color: var(--ios-blue);
    transform: translateX(4px);
}

.recent-chip-v3:active {
    transform: scale(0.98);
}

/* --- LIVE STATUS --- */
.source-bar-v3 {
    display: flex;
    background: var(--bg-tertiary);
    border-radius: 12px;
    padding: 2px;

    .source-item {
        flex: 1;
        padding: 8px;
        text-align: center;
        font-size: 13px;
        font-weight: 700;
        color: var(--text-secondary);
        border-radius: 10px;
        cursor: pointer;
        transition: all 0.2s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
    }

    .source-item:hover {
        background: var(--bg-secondary);
        color: var(--text-primary);
    }

    .source-item.active {
        color: var(--ios-blue);
        background: var(--bg-secondary);
        box-shadow: var(--shadow-sm);
    }
}

/* --- DATE BAR (FLUTTER STYLE) --- */
.date-bar-v3 {
    display: flex;
    justify-content: center;
    overflow-x: auto;
    gap: 8px;
    margin-bottom: 20px;
    padding: 4px 0;
    scrollbar-width: none;
}

.date-bar-v3::-webkit-scrollbar {
    display: none;
}

.date-item {
    flex-shrink: 0;
    padding: 10px 20px;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-full);
}

.date-item:hover {
    background: var(--bg-tertiary);
    border-color: var(--ios-blue);
    transform: translateY(-2px);
}

.date-item.active {
    background: var(--ios-blue);
    color: white;
    border-color: var(--ios-blue);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.date-item:active {
    transform: scale(0.92);
}

.main-status-card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.main-status-card:hover {
    /* Removed background color change - keep card background same */
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

/* Floating Refresh Button - Top Right */
.refresh-btn-floating {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--ios-blue);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.4);
    transition: all 0.3s var(--ease-spring);
    z-index: 10;
}

.refresh-btn-floating i {
    font-size: 20px;
}

.refresh-btn-floating:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 122, 255, 0.5);
}

.refresh-btn-floating:active {
    transform: scale(0.95);
}

.refresh-btn-floating.spinning i {
    animation: spin-refresh 1s linear infinite;
}

@keyframes spin-refresh {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.main-status-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--ios-blue);
}

.info-top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.status-badge.live {
    background: var(--ios-green);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.5px;
    position: relative;
    box-shadow: 0 0 10px rgba(52, 199, 89, 0.4);
    animation: live-pulse 2s infinite ease-in-out;
}

@keyframes live-pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.6);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 8px rgba(52, 199, 89, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(52, 199, 89, 0);
    }
}

.status-summary {
    background: #e1f5fe;
    color: #01579b;
    padding: 12px 16px;
    border-radius: 12px;
    font-weight: 600;
    margin: 12px 0;
    display: flex;
    gap: 12px;
    align-items: center;
    border-left: 4px solid #0288d1;
}

/* --- MAP --- */
.map-container-v3 {
    width: 100%;
    height: 280px;
    border-radius: 20px;
    margin-bottom: 24px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    position: relative;
}

#v3-map {
    width: 100%;
    height: 100%;
}

/* Map Control Buttons */
.map-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
}

.map-ctrl-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s var(--ease-spring);
    color: var(--ios-blue);
    font-size: 16px;
}

.map-ctrl-btn:hover {
    background: var(--ios-blue);
    color: white;
    transform: scale(1.05);
}

.map-ctrl-btn:active {
    transform: scale(0.95);
}

/* Station Popup Styling */
.station-popup .leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.station-popup .leaflet-popup-content {
    margin: 10px 12px;
}

/* Train Map Marker Wrapper */
.train-map-marker-wrapper {
    position: relative;
}

.train-map-marker {
    position: relative;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- TIMELINE --- */
.timeline-controls-v3 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 0 4px;
}

.toggle-switch-v3 {
    position: relative;
    width: 44px;
    height: 24px;
}

.toggle-switch-v3 input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider-v3 {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-tertiary);
    transition: .4s;
    border-radius: 24px;
}

.slider-v3:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider-v3 {
    background-color: var(--ios-green);
}

input:checked+.slider-v3:before {
    transform: translateX(20px);
}

.timeline-v3 {
    position: relative;
    padding-left: 40px;
}

.timeline-line-v3 {
    position: absolute;
    left: 14px;
    top: 0;
    bottom: 0;
    width: 8px;
    background: var(--bg-tertiary);
    border-radius: 6px;
}

.timeline-progress-v3 {
    position: absolute;
    left: 15.5px;
    top: 0;
    width: 5px;
    background: linear-gradient(to bottom, var(--ios-green), #00c6ff);
    box-shadow: 0 0 10px rgba(52, 199, 89, 0.4);
    transition: height 0.6s var(--ease-smooth);
    border-radius: 6px;
}

.station-item-v3 {
    position: relative;
    margin: 4px 0;
}

/* Floating train marker for collapsed sections */
.floating-train-marker {
    position: absolute;
    left: 2px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--ios-orange);
    border: 3px solid white;
    box-shadow: 0 4px 12px rgba(255, 149, 0, 0.5);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    animation: floating-train-pulse 2s infinite ease-in-out;
    transform: translateY(-50%);
    transition: top 0.5s var(--ease-smooth);
}

.floating-train-marker.hidden {
    display: none !important;
}

@keyframes floating-train-pulse {

    0%,
    100% {
        transform: translateY(-50%) scale(1);
        box-shadow: 0 0 0 0 rgba(255, 149, 0, 0.6);
    }

    50% {
        transform: translateY(-50%) scale(1.1);
        box-shadow: 0 0 0 10px rgba(255, 149, 0, 0);
    }
}

.station-card-v3 {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-lg);
    padding: 12px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.3s var(--ease-spring);
    cursor: pointer;
}

.station-card-v3:hover {
    background: var(--glass-bg-heavy);
    box-shadow: 0 8px 24px rgba(0, 122, 255, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.15) inset;
    transform: translateX(6px) scale(1.01);
}

.station-dot-v3 {
    position: absolute;
    left: -36px;
    /* Perfectly centered on 8px track */
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 4px solid var(--bg-secondary);
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Non-halting station dots - smaller size */
.station-item-v3.non-halt .station-dot-v3 {
    width: 18px;
    height: 18px;
    left: -31px;
    border-width: 3px;
}

/* Passed station dots - orange color for all stations */
.station-item-v3.passed .station-dot-v3 {
    background: var(--ios-orange);
}

/* Current Station / Train Marker in Timeline */
.station-item-v3.current .station-dot-v3 {
    background: var(--ios-orange);
    width: 32px;
    height: 32px;
    left: -38px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid white;
    box-shadow: 0 4px 12px rgba(255, 149, 0, 0.5);
    z-index: 10;
    color: white;
    font-size: 12px;
    animation: train-pulse 2s infinite ease-in-out;
}

.station-item-v3.current .station-dot-v3 i {
    color: white;
    font-size: 12px;
}

@keyframes train-pulse {
    0% {
        transform: translateY(-50%) scale(1);
        box-shadow: 0 0 0 0 rgba(255, 149, 0, 0.6);
    }

    50% {
        transform: translateY(-50%) scale(1.1);
        box-shadow: 0 0 0 10px rgba(255, 149, 0, 0);
    }

    100% {
        transform: translateY(-50%) scale(1);
        box-shadow: 0 0 0 0 rgba(255, 149, 0, 0);
    }
}

/* Current Station Card - Orange Pulsing Background */
.station-item-v3.current .station-card-v3 {
    background: linear-gradient(135deg, rgba(255, 149, 0, 0.15) 0%, rgba(255, 200, 100, 0.1) 100%);
    border-color: rgba(255, 149, 0, 0.6);
    border-width: 2px;
    position: relative;
    overflow: hidden;
    animation: card-border-pulse 2s ease-in-out infinite;
}

@keyframes card-border-pulse {

    0%,
    100% {
        border-color: rgba(255, 149, 0, 0.4);
        box-shadow: 0 0 0 0 rgba(255, 149, 0, 0.4), var(--shadow-sm);
    }

    50% {
        border-color: rgba(255, 149, 0, 0.9);
        box-shadow: 0 0 12px 4px rgba(255, 149, 0, 0.3), var(--shadow-sm);
    }
}

.station-item-v3.current .station-card-v3::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 300%;
    height: 300%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(255, 149, 0, 0.3) 0%, transparent 50%);
    animation: card-pulse-wave 2.5s ease-out infinite;
    pointer-events: none;
}

@keyframes card-pulse-wave {
    0% {
        transform: translate(-50%, -50%) scale(0.3);
        opacity: 0.8;
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0;
    }
}

/* Station Card with Alarm Set - Light Blue Highlight */
.station-card-v3.has-alarm {
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.12) 0%, rgba(90, 200, 250, 0.08) 100%);
    border-color: rgba(0, 122, 255, 0.4);
}

/* Station Alarm Button on Card */
.station-alarm-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s var(--ease-spring);
    margin-left: auto;
}

.station-alarm-btn:hover {
    background: var(--ios-blue-light);
    color: var(--ios-blue);
    transform: scale(1.1);
}

.station-alarm-btn.active {
    background: var(--ios-blue);
    color: white;
    animation: alarm-ring 1s ease-in-out;
}

@keyframes alarm-ring {

    0%,
    100% {
        transform: rotate(0deg);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: rotate(10deg);
    }

    20%,
    40%,
    60%,
    80% {
        transform: rotate(-10deg);
    }
}

.spinning i {
    animation: spin-refresh 1.2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    display: inline-block;
}

@keyframes spin-refresh {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Pulse Waves for Map Marker */
.map-pulse-wave {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(255, 149, 0, 0.3);
    animation: map-wave 2s infinite linear;
}

@keyframes map-wave {
    from {
        transform: scale(1);
        opacity: 0.8;
    }

    to {
        transform: scale(3.5);
        opacity: 0;
    }
}

/* New Train Map Marker Styles */

.train-map-marker {
    width: 18px;
    height: 18px;
}

/* Hide pulse rings */
.map-pulse-ring {
    display: none !important;
}

.train-arrow {
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #FF9500, #FF6B00);
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 0 0 rgba(255, 149, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pointer-pulse 2s ease-in-out infinite;
}

@keyframes pointer-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(255, 149, 0, 0.7);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(255, 149, 0, 0);
    }
}

.train-arrow i {
    color: white;
    font-size: 9px;
}

/* Map tooltip styling */
.map-tooltip {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 700;
}

/* --- LIVE STATION BOARD --- */
.time-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
}

.time-options {
    display: flex;
    gap: 8px;
}

.time-option {
    padding: 8px 14px;
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.time-option.active {
    background: var(--ios-orange);
    color: white;
    border-color: var(--ios-orange);
}

.time-option:hover:not(.active) {
    background: var(--bg-tertiary);
}

.station-arrivals-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.arrival-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 16px;
    border: 1px solid var(--glass-border);
    display: flex;
    gap: 16px;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
}

.arrival-card:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
}

.arrival-time-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: 12px;
}

.arrival-time {
    font-size: 18px;
    font-weight: 700;
    color: var(--ios-green);
}

.departure-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.arrival-info {
    flex: 1;
}

.arrival-train-number {
    font-size: 14px;
    font-weight: 700;
    color: var(--ios-blue);
}

.arrival-trai.ntes-sch-time {
    font-size: 13px;
    font-weight: 700;
    color: #000;
    /* Black in light mode */
    margin-bottom: 2px;
}

body.dark .ntes-sch-time {
    color: #fff;
    /* White in dark mode */
}

.arrival-train-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 4px;
}

.arrival-day {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.arrival-arrow {
    color: var(--text-tertiary);
    font-size: 14px;
}

.arrivals-count {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 8px 0;
    text-align: center;
}

.search-go-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: none;
    background: var(--ios-orange);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.search-go-btn:hover {
    background: #e68600;
}

/* --- SEARCH RESULTS / SUGGESTIONS --- */
.result-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    cursor: pointer;
    transition: all 0.2s var(--ease-spring);
}

.result-item:hover {
    background: var(--bg-tertiary);
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.result-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--ios-orange), #ff6b00);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
}

.result-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.result-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.result-sub {
    font-size: 12px;
    color: var(--text-secondary);
}

.result-arrow {
    color: var(--text-tertiary);
    font-size: 12px;
}

/* Go to Top Button */
.go-top-btn {
    position: fixed;
    bottom: 90px;
    /* Above the 70px tab bar */
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--ios-blue);
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(0, 122, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 999;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s var(--ease-spring);
    pointer-events: none;
}

.go-top-btn.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.go-top-btn i {
    font-size: 20px;
}

.go-top-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 122, 255, 0.5);
}

.go-top-btn:active {
    transform: scale(0.95);
}

/* Intermediate Stations Expansion */
.intermediate-expand-v3 {
    margin: 4px 0 4px 10px;
    padding: 10px 16px;
    background: var(--bg-secondary);
    color: var(--ios-blue);
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
}

.intermediate-expand-v3 i {
    transition: transform 0.3s;
}

.intermediate-expand-v3.expanded {
    background: var(--ios-blue-light);
    border-color: var(--ios-blue);
}

.intermediate-expand-v3.expanded i {
    transform: rotate(180deg);
}

.station-item-v3.non-halt {
    margin-bottom: 8px;
}

.station-item-v3.non-halt .station-card-v3 {
    background: var(--ios-blue-light);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    box-shadow: none;
    border: 1px solid var(--glass-border);
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    transition: all 0.3s var(--ease-spring);
}

.station-item-v3.non-halt .station-header-v3 {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    flex-shrink: 0;
}

.station-item-v3.non-halt .station-header-v3 .station-alarm-btn {
    order: 3;
    margin-left: auto;
    position: absolute;
    right: 12px;
}

.station-item-v3.non-halt .st-timing-v3 {
    margin-top: 0;
    margin-left: auto;
    margin-right: 40px;
    gap: 12px;
    flex-shrink: 0;
}

.station-item-v3.non-halt .time-box {
    flex-direction: row;
    align-items: center;
    gap: 4px;
}

.station-item-v3.non-halt .time-label {
    font-size: 8px;
}

.station-item-v3.non-halt .time-val {
    font-size: 12px;
}

/* Status dot centering logic for 8px track */
.station-dot-v3 {
    position: absolute;
    left: -36px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 4px solid var(--bg-secondary);
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ontime/Delay status badge */
.non-halt-ontime {
    background: var(--ios-green-light);
    color: var(--ios-green);
    font-size: 13px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 6px;
    margin-left: 10px;
    display: inline-block;
}

.non-halt-ontime.late {
    background: rgba(255, 59, 48, 0.15);
    color: var(--ios-red);
}

.non-halt-ontime.ontime {
    background: rgba(52, 199, 89, 0.15);
    color: var(--ios-green);
}

.st-timing-v3 {
    display: flex;
    gap: 16px;
    margin-top: 8px;
}

/* Station Card Detail Enhancements */
.st-name {
    font-weight: 800 !important;
    font-size: 16px;
    color: var(--text-primary);
}

.st-code-badge {
    background: #e3f2fd;
    color: #1976d2;
    padding: 2px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 800;
    margin-left: 8px;
    text-transform: uppercase;
    border: 1px solid #bbdefb;
}

.delay-badge-v3 {
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
}

.delay-badge-v3.late {
    background: #ffebee !important;
    color: #d32f2f !important;
    border: 1px solid #ffcdd2;
}

.delay-badge-v3.ontime {
    background: #e8f5e9 !important;
    color: #2e7d32 !important;
    border: 1px solid #c8e6c9;
}

.st-km-v3 {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 700;
}

.badge-row-v3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.station-header-v3 {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.time-box {
    display: flex;
    flex-direction: column;
}

.time-label {
    font-size: 9px;
    font-weight: 800;
    color: var(--text-tertiary);
    text-transform: uppercase;
}

.time-val {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.late {
    color: var(--ios-red) !important;
}

.badge-row-v3 {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.platform-badge-v3 {
    background: var(--ios-orange);
    color: #fff;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.coach-badge-v3 {
    background: var(--ios-purple);
    color: #fff;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* --- TAB BAR --- */
.tab-bar-v3 {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 85px;
    padding-bottom: 20px;
    background: var(--glass-bg-heavy);
    backdrop-filter: var(--glass-blur-heavy) saturate(180%);
    -webkit-backdrop-filter: var(--glass-blur-heavy) saturate(180%);
    border-top: 1px solid var(--glass-border);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.08);
    display: flex;
    z-index: 1000;
}

.tab-btn-v3 {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    gap: 4px;
    cursor: pointer;
}

.tab-btn-v3.active {
    color: var(--ios-blue);
}

.tab-btn-v3 i {
    font-size: 20px;
}

.tab-btn-v3 span {
    font-size: 10px;
    font-weight: 700;
}

.hidden {
    display: none !important;
}

.glass-btn-v3 {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    color: var(--ios-blue);
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

/* --- ACTION BADGES ROW --- */
.action-badges-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 12px;
}

.action-badge {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 12px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-badge:hover {
    border-color: var(--ios-blue);
    border-width: 2px;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.action-badge:active {
    transform: scale(0.95);
}

.action-badge i {
    font-size: 18px;
    color: var(--ios-blue);
}

.action-badge span {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.updated-line {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.updated-line i {
    font-size: 14px;
    color: var(--ios-green);
}

/* --- GO TO TOP BUTTON --- */
.go-top-btn {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--ios-blue);
    color: white;
    border: none;
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.4);
    cursor: pointer;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s var(--ease-spring);
}

.go-top-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.go-top-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 122, 255, 0.5);
}

.go-top-btn:active {
    transform: scale(0.95);
}

/* --- MAP CONTAINER --- */
.map-container-v3 {
    width: 100%;
    height: 280px;
    border-radius: 20px;
    margin-bottom: 24px;
    overflow: hidden;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
    position: relative;
    transition: all 0.3s var(--ease-smooth);
}

.map-container-v3.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
    margin: 0;
    z-index: 2000;
}

#v3-map {
    width: 100%;
    height: 100%;
}

/* Map Control Buttons */
.map-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
}

.map-ctrl-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s var(--ease-spring);
    color: var(--ios-blue);
    font-size: 16px;
}

.map-ctrl-btn:hover {
    background: var(--ios-blue);
    color: white;
    transform: scale(1.05);
}

.map-ctrl-btn:active {
    transform: scale(0.95);
}

/* Train Marker on Map */
.train-map-marker-wrapper {
    position: relative;
}

.train-map-marker {
    position: relative;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.map-pulse-ring {
    position: absolute;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 149, 0, 0.3);
    animation: map-pulse 2s ease-out infinite;
}

.map-pulse-ring.delay-1 {
    animation-delay: 0.5s;
}

.map-pulse-ring.delay-2 {
    animation-delay: 1s;
}

@keyframes map-pulse {
    0% {
        transform: scale(0.5);
        opacity: 1;
    }

    100% {
        transform: scale(2);
        opacity: 0;
    }
}

.train-arrow {
    position: relative;
    z-index: 10;
    width: 32px;
    height: 32px;
    background: var(--ios-orange);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(255, 149, 0, 0.4);
}

/* --- GPS CONTRIBUTION PANEL --- */
.gps-contrib-panel {
    position: fixed;
    right: -350px;
    top: 50%;
    transform: translateY(-50%);
    width: 320px;
    background: var(--bg-secondary);
    border-radius: 20px 0 0 20px;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    z-index: 1500;
    transition: right 0.4s var(--ease-spring);
    overflow: hidden;
}

.gps-contrib-panel.visible {
    right: 0;
}

.gps-contrib-panel.hidden {
    right: -350px;
}

.gps-panel-header {
    background: linear-gradient(135deg, var(--ios-blue), var(--ios-purple));
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.gps-panel-header i {
    font-size: 20px;
}

.gps-panel-header span {
    flex: 1;
    font-weight: 700;
    font-size: 14px;
}

.gps-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gps-panel-content {
    padding: 20px;
}

.gps-panel-content p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 16px 0;
    line-height: 1.5;
}

.gps-btn-row {
    display: flex;
    gap: 10px;
}

.gps-yes-btn,
.gps-no-btn {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.gps-yes-btn {
    background: var(--ios-green);
    color: white;
}

.gps-yes-btn:hover {
    background: #2db350;
    transform: translateY(-2px);
}

.gps-no-btn {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.gps-no-btn:hover {
    background: var(--bg-primary);
}

/* --- MODAL OVERLAY --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.hidden {
    display: none;
}

.modal-card {
    background: var(--glass-bg-heavy);
    backdrop-filter: var(--glass-blur-heavy);
    -webkit-backdrop-filter: var(--glass-blur-heavy);
    border: 1px solid var(--glass-border);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.2) inset;
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 400px;
    overflow: hidden;
    animation: modal-pop 0.3s var(--ease-spring);
}

@keyframes modal-pop {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    border-bottom: 1px solid var(--glass-border);
}

.modal-header h3 {
    flex: 1;
    margin: 0;
    font-size: 18px;
}

.modal-close-btn {
    background: var(--bg-tertiary);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body {
    padding: 20px;
}

.modal-body p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0 0 20px 0;
}

.alarm-station-select {
    margin-bottom: 20px;
}

.alarm-station-select label,
.alarm-time-select label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.alarm-station-select select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
}

.alarm-options {
    display: flex;
    gap: 10px;
}

.alarm-option {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.alarm-option i {
    font-size: 16px;
    color: var(--text-secondary);
}

.alarm-option.active {
    border-color: var(--ios-orange);
    background: var(--ios-orange-light);
    color: var(--ios-orange);
}

.alarm-option.active i {
    color: var(--ios-orange);
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--glass-border);
}

.alarm-save-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: var(--ios-orange);
    color: white;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.alarm-save-btn:hover {
    background: #e68600;
    transform: translateY(-2px);
}

/* --- TOAST ANIMATIONS --- */
@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
}

/* ========== NTES-Style Station Arrival Cards (Compact) ========== */
.ntes-card {
    display: grid;
    grid-template-columns: 35px 1fr auto auto;
    gap: 6px;
    padding: 6px;
    margin-bottom: 6px;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
    border-radius: 10px;
    align-items: start;
    transition: all 0.2s ease;
    cursor: pointer;
}

.ntes-card:hover {
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.2);
    transform: translateY(-2px);
    border-color: rgba(0, 122, 255, 0.3);
}

.ntes-card.live {
    border-left: 4px solid var(--ios-green);
}

.ntes-sr {
    font-size: 14px;
    font-weight: 700;
    color: var(--ios-blue);
    text-align: center;
    padding-top: 4px;
}

.ntes-main {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ntes-train-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Train Number Badge */
.train-num-badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 13px;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, var(--ios-blue) 0%, var(--ios-indigo) 100%);
    border-radius: 6px;
    letter-spacing: 0.5px;
}

.ntes-num {
    font-size: 14px;
    font-weight: 700;
    color: var(--ios-blue);
}

.ntes-pipe {
    color: var(--text-tertiary);
    font-weight: 300;
}

.ntes-name {
    font-size: 16px;
    /* Increased from 14px */
    font-weight: 700;
    /* Bolder */
    color: var(--text-primary);
}

/* Strong Labels for Arrival/Departure/Platform */
.ntes-lbl-strong {
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

/* Scheduled Time (clear display without Sch: prefix) */
.ntes-sch-time {
    font-size: 13px;
    color: #000;
    /* Black in light mode */
    font-weight: 700;
    margin-top: 4px;
    display: inline-block;
}

body.dark .ntes-sch-time {
    color: #fff;
    /* White in dark mode */
}

.ntes-coach-row {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.ntes-coach {
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 600;
    color: var(--ios-blue);
    background: rgba(0, 122, 255, 0.1);
    border-radius: 4px;
}

.ntes-btn-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.ntes-link {
    font-size: 11px;
    font-weight: 600;
    color: var(--ios-orange);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
}

.ntes-link:hover {
    text-decoration: underline;
}

.ntes-link i {
    font-size: 10px;
}

.ntes-sep {
    color: var(--text-tertiary);
    font-size: 11px;
}

.ntes-times {
    display: flex;
    gap: 16px;
}

.ntes-time-box {
    text-align: center;
    min-width: 70px;
}

.ntes-lbl {
    font-size: 10px;
    color: var(--text-tertiary);
    font-weight: 500;
    margin-bottom: 2px;
}

.ntes-val {
    font-size: 13px;
    /* Match scheduled time */
    font-weight: 700;
    color: #000;
    /* Black in light mode */
}

/* On Time Badge - Green */
.ntes-val:not(.late) {
    display: inline-block;
    padding: 4px 8px;
    background: #34C759;
    /* Green background */
    color: white !important;
    border-radius: 6px;
    font-size: 12px;
}

.ntes-val.late {
    color: #FF3B30;
    /* Red for late */
}

body.dark .ntes-val {
    color: #fff;
    /* White in dark mode */
}

body.dark .ntes-val.late {
    color: #FF3B30;
    /* Keep red for late in dark mode */
}

.ntes-delay {
    display: inline-block;
    padding: 2px 6px;
    font-size: 9px;
    font-weight: 700;
    color: white;
    background: var(--ios-orange);
    border-radius: 8px;
    margin-top: 2px;
}

.ntes-ok {
    display: inline-block;
    padding: 2px 6px;
    font-size: 9px;
    font-weight: 600;
    color: var(--ios-green);
    background: rgba(52, 199, 89, 0.15);
    border-radius: 8px;
    margin-top: 2px;
}

.ntes-sch {
    font-size: 10px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.ntes-pf {
    text-align: center;
    min-width: 65px;
}

.ntes-pf-val {
    font-size: 18px;
    font-weight: 700;
    color: var(--ios-orange);
}

.ntes-pf-link {
    color: #2196F3;
    text-decoration: none;
    font-size: 10px;
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s;
    background: rgba(33, 150, 243, 0.08);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid rgba(33, 150, 243, 0.2);
    width: max-content;
}

.ntes-pf-link:hover {
    background: rgba(33, 150, 243, 0.15);
    border-color: rgba(33, 150, 243, 0.4);
}

.ntes-pf-link i {
    font-size: 11px;
}

/* Keep old classes for backwards compat */
.ntes-train-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ntes-train-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ntes-train-number {
    font-size: 15px;
    font-weight: 700;
    color: var(--ios-blue);
}

.ntes-train-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.ntes-train-type {
    font-size: 11px;
    font-weight: 600;
    color: var(--ios-green);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ntes-actions {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

.ntes-btn {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ios-blue);
    background: var(--bg-secondary);
    border: 1px solid var(--ios-blue);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ntes-btn:hover {
    background: var(--ios-blue);
    color: white;
}

.ntes-btn i {
    font-size: 10px;
}

.ntes-time-col {
    text-align: center;
}

.ntes-time-label {
    font-size: 11px;
    color: var(--text-tertiary);
    font-weight: 500;
    margin-bottom: 4px;
}

.ntes-time-val {
    font-size: 16px;
    font-weight: 700;
    color: var(--ios-blue);
}

.ntes-time-val.delayed {
    color: var(--ios-orange);
}

.ntes-delay-badge {
    display: inline-block;
    margin-top: 4px;
    padding: 3px 8px;
    font-size: 10px;
    font-weight: 700;
    color: white;
    background: var(--ios-orange);
    border-radius: 10px;
}

.ntes-ontime-badge {
    display: inline-block;
    margin-top: 4px;
    padding: 3px 8px;
    font-size: 10px;
    font-weight: 600;
    color: var(--ios-green);
    background: rgba(52, 199, 89, 0.15);
    border-radius: 10px;
}

.ntes-sch-time {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.ntes-platform-col {
    text-align: center;
}

.ntes-platform-val {
    font-size: 18px;
    font-weight: 700;
    color: var(--ios-orange);
}

/* Mobile responsive for NTES cards */
@media (max-width: 768px) {
    .ntes-arrival-card {
        grid-template-columns: 30px 1fr;
        grid-template-rows: auto auto auto;
        gap: 8px;
        padding: 12px;
    }

    .ntes-sr {
        grid-row: 1;
        font-size: 14px;
    }

    .ntes-train-info {
        grid-row: 1;
        grid-column: 2;
    }

    .ntes-time-col,
    .ntes-platform-col {
        grid-column: 2;
    }

    .ntes-arrival-card>.ntes-time-col:nth-of-type(3),
    .ntes-arrival-card>.ntes-time-col:nth-of-type(4),
    .ntes-arrival-card>.ntes-platform-col {
        display: inline-flex;
        flex-direction: column;
        align-items: flex-start;
        padding: 4px 0;
    }

    .arrivals-cou .ntes-sr {
        font-size: 11px;
    }
}

/* ==========================================================================
   MOBILE NATIVE CARD LAYOUT (Android/iOS Only)
   Re-arranges the Station Search Result Card
   ========================================================================== */
@media screen and (max-width: 768px) {

    body.platform-android .ntes-card,
    body.platform-ios .ntes-card {
        display: grid;
        /* Columns: Serial | Content | Platform | Sidebar */
        grid-template-columns: auto 1fr auto 100px;
        grid-template-areas:
            /* Row 1: Train Name gets FULL width (pushes buttons down) */
            "sr train train train"
            /* Row 2: Coach Info | Buttons start here */
            "sr coach coach btns"
            /* Row 3: Times & Platform | Buttons continue */
            "sr times pf    btns";
        gap: 6px 8px;
        padding: 8px 10px;
        align-items: center;
        min-height: 80px;
    }

    body.platform-android .ntes-main,
    body.platform-ios .ntes-main {
        display: contents;
    }

    /* Serial Number */
    body.platform-android .ntes-sr,
    body.platform-ios .ntes-sr {
        grid-area: sr;
        font-size: 14px;
        /* Increased from 11px */
        color: var(--text-tertiary);
        align-self: start;
        padding-top: 6px;
        width: 15px;
    }

    /* Train Info */
    /* Train Info */
    body.platform-android .ntes-train-row,
    body.platform-ios .ntes-train-row {
        grid-area: train;
        margin-bottom: 0px;
        align-self: center;
        /* Use Flexbox for badge + name alignment */
        display: flex;
        align-items: flex-start;
        /* Name aligns to top */
        gap: 6px;

        overflow: visible;
        white-space: normal;
        text-overflow: clip;
        max-width: 100%;
        line-height: 1.1;
        word-break: break-word;
    }

    /* Ensure name takes remaining space */
    body.platform-android .ntes-train-row .ntes-name,
    body.platform-ios .ntes-train-row .ntes-name {
        flex: 1;
    }

    /* Coach Info */
    body.platform-android .ntes-coach-row,
    body.platform-ios .ntes-coach-row {
        grid-area: coach;
        margin-top: 2px;
        margin-bottom: 4px;
        flex-wrap: nowrap;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        align-self: start;
    }

    /* Times Container (Arr & Dep) */
    body.platform-android .ntes-times,
    body.platform-ios .ntes-times {
        grid-area: times;
        display: flex;
        align-items: center;
        gap: 12px;
        margin-right: 4px;
        align-self: start;
    }

    body.platform-android .ntes-time-box,
    body.platform-ios .ntes-time-box {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    body.platform-android .ntes-lbl-strong,
    body.platform-ios .ntes-lbl-strong {
        font-size: 11px;
        /* Increased from 9px */
        opacity: 0.6;
        letter-spacing: 0.5px;
        margin-bottom: 2px;
        text-transform: uppercase;
        font-weight: 700;
    }

    /* Scheduled Time (Standard Text) */
    body.platform-android .ntes-sch-time,
    body.platform-ios .ntes-sch-time {
        font-size: 15px !important;
        /* Increased from 13px */
        font-weight: 700;
        color: var(--text-primary);
        margin-bottom: 2px !important;
    }

    /* Actual Time (Badge Style) */
    body.platform-android .ntes-val,
    body.platform-ios .ntes-val {
        font-size: 16px;
        /* Increased from 13px */
        font-weight: 700;
        padding: 4px 8px;
        border-radius: 6px;
        color: white;
        background: #34C759;
        /* Default Green for On Time */
        display: inline-block;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    }

    body.platform-android .ntes-val.late,
    body.platform-ios .ntes-val.late {
        background: #FF3B30;
        /* Red for Late */
        color: white !important;
    }

    /* Hide the text "On Time" or "Delay" since badge color implies it, 
       OR keep it small below? User asked for badge color per delay. 
       Let's keep the delay text small below the badge. */
    body.platform-android .ntes-delay,
    body.platform-ios .ntes-delay,
    body.platform-android .ntes-ok,
    body.platform-ios .ntes-ok {
        font-size: 12px;
        /* Increased from 9px */
        font-weight: 700;
        margin-top: 2px;
        opacity: 0.9;
    }

    /* Platform Container */
    /* Platform Container */
    body.platform-android .ntes-pf,
    body.platform-ios .ntes-pf {
        grid-area: pf;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-self: center;
        /* Center horizontally */
        text-align: center;
        min-width: 40px;
        align-self: center;
        background: #FFD60A;
        /* Yellow Background */
        padding: 4px 6px;
        border-radius: 6px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
        border: 1px solid rgba(0, 0, 0, 0.05);
    }

    body.platform-android .ntes-pf .ntes-lbl-strong,
    body.platform-ios .ntes-pf .ntes-lbl-strong {
        display: block;
        /* Restore label */
        font-size: 8px;
        opacity: 0.8;
        color: #000;
        font-weight: 800;
        margin-bottom: 0;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }



    /* Button Column (Right Side) */
    /* Button Column (Bottom Row) */
    body.platform-android .ntes-btn-row,
    body.platform-ios .ntes-btn-row {
        grid-area: btns;
        display: flex;
        flex-direction: column;
        /* Vertical Stack */
        justify-content: center;
        gap: 6px;
        padding-left: 8px;
        border-left: 1px solid rgba(0, 0, 0, 0.05);
        /* Separator */
        border-top: none;
        margin-top: 0;
        padding-top: 0;
        height: 100%;
        width: 100%;
    }

    body.platform-android .ntes-sep,
    body.platform-ios .ntes-sep {
        display: none;
    }

    /* Generic Button Style */
    .ntes-link {
        font-size: 13px;
        padding: 8px 12px;
        border-radius: 20px;
        text-align: center;
        font-weight: 700;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        text-transform: uppercase;
        line-height: 1;
        box-shadow: none;
        border: none;
        text-decoration: none !important;
        margin: 0 4px;
        color: white;
        transition: transform 0.2s;
    }

    .ntes-link:active {
        transform: scale(0.95);
    }

    /* Button Colors */
    .ntes-link-live {
        background: linear-gradient(135deg, #FF9500, #FF5E3A);
        /* Orange/Red for Live */
        box-shadow: 0 2px 4px rgba(255, 149, 0, 0.3);
    }

    .ntes-link-coach {
        background: linear-gradient(135deg, #AF52DE, #5856D6);
        /* Purple/Blue for Coach */
        box-shadow: 0 2px 4px rgba(175, 82, 222, 0.3);
    }

    .ntes-link-schedule {
        background: linear-gradient(135deg, #007AFF, #00C7BE);
        /* Blue/Teal for Schedule */
        box-shadow: 0 2px 4px rgba(0, 122, 255, 0.3);
    }

    /* Default (Web) Layout for Button Row - Bottom Right (Reversed Order) */
    .ntes-btn-row {
        grid-area: btns;
        display: flex;
        flex-direction: row-reverse;
        /* Reverse order */
        justify-content: flex-end;
        /* Right align */
        align-items: center;
        margin-top: 12px;
        width: 100%;
    }

    /* Keep Mobile Sidebar Layout if platform class exists (Optional - user might want this everywhere, but strictly asked for 'web ui') */
    /* Overriding specific platform styles if needed, but the default above handles Web */

    /* Generic Platform Value (Web + Mobile) */
    .ntes-pf-val {
        font-size: 28px !important;
        /* Big Size */
        font-weight: 800;
        color: #000;
        line-height: 1;
        background: #FFD60A;
        padding: 4px 8px;
        border-radius: 6px;
        display: inline-block;
        min-width: 40px;
        text-align: center;
    }

    /* Existing Mobile Overrides will follow ... */
    body.platform-android .ntes-link,
    body.platform-ios .ntes-link {
        /* ... keeping existing mobile sidebar styles if they are more specific,
           BUT we need to ensure they get the colors.
           The generic .ntes-link-live etc will apply if not overridden by specificity.
        */
        font-size: 11px;
        /* Smaller on sidebar */
        border-radius: 8px;
        /* Boxy on sidebar */
        margin: 0;
        /* Reset margin for sidebar stack */
        justify-content: center;
        height: 28px;
        width: 100%;
        /* Equal width for all buttons */
        background: transparent;
        padding: 6px 4px !important;
        /* Restore padding */
    }

    /* Restore Android Text Size */
    body.platform-android .ntes-pf-val,
    body.platform-ios .ntes-pf-val {
        font-size: 20px !important;
        /* Revert to 20px for mobile */
    }



    /* Re-apply colors to mobile specific selectors with gradients */
    body.platform-android .ntes-link-live,
    body.platform-ios .ntes-link-live {
        background: linear-gradient(135deg, #FF9500, #FF5E3A);
        box-shadow: 0 2px 4px rgba(255, 149, 0, 0.3);
    }

    body.platform-android .ntes-link-coach,
    body.platform-ios .ntes-link-coach {
        background: linear-gradient(135deg, #AF52DE, #5856D6);
        box-shadow: 0 2px 4px rgba(175, 82, 222, 0.3);
    }

    body.platform-android .ntes-link-schedule,
    body.platform-ios .ntes-link-schedule {
        background: linear-gradient(135deg, #007AFF, #00C7BE);
        box-shadow: 0 2px 4px rgba(0, 122, 255, 0.3);
    }


    /* 2. COACH POSITION (Middle) - Purple (If exists) */
    body.platform-android .ntes-btn-row a[onclick*="showCoachPosition"],
    body.platform-ios .ntes-btn-row a[onclick*="showCoachPosition"] {
        order: 2;
        background: var(--ios-purple);
        color: white;
    }

    /* 3. SCHEDULE (Bottom) - Blue */
    body.platform-android .ntes-btn-row a[onclick*="showTrainSchedule"],
    body.platform-ios .ntes-btn-row a[onclick*="showTrainSchedule"] {
        order: 3;
        background: var(--ios-blue);
        /* Different color requested */
        color: white;
    }

    /* HIDE ICONS ON ANDROID - User Request to check UI */
    body.platform-android .trip-info-icon {
        display: none !important;
    }

    /* --- Mobile Web (Non-Native Apps) - Copy Desktop UI --- */
    body:not(.platform-android):not(.platform-ios) .ntes-card {
        display: grid;
        grid-template-columns: auto 1fr auto 120px;
        grid-template-areas:
            "sr train train train"
            "sr coach coach btns"
            "sr times pf    btns";
        gap: 8px 12px;
        padding: 12px 16px;
        align-items: center;
        min-height: 100px;
    }

    body:not(.platform-android):not(.platform-ios) .ntes-main {
        display: contents;
    }

    body:not(.platform-android):not(.platform-ios) .ntes-sr {
        grid-area: sr;
        font-size: 16px;
        color: var(--text-tertiary);
        align-self: start;
        padding-top: 8px;
        width: 20px;
    }

    body:not(.platform-android):not(.platform-ios) .ntes-train-row {
        grid-area: train;
        margin-bottom: 0px;
        align-self: center;
        display: flex;
        align-items: flex-start;
        gap: 8px;
        overflow: visible;
        white-space: normal;
        text-overflow: clip;
        max-width: 100%;
        line-height: 1.1;
        word-break: break-word;
    }

    body:not(.platform-android):not(.platform-ios) .ntes-train-row .ntes-name {
        flex: 1;
    }

    body:not(.platform-android):not(.platform-ios) .ntes-coach-row {
        grid-area: coach;
        margin-top: 2px;
        margin-bottom: 4px;
        flex-wrap: nowrap;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        align-self: start;
    }

    body:not(.platform-android):not(.platform-ios) .ntes-coach {
        padding: 4px 10px;
        font-size: 14px;
        font-weight: 700;
    }

    body:not(.platform-android):not(.platform-ios) .ntes-times {
        grid-area: times;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 20px;
        margin-right: 0;
        padding-right: 12px;
        align-self: center;
    }

    body:not(.platform-android):not(.platform-ios) .ntes-time-box {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    body:not(.platform-android):not(.platform-ios) .ntes-lbl-strong {
        font-size: 12px;
        opacity: 0.6;
        letter-spacing: 0.5px;
        margin-bottom: 2px;
        text-transform: uppercase;
        font-weight: 700;
    }

    body:not(.platform-android):not(.platform-ios) .ntes-sch-time {
        font-size: 16px !important;
        font-weight: 700;
        color: var(--text-primary);
        margin-bottom: 2px !important;
    }

    body:not(.platform-android):not(.platform-ios) .ntes-val {
        font-size: 18px;
        font-weight: 700;
        padding: 5px 10px;
        border-radius: 6px;
        color: white;
        background: #34C759;
        display: inline-block;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    }

    body:not(.platform-android):not(.platform-ios) .ntes-val.late {
        background: #FF3B30;
        color: white !important;
    }

    body:not(.platform-android):not(.platform-ios) .ntes-delay {
        font-size: 13px;
        font-weight: 700;
        margin-top: 2px;
        opacity: 0.9;
    }

    body:not(.platform-android):not(.platform-ios) .ntes-pf {
        grid-area: pf;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-self: center;
        text-align: center;
        min-width: 50px;
        align-self: center;
        background: #FFD60A;
        padding: 6px 8px;
        border-radius: 6px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
        border: 1px solid rgba(0, 0, 0, 0.05);
        margin: 0 12px;
    }

    body:not(.platform-android):not(.platform-ios) .ntes-pf .ntes-lbl-strong {
        display: block;
        font-size: 9px;
        opacity: 0.8;
        color: #000;
        font-weight: 800;
        margin-bottom: 0;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    body:not(.platform-android):not(.platform-ios) .ntes-pf-val {
        font-size: 24px;
        font-weight: 800;
        color: #000;
        line-height: 1;
    }

    body:not(.platform-android):not(.platform-ios) .ntes-btn-row {
        grid-area: btns;
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 8px;
        padding-left: 10px;
        border-left: 1px solid rgba(0, 0, 0, 0.05);
        border-top: none;
        margin-top: 0;
        padding-top: 0;
        height: 100%;
        width: 100%;
    }

    body:not(.platform-android):not(.platform-ios) .ntes-link {
        font-size: 11px;
        border-radius: 8px;
        margin: 0;
        justify-content: center;
        height: 32px;
        width: 100%;
        padding: 6px 4px !important;
        color: white !important;
        text-transform: uppercase;
        font-weight: 700;
        text-decoration: none !important;
    }

    body:not(.platform-android):not(.platform-ios) .ntes-link:hover {
        transform: scale(1.02);
    }

    body:not(.platform-android):not(.platform-ios) .ntes-link-live {
        background: linear-gradient(135deg, #FF9500, #FF5E3A);
        box-shadow: 0 2px 4px rgba(255, 149, 0, 0.3);
    }

    body:not(.platform-android):not(.platform-ios) .ntes-link-coach {
        background: linear-gradient(135deg, #AF52DE, #5856D6);
        box-shadow: 0 2px 4px rgba(175, 82, 222, 0.3);
    }

    body:not(.platform-android):not(.platform-ios) .ntes-link-schedule {
        background: linear-gradient(135deg, #007AFF, #00C7BE);
        box-shadow: 0 2px 4px rgba(0, 122, 255, 0.3);
    }
}

/* --- Universal NTES Card Layout for Desktop (Copied from Android) --- */
body.is-desktop .ntes-card {
    display: grid;
    grid-template-columns: auto 1fr auto 120px;
    grid-template-areas:
        "sr train train train"
        "sr coach coach btns"
        "sr times pf    btns";
    gap: 8px 12px;
    padding: 12px 16px;
    align-items: center;
    min-height: 100px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    border-radius: 12px;
    margin-bottom: 12px;
}

body.is-desktop .ntes-main {
    display: contents;
}

body.is-desktop .ntes-sr {
    grid-area: sr;
    font-size: 16px;
    color: var(--text-tertiary);
    align-self: start;
    padding-top: 8px;
    width: 20px;
}

body.is-desktop .ntes-train-row {
    grid-area: train;
    margin-bottom: 0px;
    align-self: center;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    overflow: visible;
    white-space: normal;
    text-overflow: clip;
    max-width: 100%;
    line-height: 1.1;
    word-break: break-word;
}

body.is-desktop .ntes-train-row .ntes-name {
    flex: 1;
}

body.is-desktop .ntes-coach-row {
    grid-area: coach;
    margin-top: 2px;
    margin-bottom: 4px;
    flex-wrap: nowrap;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    align-self: start;
}

body.is-desktop .ntes-coach {
    padding: 4px 10px;
    font-size: 14px;
    font-weight: 700;
}

body.is-desktop .ntes-times {
    grid-area: times;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 20px;
    margin-right: 0;
    padding-right: 12px;
    align-self: center;
}

body.is-desktop .ntes-time-box {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

body.is-desktop .ntes-lbl-strong {
    font-size: 12px;
    opacity: 0.6;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
    text-transform: uppercase;
    font-weight: 700;
}

body.is-desktop .ntes-sch-time {
    font-size: 16px !important;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px !important;
}

body.is-desktop .ntes-val {
    font-size: 18px;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: 6px;
    color: white;
    background: #34C759;
    display: inline-block;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

body.is-desktop .ntes-val.late {
    background: #FF3B30;
    color: white !important;
}

body.is-desktop .ntes-delay {
    font-size: 13px;
    font-weight: 700;
    margin-top: 2px;
    opacity: 0.9;
}

body.is-desktop .ntes-pf {
    grid-area: pf;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-self: center;
    text-align: center;
    min-width: 50px;
    align-self: center;
    background: #FFD60A;
    padding: 6px 8px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.05);
    margin: 0 12px;
}

body.is-desktop .ntes-pf .ntes-lbl-strong {
    display: block;
    font-size: 9px;
    opacity: 0.8;
    color: #000;
    font-weight: 800;
    margin-bottom: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

body.is-desktop .ntes-pf-val {
    font-size: 24px;
    font-weight: 800;
    color: #000;
    line-height: 1;
}

body.is-desktop .ntes-btn-row {
    grid-area: btns;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    padding-left: 10px;
    border-left: 1px solid rgba(0, 0, 0, 0.05);
    border-top: none;
    margin-top: 0;
    padding-top: 0;
    height: 100%;
    width: 100%;
}

body.is-desktop .ntes-link {
    font-size: 11px;
    border-radius: 8px;
    margin: 0;
    justify-content: center;
    height: 32px;
    width: 100%;
    padding: 6px 4px !important;
    color: white !important;
    text-transform: uppercase;
    font-weight: 700;
    text-decoration: none !important;
}

body.is-desktop .ntes-link:hover {
    transform: scale(1.02);
}

body.is-desktop .ntes-link-live {
    background: linear-gradient(135deg, #FF9500, #FF5E3A);
    box-shadow: 0 2px 4px rgba(255, 149, 0, 0.3);
}

body.is-desktop .ntes-link-coach {
    background: linear-gradient(135deg, #AF52DE, #5856D6);
    box-shadow: 0 2px 4px rgba(175, 82, 222, 0.3);
}

body.is-desktop .ntes-link-schedule {
    background: linear-gradient(135deg, #007AFF, #00C7BE);
    box-shadow: 0 2px 4px rgba(0, 122, 255, 0.3);
}

.arrivals-count {
    font-size: 14px;
    color: var(--text-secondary);
    padding: 8px 0 16px;
    font-weight: 500;
}

/* ========== Live Station Card ========== */
.live-station-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--glass-border);
}

.live-station-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.live-station-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.station-code-badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 700;
    color: white;
    background: var(--ios-blue);
    border-radius: 6px;
    letter-spacing: 1px;
}

.station-name-text {
    font-size: 16px;
    font-weight: 700;
    color: var(--ios-blue);
    text-transform: uppercase;
}

.live-refresh-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    color: var(--ios-blue);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.live-refresh-btn:hover {
    background: var(--ios-blue);
    color: white;
    transform: rotate(180deg);
}

.live-refresh-btn:active {
    transform: rotate(360deg);
}

.time-filter-section {
    margin-bottom: 12px;
}

.time-filter-title {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    display: block;
    margin-bottom: 10px;
}

.station-train-count {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    padding: 8px;
    background: rgba(0, 122, 255, 0.1);
    border-radius: 8px;
}


/* Schedule Table */
.schedule-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.schedule-table th {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 10px;
    font-weight: 800;
    padding: 12px 8px;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 10;
}

.schedule-table td {
    padding: 12px 8px;
    border-bottom: 1px solid var(--glass-border);
    color: var(--text-primary);
}

.schedule-table tr:last-child td {
    border-bottom: none;
}

.schedule-table .st-name {
    font-weight: 600 !important;
    font-size: 13px !important;
}

.schedule-table .st-code {
    color: var(--ios-blue);
    font-weight: 700;
}

.schedule-table .st-time {
    font-family: monospace;
    font-weight: 700;
    font-size: 14px;
}

.schedule-table .st-day {
    color: var(--text-secondary);
    font-weight: 600;
}

.schedule-table tr.highlight {
    background: var(--ios-blue-light);
}

/* New Coach Position UI (NTES Style) */
.coach-modal-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    width: 95%;
    max-width: 500px;
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
}

.coach-modal-header {
    background: #ffa500;
    /* NTES Orange */
    padding: 24px;
    color: #000;
    position: relative;
    border-radius: 8px;
    margin: 10px;
}

.coach-modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.4;
}

.coach-modal-close-x {
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    font-size: 24px;
    cursor: pointer;
    background: none;
    border: none;
    color: #000;
}

.coach-modal-body {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
    background: var(--bg-primary);
}

.coach-section-title {
    background: var(--ios-orange-light);
    color: var(--ios-orange);
    padding: 10px 15px;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 12px;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.coach-grid {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding: 10px 5px 20px 5px;
    margin-bottom: 24px;
    scrollbar-width: thin;
    scrollbar-color: var(--ios-blue) transparent;
}

.coach-grid::-webkit-scrollbar {
    height: 6px;
}

.coach-grid::-webkit-scrollbar-thumb {
    background: var(--ios-blue);
    border-radius: 10px;
}

.coach-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 0 0 auto;
}

.coach-top-lbl {
    font-size: 10px;
    font-weight: 800;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
}

.coach-box {
    background: white;
    border: 2px solid #ddd;
    border-radius: 6px;
    padding: 8px 10px;
    min-width: 65px;
    font-weight: 800;
    font-size: 13px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
    color: #333;
}

.coach-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

/* Coach Type Colors */
.coach-box.coach-eng {
    background: #333;
    color: white;
    border-color: #000;
}

.coach-box.coach-gen {
    background: #f5f5f5;
    color: #333;
    border-color: #ccc;
}

.coach-box.coach-sl {
    background: #e3f2fd;
    color: #1565c0;
    border-color: #90caf9;
}

.coach-box.coach-3a {
    background: #e8f5e9;
    color: #2e7d32;
    border-color: #a5d6a7;
}

.coach-box.coach-2a {
    background: #fff3e0;
    color: #e65100;
    border-color: #ffccbc;
}

.coach-box.coach-1a {
    background: #fffde7;
    color: #fbc02d;
    border-color: #fff59d;
}

.coach-box.coach-cc {
    background: #f3e5f5;
    color: #7b1fa2;
    border-color: #ce93d8;
}

.coach-box.coach-2s {
    background: #fafafa;
    color: #616161;
    border-color: #e0e0e0;
}

.coach-box.coach-pc {
    background: #fff8e1;
    color: #ff8f00;
    border-color: #ffe082;
}

.coach-box.coach-slrd {
    background: #efebe9;
    color: #5d4037;
    border-color: #bcaaa4;
}

/* Dark Mode Fixes */
body.dark .coach-box {
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark .coach-box:not([class*="coach-"]) {
    background: #2c2c2e;
    color: #fff;
}

body.dark .coach-box.coach-gen {
    background: #2c2c2e;
    color: #eee;
    border-color: #444;
}

body.dark .coach-box.coach-sl {
    background: #1a237e;
    color: #fff;
    border-color: #283593;
}

body.dark .coach-box.coach-3a {
    background: #1b5e20;
    color: #fff;
    border-color: #2e7d32;
}

body.dark .coach-box.coach-2a {
    background: #bf360c;
    color: #fff;
    border-color: #d84315;
}

body.dark .coach-box.coach-1a {
    background: #fbc02d;
    color: #000;
    border-color: #fdd835;
}

body.dark .coach-box.coach-cc {
    background: #4a148c;
    color: #fff;
    border-color: #6a1b9a;
}

body.dark .coach-box.coach-pc {
    background: #ff6f00;
    color: #fff;
    border-color: #f57c00;
}

body.dark .coach-box.coach-slrd {
    background: #4e342e;
    color: #fff;
    border-color: #5d4037;
}

.coach-box.handicapped {
    border: 2px solid var(--ios-blue) !important;
}

.coach-box i.fa-wheelchair {
    color: inherit;
    font-size: 12px;
}

.coach-index {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 6px;
    font-weight: 700;
}

.divyangjan-note {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ff0000;
    font-weight: 700;
    font-size: 14px;
    margin-top: 10px;
}

.coach-dynamic-note {
    padding: 20px;
    border-top: 1px solid var(--bg-tertiary);
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.5;
}

.coach-modal-footer {
    padding: 20px;
    display: flex;
    justify-content: flex-end;
}

.coach-close-btn {
    background: #004a99;
    /* NTES Blue */
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
}

.coach-close-btn:hover {
    background: #003d7a;
}

/* --- TRAINS BETWEEN STATIONS --- */
.between-input-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--glass-border);
    margin-bottom: 24px;
    position: relative;
}

/* Between Station Dropdown */
.between-dropdown {
    position: absolute;
    left: 12px;
    right: 12px;
    max-height: 240px;
    overflow-y: auto;
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    border: 1px solid var(--glass-border);
    display: none;
}

.between-dropdown.show {
    display: block;
}

.between-dropdown-item {
    padding: 14px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--glass-border);
    transition: background 0.2s;
}

.between-dropdown-item:last-child {
    border-bottom: none;
}

.between-dropdown-item:hover {
    background: var(--bg-tertiary);
}

.between-dropdown-item .station-code {
    font-weight: 700;
    color: var(--ios-blue);
    font-size: 14px;
}

.between-dropdown-item .station-name {
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 2px;
}

/* Note: Between Recent Searches now uses standard .recent-bar styling */

.between-divider {
    position: relative;
    height: 1px;
    background: var(--glass-border);
    margin: 16px 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.swap-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: var(--ios-purple);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
    font-size: 14px;
}

.swap-btn:hover {
    transform: rotate(180deg);
    background: var(--ios-purple);
    color: white;
}

.station-input-row {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 12px;
    transition: all 0.2s;
}

.station-input-row:focus-within {
    box-shadow: 0 0 0 2px var(--ios-blue-light);
    background: var(--bg-secondary);
}

.input-icon {
    width: 32px;
    display: flex;
    justify-content: center;
    color: var(--text-secondary);
}

.station-input-row input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    outline: none;
}

.input-clear {
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 4px;
}

.input-clear:hover {
    color: var(--text-secondary);
}

.main-search-btn {
    width: 100%;
    margin-top: 20px;
    background: linear-gradient(135deg, var(--ios-blue), var(--ios-indigo));
    color: white;
    border: none;
    padding: 16px;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
    transition: all 0.2s;
}

.main-search-btn:active {
    transform: scale(0.98);
}

.result-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--glass-border);
    cursor: pointer;
    background: var(--bg-secondary);
}

.result-item:hover {
    background: var(--bg-primary);
}

.result-icon {
    width: 40px;
    height: 40px;
    background: var(--bg-tertiary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    color: var(--text-secondary);
}

.result-content {
    display: flex;
    flex-direction: column;
}

.result-name {
    font-weight: 600;
    color: var(--text-primary);
}

.result-sub {
    font-size: 12px;
    color: var(--text-secondary);
}

.v3-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    color: white;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
    text-align: center;
    max-width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.v3-toast.error {
    background: rgba(255, 59, 48, 0.9);
}


/* --- UTILITIES --- */
.hidden {
    display: none !important;
}


/* --- TRAINS BETWEEN STATIONS RESULTS --- */
.train-item-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--glass-border);
    transition: transform 0.2s;
}

.train-item-card:active {
    transform: scale(0.98);
}

.train-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.train-card-times {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.train-card-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--bg-tertiary);
    padding-top: 12px;
}

.days-row {
    display: flex;
    gap: 4px;
}


.train-name-banner {
    margin: 8px 0;
    font-size: 18px;
    font-weight: 800;
    background: var(--ios-red);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    display: inline-block;
    box-shadow: 0 4px 12px rgba(255, 59, 48, 0.3);
}

/* --- TRAINS BETWEEN CARD (Added for consistency) --- */
.train-between-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--glass-border);
    transition: all 0.2s var(--ease-spring);
    cursor: pointer;
}

.train-between-card:hover {
    background: var(--bg-tertiary);
    transform: translateY(-2px);
    border-color: var(--ios-blue);
    box-shadow: var(--shadow-md);
}

.train-between-card .train-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.train-between-card .train-no {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.train-between-card .train-name-sub {
    font-size: 13px;
    color: var(--text-secondary);
    width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.train-between-card .travel-time-badge {
    background: var(--bg-tertiary);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Ensure contrast on hover for the badge inside the card */
.train-between-card:hover .travel-time-badge {
    background: var(--bg-secondary);
}

.train-between-card .train-card-times {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.train-between-card .time-val {
    font-size: 16px;
    font-weight: 600;
    display: block;
    color: var(--text-primary);
}

.train-between-card .stn-code {
    font-size: 12px;
    color: var(--text-secondary);
}

.train-between-card .duration-line {
    flex: 1;
    margin: 0 12px;
    text-align: center;
    position: relative;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.train-between-card .line-graphic {
    height: 2px;
    background: var(--text-tertiary);
    width: 100%;
    position: absolute;
    z-index: 0;
}

.train-between-card .train-icon-center {
    position: relative;
    z-index: 1;
    background: var(--bg-secondary);
    padding: 0 6px;
    color: var(--ios-blue);
    font-size: 14px;
}

.train-between-card:hover .train-icon-center {
    background: var(--bg-tertiary);
}

.train-between-card .train-card-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--glass-border);
    padding-top: 12px;
}

.train-between-card .avail-btn {
    background: var(--ios-green);
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s;
}

.train-between-card .avail-btn:active {
    transform: scale(0.95);
}


/* --- TRAINS BETWEEN FILTERS --- */
.between-filters-bar {
    display: flex;
    flex-wrap: wrap;
    /* Wrap buttons so they don't go off screen */
    gap: 8px;
    padding: 0 0 12px 0;
    margin-bottom: 8px;
    /* Removed overflow-x: auto to prevent hiding content */
}

.between-filters-bar::-webkit-scrollbar {
    display: none;
}

.filter-chip {
    padding: 8px 16px;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-chip.active {
    background: var(--ios-blue);
    color: white;
    border-color: var(--ios-blue);
    box-shadow: 0 4px 10px rgba(0, 122, 255, 0.3);
}

.filter-chip i {
    font-size: 12px;
}

/* --- UPDATED TRAIN CARD HEADER (Badge + Name) --- */
.train-between-card .train-card-header-new {
    display: flex;
    align-items: center;
    gap: 6px;
}

.train-badge-sm {
    background: var(--ios-blue);
    /* Default Blue */
    color: white;
    font-size: 13px;
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

/* Dynamic Badge Colors based on type (applied via JS classes usually, or generic) */
.train-badge-sm.sf {
    background: #FF9500;
}

/* Orange */
.train-badge-sm.raj {
    background: #FF3B30;
}

/* Red */
.train-badge-sm.sht {
    background: #007AFF;
}

/* Blue */
.train-badge-sm.exp {
    background: #34C759;
}

/* Green */

.train-name-lg {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

@media (max-width: 360px) {
    .train-name-lg {
        max-width: 150px;
    }
}


/* --- SORTING BAR --- */
.sorting-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 8px;
}

.sort-btn {
    background: transparent;
    border: none;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: all 0.2s;
}

.sort-btn:hover {
    background: var(--bg-tertiary);
}

.sort-btn.active {
    color: var(--ios-blue);
    background: var(--ios-blue-light);
}

.sort-btn i {
    font-size: 10px;
}

/* --- ACTION BUTTONS ROW --- */
.action-btn-row {
    display: flex;
    justify-content: flex-end;
    /* Align to right */
    gap: 8px;
    border-top: 1px solid var(--glass-border);
    padding-top: 12px;
    margin-top: 12px;
}

.action-btn {
    padding: 6px 12px;
    border-radius: 15px;
    /* Pill shape */
    font-size: 11px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: transform 0.1s;
}

.action-btn.secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.action-btn.primary {
    background: var(--ios-blue);
    color: white;
}

.action-btn.accent {
    background: var(--ios-green);
    color: white;
}

.action-btn:active {
    transform: scale(0.95);
}


/* ==========================================================================
   TRIP CARD STYLES - Destination-based Journey Information
   ========================================================================== */

.trip-card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    overflow: hidden;
    animation: slide-up 0.4s var(--ease-spring);
}

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.trip-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--ios-purple) 0%, var(--ios-indigo) 100%);
    color: white;
}

.trip-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
}

.trip-card-title i {
    font-size: 20px;
}

.trip-card-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s;
}

.trip-card-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Trip Header Actions */
.trip-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.trip-share-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s;
}

.trip-share-btn:hover {
    background: var(--ios-green);
    transform: scale(1.1);
}

.trip-share-btn:active {
    transform: scale(0.95);
}

.trip-destination-select {
    padding: 16px 20px;
    border-bottom: 1px solid var(--glass-border);
}

.trip-destination-select label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.trip-destination-select select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--bg-tertiary);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238E8E93' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}

.trip-destination-select select:focus {
    outline: none;
    border-color: var(--ios-purple);
    box-shadow: 0 0 0 4px rgba(175, 82, 222, 0.15);
}

.trip-details {
    padding: 20px;
}

/* Trip Info Grid */
.trip-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.trip-info-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
}

.trip-info-item.highlight {
    background: linear-gradient(135deg, rgba(175, 82, 222, 0.1) 0%, rgba(88, 86, 214, 0.1) 100%);
    border-color: rgba(175, 82, 222, 0.3);
}

.trip-info-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--ios-purple) 0%, var(--ios-indigo) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    flex-shrink: 0;
}

.trip-info-icon.speed {
    background: linear-gradient(135deg, var(--ios-orange) 0%, #FF6B00 100%);
}

.trip-info-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.trip-info-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.trip-info-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.trip-info-sub {
    font-size: 12px;
    font-weight: 600;
    color: var(--ios-green);
}

.trip-info-sub.late {
    color: var(--ios-red);
}

/* Trip Stations Row */
.trip-stations-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    position: relative;
}

.trip-station-box {
    flex: 1;
    padding: 14px;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.trip-station-box.prev {
    text-align: left;
    margin-right: 24px;
}

.trip-station-box.next {
    text-align: right;
    margin-left: 24px;
}

.trip-station-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 6px;
}

.trip-station-box.next .trip-station-label {
    justify-content: flex-end;
}

.trip-station-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.trip-station-code {
    font-size: 12px;
    font-weight: 600;
    color: var(--ios-blue);
}

.trip-train-icon {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ios-orange) 0%, #FF6B00 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    box-shadow: 0 4px 12px rgba(255, 149, 0, 0.4);
    animation: train-bob 2s ease-in-out infinite;
    z-index: 5;
}

@keyframes train-bob {

    0%,
    100% {
        transform: translateX(-50%) translateY(0);
    }

    50% {
        transform: translateX(-50%) translateY(-4px);
    }
}

/* Trip Timeline Section */
.trip-timeline-section {
    margin-bottom: 20px;
}

.trip-timeline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.trip-timeline-header span:first-child {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.trip-timeline-header span:first-child i {
    color: var(--ios-purple);
}

.trip-progress-text {
    font-size: 14px;
    font-weight: 800;
    color: var(--ios-purple);
}

.trip-timeline-bar {
    height: 12px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    position: relative;
    overflow: visible;
}

.trip-timeline-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--ios-green) 0%, var(--ios-blue) 50%, var(--ios-purple) 100%);
    border-radius: 6px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
}

.trip-timeline-train {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 28px;
    height: 28px;
    background: var(--ios-orange);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    box-shadow: 0 2px 8px rgba(255, 149, 0, 0.5);
    border: 3px solid var(--bg-secondary);
    transition: left 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    left: 0%;
    animation: trip-train-pulse 2s ease-in-out infinite;
}

@keyframes trip-train-pulse {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 2px 8px rgba(255, 149, 0, 0.5);
    }

    50% {
        transform: translate(-50%, -50%) scale(1.15);
        box-shadow: 0 4px 16px rgba(255, 149, 0, 0.7);
    }
}

.trip-timeline-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Trip Stats Row */
.trip-stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.trip-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 14px 10px;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    text-align: center;
}

.trip-stat i {
    font-size: 18px;
    color: var(--ios-blue);
}

.trip-stat span {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-primary);
}

.trip-stat small {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}

/* Responsive adjustments for trip card */
@media (max-width: 400px) {
    .trip-info-grid {
        grid-template-columns: 1fr;
    }

    .trip-stats-row {
        grid-template-columns: 1fr;
    }

    .trip-station-box.prev,
    .trip-station-box.next {
        margin: 0;
    }

    .trip-stations-row {
        flex-direction: column;
        gap: 40px;
    }

    .trip-train-icon {
        position: relative;
        left: auto;
        transform: none;
    }
}

/* ==========================================================================
   MAP NAVIGATION & ORIENTATION STYLES
   ========================================================================== */

/* Compass Button Active State */
.map-ctrl-btn.active {
    background: var(--ios-blue);
    color: white;
}

.map-ctrl-btn.active:hover {
    background: var(--ios-blue);
    color: white;
    transform: scale(1.05);
}

/* Compass rotation animation */
.map-ctrl-btn .fa-compass {
    transition: transform 0.5s ease;
}

.map-ctrl-btn.rotated .fa-compass {
    transform: rotate(45deg);
}

/* Navigation Mode Button */
#btn-map-nav.active {
    background: linear-gradient(135deg, var(--ios-purple), var(--ios-indigo));
    color: white;
    box-shadow: 0 4px 12px rgba(175, 82, 222, 0.4);
}

/* Follow Train Button */
#btn-map-follow.active {
    background: linear-gradient(135deg, #00c853, #00e676);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 200, 83, 0.4);
}

#btn-map-follow.active i {
    animation: pulse-follow 1.5s infinite;
}

@keyframes pulse-follow {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

/* Center on Train Button */
#btn-map-center.active {
    background: var(--ios-blue);
    color: white;
}

/* Map Navigation Overlay */
.map-nav-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--glass-bg-heavy);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    border-radius: 20px 20px 0 0;
    padding: 16px;
    z-index: 1001;
    transform: translateY(100%);
    transition: transform 0.4s var(--ease-spring);
    max-height: 280px;
}

.map-nav-overlay.visible {
    transform: translateY(0);
}

/* No Trip Warning in Navigation */
.map-nav-no-trip {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(255, 149, 0, 0.15), rgba(255, 204, 0, 0.1));
    border-radius: 12px;
    border: 1px solid rgba(255, 149, 0, 0.3);
}

.map-nav-no-trip>i {
    font-size: 24px;
    color: var(--ios-orange);
    flex-shrink: 0;
}

.map-nav-no-trip .no-trip-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.map-nav-no-trip .no-trip-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.map-nav-no-trip .no-trip-hint {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.3;
}

.map-nav-no-trip .no-trip-btn {
    background: var(--ios-orange);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.map-nav-no-trip .no-trip-btn:hover {
    background: #e68a00;
    transform: scale(1.02);
}

#map-nav-content.hidden {
    display: none;
}

.map-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.map-nav-dest {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.map-nav-dest i {
    color: var(--ios-purple);
    font-size: 18px;
}

.map-nav-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.map-nav-close:hover {
    background: var(--ios-blue);
    color: white;
}

/* Navigation Stats Row */
.map-nav-stats {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 10px 0;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    margin-bottom: 0;
}

.map-nav-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.map-nav-stat.primary .map-nav-value {
    color: var(--ios-purple);
    font-size: 20px;
}

.map-nav-value {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-primary);
}

.map-nav-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.map-nav-divider {
    width: 1px;
    height: 40px;
    background: var(--bg-tertiary);
}

/* Navigation Progress Bar */
.map-nav-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.map-nav-progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.map-nav-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--ios-green), var(--ios-blue), var(--ios-purple));
    border-radius: 4px;
    transition: width 0.6s var(--ease-smooth);
    width: 0%;
}

.map-nav-stations {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* Next Station Box */
.map-nav-next-station {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: linear-gradient(135deg, rgba(255, 149, 0, 0.1), rgba(255, 107, 0, 0.05));
    border: 1px solid rgba(255, 149, 0, 0.3);
    border-radius: var(--radius-md);
}

.map-nav-next-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--ios-orange);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    animation: pulse-arrow 1.5s ease-in-out infinite;
}

@keyframes pulse-arrow {

    0%,
    100% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(4px);
    }
}

.map-nav-next-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.map-nav-next-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.map-nav-next-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.map-nav-next-time {
    font-size: 16px;
    font-weight: 800;
    color: var(--ios-orange);
}

/* Map in Navigation Mode - Always fullscreen */
.map-container-v3.nav-mode {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh !important;
    z-index: 9999;
    border-radius: 0;
}

.map-container-v3.nav-mode #v3-map {
    height: 100vh !important;
}

/* Destination marker on map */
.dest-marker-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--ios-purple), var(--ios-indigo));
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid white;
    box-shadow: 0 4px 12px rgba(175, 82, 222, 0.5);
}

.dest-marker-icon i {
    transform: rotate(45deg);
    color: white;
    font-size: 12px;
}

/* Route highlight on map */
.route-highlight {
    stroke: var(--ios-purple);
    stroke-width: 5;
    stroke-dasharray: 10, 5;
    animation: route-dash 1s linear infinite;
}

@keyframes route-dash {
    to {
        stroke-dashoffset: -15;
    }
}

/* Responsive */
@media (max-width: 400px) {
    .map-nav-stats {
        padding: 12px 8px;
    }

    .map-nav-value {
        font-size: 16px;
    }

    .map-nav-stat.primary .map-nav-value {
        font-size: 20px;
    }
}

/* ==========================================================================
   SEAT AVAILABILITY STYLES (IRCTC-like)
   ========================================================================== */

.avl-search-card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
}

.avl-form-header {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--ios-green);
}

.avl-form-header i {
    color: var(--ios-green);
    font-size: 22px;
}

.avl-input-group {
    margin-bottom: 16px;
    position: relative;
}

.avl-input-group.half {
    flex: 1;
    position: relative;
}

.avl-input-group label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.avl-input-group label i {
    color: var(--ios-green);
    margin-right: 6px;
}

.avl-input-row {
    display: flex;
    gap: 4px;
    /* Reduced to 4px as per user feedback */
}

.avl-input-group input[type="text"],
.avl-input-group input[type="date"],
.avl-input-group select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--bg-tertiary);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    transition: all 0.2s;
}

.avl-input-group input:focus,
.avl-input-group select:focus {
    outline: none;
    border-color: var(--ios-green);
    box-shadow: 0 0 0 4px rgba(52, 199, 89, 0.15);
}

.avl-search-icon {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--ios-green);
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.avl-search-icon:hover {
    background: #2fb84e;
    transform: scale(1.05);
}

/* Train Suggestions Dropdown */
.avl-suggestions {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    margin-top: 8px;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
}

.avl-suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--glass-border);
    transition: background 0.2s;
}

.avl-suggestion-item:last-child {
    border-bottom: none;
}

.avl-suggestion-item:hover {
    background: var(--ios-green-light);
}

.avl-suggestion-item .train-no {
    font-weight: 800;
    color: var(--ios-green);
    margin-right: 8px;
}

.avl-suggestion-item .train-name {
    font-weight: 600;
    color: var(--text-primary);
}

/* Selected Train Info */
.avl-train-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: linear-gradient(135deg, rgba(52, 199, 89, 0.1), rgba(52, 199, 89, 0.05));
    border: 1px solid rgba(52, 199, 89, 0.3);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.avl-train-badge {
    padding: 8px 14px;
    background: linear-gradient(135deg, var(--ios-green), #2fb84e);
    color: white;
    font-size: 14px;
    font-weight: 800;
    border-radius: 8px;
    min-width: 70px;
    text-align: center;
}

.avl-train-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.avl-train-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: normal;
    overflow: visible;
    word-break: break-word;
    text-transform: uppercase;
}

.avl-train-route {
    font-size: 12px;
    color: var(--text-secondary);
}

.avl-train-days {
    display: flex;
    gap: 4px;
}

.avl-day-chip {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.avl-day-chip.active {
    background: var(--ios-green);
    color: white;
}

/* Station Row */
.avl-station-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-bottom: 16px;
    position: relative;
    z-index: 10;
}

.avl-swap-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 4px;
    color: var(--text-secondary);
}

.avl-swap-btn:hover {
    background: var(--ios-green);
    color: white;
    transform: rotate(180deg);
}

/* Class Chips */
.avl-class-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.avl-class-chip {
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 70px;
}

.avl-class-chip .chip-code {
    font-size: 15px;
    font-weight: 800;
}

.avl-class-chip .chip-name {
    font-size: 9px;
    font-weight: 600;
    opacity: 0.8;
}

.avl-class-chip:hover {
    border-color: var(--ios-green);
    color: var(--ios-green);
}

.avl-class-chip.selected {
    background: var(--ios-green);
    color: white;
    border-color: var(--ios-green);
}

.avl-class-chip.selected .chip-name {
    opacity: 1;
}

/* Check Button */
.avl-check-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--ios-green), #2fb84e);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 8px;
}

.avl-check-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 199, 89, 0.4);
}

.avl-check-btn:active {
    transform: translateY(0);
}

/* Results Section */
.avl-results {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 20px;
}

.avl-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--ios-green), #2fb84e);
    color: white;
}

.avl-results-train {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avl-results-badge {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 800;
}

.avl-results-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.avl-results-info span:first-child {
    font-size: 16px;
    font-weight: 700;
}

.avl-results-info span:last-child {
    font-size: 12px;
    opacity: 0.8;
}

.avl-results-class {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 700;
}

/* Availability Table */
.avl-table-wrapper {
    overflow-x: auto;
}

.avl-table {
    width: 100%;
    border-collapse: collapse;
}

.avl-table th,
.avl-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

.avl-table th {
    background: var(--bg-primary);
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.avl-table td {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.avl-table tr:hover {
    background: var(--bg-primary);
}

/* Availability Status Badges */
.avl-status {
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 700;
    display: inline-block;
}

.avl-status.available {
    background: rgba(52, 199, 89, 0.15);
    color: var(--ios-green);
}

.avl-status.rac {
    background: rgba(255, 149, 0, 0.15);
    color: var(--ios-orange);
}

.avl-status.wl {
    background: rgba(255, 59, 48, 0.15);
    color: var(--ios-red);
}

.avl-status.regret {
    background: rgba(142, 142, 147, 0.15);
    color: var(--text-secondary);
}

.avl-status.gnwl {
    background: rgba(88, 86, 214, 0.15);
    color: var(--ios-indigo);
}

.avl-status.pqwl {
    background: rgba(175, 82, 222, 0.15);
    color: var(--ios-purple);
}

/* Fare Info */
.avl-fare-info {
    padding: 16px 20px;
    border-top: 1px solid var(--glass-border);
}

.avl-fare-header {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.avl-fare-header i {
    color: var(--ios-green);
}

.avl-fare-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.avl-fare-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
}

.avl-fare-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.avl-fare-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.avl-fare-item.total {
    grid-column: span 2;
    background: linear-gradient(135deg, rgba(52, 199, 89, 0.1), rgba(52, 199, 89, 0.05));
    border: 1px solid rgba(52, 199, 89, 0.3);
}

.avl-fare-item.total .avl-fare-value {
    color: var(--ios-green);
    font-size: 18px;
}

/* Book Button */
.avl-book-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    margin: 16px 20px 20px;
    background: linear-gradient(135deg, var(--ios-blue), var(--ios-indigo));
    color: white;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 700;
    transition: all 0.2s;
}

.avl-book-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 122, 255, 0.4);
}

/* Recent Searches */
.avl-recent {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow-sm);
}

.avl-recent-header {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.avl-recent-header i {
    color: var(--ios-blue);
}

.avl-recent-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.avl-recent-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
}

.avl-recent-item:hover {
    background: var(--ios-green-light);
    transform: translateX(4px);
}

.avl-recent-item .train-no {
    font-weight: 800;
    color: var(--ios-green);
}

.avl-recent-item .route {
    flex: 1;
    font-size: 13px;
    color: var(--text-secondary);
}

.avl-recent-item .class-badge {
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
}

/* Loading State */
.avl-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 16px;
}

.avl-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--card-bg);
    border-top-color: var(--ios-green);
    border-radius: 50%;
    animation: spin-refresh 1s linear infinite;
}

.avl-loading i {
    font-size: 40px;
    color: var(--ios-green);
    animation: spin-refresh 1s linear infinite;
}

.avl-loading span {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Autocomplete Dropdown */
.avl-autocomplete-wrapper {
    position: relative;
}

.avl-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    max-height: 250px;
    overflow-y: auto;
    display: none;
    margin-top: 4px;
}

.avl-dropdown.show {
    display: block;
}

.avl-dropdown-item {
    padding: 14px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--glass-border);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.avl-dropdown-item:last-child {
    border-bottom: none;
}

.avl-dropdown-item:hover {
    background: var(--ios-green-light);
}

.avl-dropdown-item.no-results {
    color: var(--text-secondary);
    font-style: italic;
    cursor: default;
}

.avl-dropdown-item.no-results:hover {
    background: transparent;
}

.avl-dropdown-item .avl-train-num {
    font-weight: 800;
    color: var(--ios-green);
    min-width: 60px;
}

.avl-dropdown-item .avl-train-name {
    font-weight: 600;
    color: var(--text-primary);
}

/* Swap Button */
.avl-swap-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 2px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 4px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.avl-swap-btn:hover {
    background: var(--ios-green);
    border-color: var(--ios-green);
    color: white;
}

/* Results Section Enhancements */
.avl-results {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--glass-border);
    margin-bottom: 20px;
    display: none;
}

.avl-results.show {
    display: block;
}

.avl-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--ios-green), #2fb84e);
    color: white;
}

.avl-train-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avl-train-badge {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 800;
}

.avl-train-title {
    font-size: 16px;
    font-weight: 700;
}

.avl-route-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    opacity: 0.9;
}

/* Results Table Container */
.avl-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.avl-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px;
}

.avl-table th,
.avl-table td {
    padding: 12px 14px;
    text-align: center;
    border-bottom: 1px solid var(--glass-border);
}

.avl-table th {
    background: var(--bg-primary);
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
}

.avl-table th:first-child {
    text-align: left;
    padding-left: 20px;
}

.avl-class-cell {
    font-weight: 800;
    color: var(--ios-green);
    text-align: left !important;
    padding-left: 20px !important;
}

.avl-status-cell {
    cursor: pointer;
    transition: all 0.2s;
    padding: 8px 6px;
}

.avl-status-cell:hover {
    background: var(--bg-primary);
}

.avl-status-cell .avl-status {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 6px;
    display: inline-block;
    margin-bottom: 2px;
}

.avl-status-cell .avl-fare {
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 600;
}

.avl-status-cell.available .avl-status {
    background: rgba(52, 199, 89, 0.15);
    color: var(--ios-green);
}

.avl-status-cell.rac .avl-status {
    background: rgba(255, 149, 0, 0.15);
    color: var(--ios-orange);
}

.avl-status-cell.waiting .avl-status {
    background: rgba(255, 204, 0, 0.15);
    color: #b8860b;
}

.avl-status-cell.regret .avl-status {
    background: rgba(142, 142, 147, 0.15);
    color: var(--text-secondary);
}

/* Legend */
.avl-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 14px 20px;
    background: var(--bg-primary);
    border-top: 1px solid var(--glass-border);
}

.avl-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-secondary);
}

.avl-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.avl-dot.available {
    background: var(--ios-green);
}

.avl-dot.rac {
    background: var(--ios-orange);
}

.avl-dot.waiting {
    background: #e6b800;
}

.avl-dot.regret {
    background: var(--text-secondary);
}

/* Fare Breakdown Section */
.avl-fare-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--glass-border);
    margin-bottom: 20px;
    display: none;
}

.avl-fare-section.show {
    display: block;
}

.avl-fare-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--glass-border);
}

.avl-fare-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.avl-fare-status {
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 700;
}

.avl-fare-status.available {
    background: rgba(52, 199, 89, 0.15);
    color: var(--ios-green);
}

.avl-fare-status.rac {
    background: rgba(255, 149, 0, 0.15);
    color: var(--ios-orange);
}

.avl-fare-status.waiting {
    background: rgba(255, 204, 0, 0.15);
    color: #b8860b;
}

.avl-fare-status.regret {
    background: rgba(142, 142, 147, 0.15);
    color: var(--text-secondary);
}

.avl-fare-details {
    padding: 16px 20px;
}

.avl-fare-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

.avl-fare-meta i {
    color: var(--ios-green);
    margin-right: 6px;
}

.avl-fare-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--glass-border);
    font-size: 14px;
}

.avl-fare-row:last-of-type {
    border-bottom: none;
}

.avl-fare-row span:first-child {
    color: var(--text-secondary);
}

.avl-fare-row span:last-child {
    font-weight: 600;
    color: var(--text-primary);
}

.avl-fare-row.total {
    padding-top: 14px;
    margin-top: 6px;
    border-top: 2px solid var(--ios-green);
    border-bottom: none;
}

.avl-fare-row.total span:first-child {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.avl-fare-row.total span:last-child {
    font-size: 20px;
    font-weight: 800;
    color: var(--ios-green);
}

/* Book Button in Fare Section */
.avl-fare-section .avl-book-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    margin: 0 20px 20px;
    background: linear-gradient(135deg, var(--ios-green), #2fb84e);
    color: white;
    text-decoration: none;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    width: calc(100% - 40px);
}

.avl-fare-section .avl-book-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 199, 89, 0.4);
}

.avl-fare-section .avl-book-btn.wl {
    background: linear-gradient(135deg, var(--ios-orange), #e68a00);
}

.avl-fare-section .avl-book-btn.wl:hover {
    box-shadow: 0 6px 20px rgba(255, 149, 0, 0.4);
}

.avl-regret-msg {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    margin: 0 20px 20px;
    background: rgba(255, 59, 48, 0.1);
    border-radius: var(--radius-md);
    color: var(--ios-red);
    font-size: 14px;
    font-weight: 600;
}

.avl-regret-msg i {
    font-size: 20px;
}

/* Train Results List */
.avl-train-results {
    display: none;
    margin-bottom: 20px;
}

.avl-train-results.show {
    display: block;
}

.avl-train-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border: 1px solid var(--glass-border);
    border-bottom: none;
}

.avl-train-list-header span:first-child {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.avl-date-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--ios-blue);
    color: white;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
}

/* Note: Avl Recent Searches now uses standard .recent-bar styling */

.avl-train-list {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    overflow: hidden;
}

.avl-train-card {
    padding: 16px;
    border-bottom: 1px solid var(--glass-border);
    cursor: pointer;
    transition: all 0.2s;
}

.avl-train-card:last-child {
    border-bottom: none;
}

.avl-train-card:hover {
    background: var(--bg-primary);
}

.avl-train-card:active {
    transform: scale(0.99);
}

.avl-train-card-header {
    display: flex;
    align-items: flex-start;
    /* Align to top so wrap doesn't go under badge */
    gap: 10px;
    margin-bottom: 12px;
}

.avl-train-card-header .avl-train-badge {
    padding: 4px 10px;
    background: linear-gradient(135deg, var(--ios-green), #2fb84e);
    color: white;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 800;
    flex-shrink: 0;
    /* Don't squish badge */
    margin-top: 2px;
    /* Visual tweak for alignment */
}

.avl-train-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    word-break: break-word;
    text-transform: uppercase;
    line-height: 1.25;
    flex: 1;
    /* Take remaining space */
}

.avl-train-card-times {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.avl-time-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.avl-time-block .avl-time {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-primary);
}

.avl-time-block .avl-stn {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
}

.avl-duration {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 0 20px;
}

.avl-duration-line {
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--ios-green), var(--ios-blue));
    border-radius: 2px;
    position: relative;
}

.avl-duration-line::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: var(--ios-green);
    border-radius: 50%;
}

.avl-duration-line::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: var(--ios-blue);
    border-radius: 50%;
}

.avl-duration span {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
}

.avl-train-card-classes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.avl-class-tag {
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
}

.avl-train-card-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: linear-gradient(135deg, rgba(52, 199, 89, 0.1), rgba(52, 199, 89, 0.05));
    border: 1px solid rgba(52, 199, 89, 0.2);
    border-radius: var(--radius-md);
    color: var(--ios-green);
    font-size: 13px;
    font-weight: 700;
}

.avl-train-card-action i {
    font-size: 12px;
}

/* No Results State */
.avl-no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
}

.avl-no-results i {
    font-size: 48px;
    color: var(--text-secondary);
    opacity: 0.3;
    margin-bottom: 16px;
}

.avl-no-results p {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px;
}

.avl-no-results span {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Quota Info */
.avl-quota-info {
    padding: 10px 20px;
    background: var(--bg-primary);
    font-size: 12px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--glass-border);
}

.avl-quota-info strong {
    color: var(--ios-green);
}

/* Back Button */
.avl-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: calc(100% - 40px);
    margin: 16px 20px 20px;
    padding: 14px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.avl-back-btn:hover {
    background: var(--bg-primary);
}

/* Share Button */
.trip-share-btn {
    width: 100%;
    padding: 12px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.trip-share-btn:hover {
    background: var(--ios-orange);
    color: #fff;
    border-color: var(--ios-orange);
}

.trip-share-btn:active {
    transform: scale(0.98);
}

/* Date Badge */
.date-badge {
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* Responsive */
@media (max-width: 500px) {
    .avl-station-row {
        flex-direction: column;
        align-items: stretch;
    }

    .avl-input-group.half {
        width: 100%;
    }

    .avl-swap-btn {
        align-self: center;
        transform: rotate(90deg);
        margin: -10px 0;
        /* Pull inputs closer together */
        position: relative;
        z-index: 5;
        border: 2px solid var(--bg-secondary);
        /* Add border to make it pop over inputs */
    }

    .avl-swap-btn:hover {
        transform: rotate(270deg);
    }

    .avl-fare-grid {
        grid-template-columns: 1fr;
    }

    .avl-fare-item.total {
        grid-column: span 1;
    }

    .avl-class-chips {
        justify-content: center;
    }
}

/* ==========================================================================
   ADVERTISEMENT STYLES
   ========================================================================== */

/* Ad Container Base */
.ad-container {
    display: none;
    margin: 16px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-secondary);
    box-shadow: var(--shadow-sm);
}

.ad-container.visible {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Hide empty ad banner */
#ad-banner-home:empty {
    display: none;
}

/* Promotion Banner - Separate from Ad Banner */

.promo-banner {
    width: 100%;
    margin: 16px 0;
    padding: 20px;
    background: linear-gradient(90deg, #FF6B35 0%, #fff 50%, #138808 100%);
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
}

body.dark .promo-banner {
    background: linear-gradient(90deg, #FF6B35 0%, #222 50%, #138808 100%);
}

.promo-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.promo-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 600;
}

.promo-text {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
}

.promo-text i {
    font-size: 24px;
    color: #fff;
}

.promo-subtitle {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

/* Banner Ad - for AdMob */

.ad-banner {
    min-height: 100px;
    background: linear-gradient(90deg, #FF6B35 0%, #fff 50%, #138808 100%);
}

body.dark .ad-banner {
    background: linear-gradient(90deg, #FF6B35 0%, #222 50%, #138808 100%);
}

.ad-banner.visible {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Test Ad Banner */
.test-ad-banner {
    width: 100%;
    padding: 16px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px dashed var(--text-tertiary);
    border-radius: 12px;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.dark .test-ad-banner {
    background: linear-gradient(135deg, #2c2c2e 0%, #1c1c1e 100%);
}

.test-ad-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
}

.test-ad-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-tertiary);
}

.test-ad-text {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 700;
}

.test-ad-text i {
    font-size: 32px;
    color: #FF6B35;
}

.test-ad-size {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Fallback Ad */
.fallback-ad {
    padding: 12px;
}

.fallback-ad a {
    text-decoration: none;
}

.fallback-ad-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--ios-blue) 0%, var(--ios-indigo) 100%);
    border-radius: 10px;
    color: white;
    font-size: 13px;
    font-weight: 500;
}

.fallback-ad-content i {
    font-size: 20px;
}

/* Ad Loading State */
.ad-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    color: var(--text-tertiary);
    font-size: 12px;
}

.ad-loading i {
    font-size: 16px;
    color: var(--ios-blue);
}

/* Promo Banner (Web fallback) */
.promo-banner {
    width: 100%;
    padding: 12px 16px;
    background: linear-gradient(135deg, #FF6B35 0%, #F7931E 50%, #138808 100%);
    border-radius: 10px;
}

.promo-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: white;
}

.promo-content>i {
    font-size: 24px;
    animation: trainMove 2s ease-in-out infinite;
}

@keyframes trainMove {

    0%,
    100% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(5px);
    }
}

.promo-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.promo-title {
    font-size: 16px;
    font-weight: 700;
}

.promo-title .brand-rail {
    color: #FFFFFF;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.promo-title .brand-bharat {
    color: #90EE90;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.promo-subtitle {
    font-size: 11px;
    opacity: 0.9;
}

/* Interstitial Overlay */
.interstitial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    animation: fadeIn 0.3s ease;
}

.interstitial-overlay.closing {
    animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

.interstitial-container {
    width: 90%;
    max-width: 340px;
    background: var(--bg-secondary);
    border-radius: 20px;
    overflow: hidden;
    animation: scaleIn 0.3s var(--ease-spring);
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.interstitial-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-tertiary);
}

.interstitial-header .ad-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-tertiary);
}

.interstitial-close {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-secondary);
    border: none;
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
}

.interstitial-close i {
    display: none;
}

.close-timer {
    font-weight: 700;
    color: var(--ios-red);
}

.interstitial-content {
    padding: 30px 20px;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Test Interstitial */
.test-interstitial {
    text-align: center;
}

.test-interstitial-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, var(--ios-blue-light) 0%, var(--ios-purple-light) 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.test-interstitial-icon i {
    font-size: 36px;
    color: var(--ios-blue);
}

.test-interstitial h3 {
    margin: 0 0 8px;
    font-size: 20px;
    color: var(--text-primary);
}

.test-interstitial p {
    margin: 0 0 16px;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.test-ad-info {
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    font-size: 11px;
    color: var(--text-tertiary);
}

/* Native Ad in Feed */
.native-ad-card {
    margin: 12px 16px;
    background: var(--bg-secondary);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--glass-border);
}

.native-ad-inner {
    padding: 16px;
}

.native-ad-label {
    display: inline-block;
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-tertiary);
    margin-bottom: 12px;
}

.native-ad-body {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
}

.native-ad-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--ios-orange-light) 0%, var(--ios-red-light) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.native-ad-icon i {
    font-size: 22px;
    color: var(--ios-orange);
}

.native-ad-text h4 {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.native-ad-text p {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.native-ad-cta {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--ios-blue) 0%, var(--ios-indigo) 100%);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.native-ad-cta:active {
    transform: scale(0.98);
}

/* Rewarded Ad */
.rewarded-container {
    text-align: center;
}

.rewarded-header {
    padding: 24px 20px 16px;
}

.rewarded-header i {
    font-size: 40px;
    color: var(--ios-orange);
    margin-bottom: 12px;
}

.rewarded-header h3 {
    margin: 0 0 6px;
    font-size: 20px;
    color: var(--text-primary);
}

.rewarded-header p {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.rewarded-content {
    padding: 20px;
}

.test-rewarded .test-video-placeholder {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, #1c1c1e 0%, #2c2c2e 100%);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: white;
}

.test-video-placeholder i {
    font-size: 48px;
    opacity: 0.7;
    animation: pulse 1.5s infinite;
}

.test-video-placeholder span {
    font-size: 13px;
    opacity: 0.6;
}

.rewarded-progress {
    height: 6px;
    background: var(--bg-tertiary);
    margin: 0 20px;
    border-radius: 3px;
    overflow: hidden;
}

.rewarded-progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--ios-green) 0%, var(--ios-blue) 100%);
    transition: width 0.5s ease;
}

.rewarded-timer {
    padding: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

.rewarded-timer span {
    font-weight: 700;
    color: var(--ios-blue);
}

/* Premium Badge (No Ads) */
.premium-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    color: #1c1c1e;
    text-transform: uppercase;
}

.premium-badge i {
    font-size: 10px;
}

/* ==========================================================================
   TRAIN SCANNER MAP MODAL
   ========================================================================== */
.train-scanner-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    animation: scannerFadeIn 0.3s ease;
}

.train-scanner-modal.hidden {
    display: none;
}

@keyframes scannerFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.scanner-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 50px 16px 12px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 100%);
    pointer-events: none;
    /* Let clicks pass through transparent areas */
}

.scanner-header * {
    pointer-events: auto;
    /* Re-enable clicks for children */
}

.scanner-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #00FF88;
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.scanner-title i {
    font-size: 20px;
    animation: scannerPulse 2s ease-in-out infinite;
}

.scanner-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.scanner-action-btn,
.scanner-close-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.scanner-action-btn:hover,
.scanner-close-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.scanner-action-btn.active {
    background: rgba(0, 255, 136, 0.2);
    border-color: #00FF88;
    color: #00FF88;
}

.scanner-map {
    flex: 1;
    width: 100%;
    height: 100%;
}

.scanner-info-panel {
    position: absolute;
    bottom: 20px;
    left: 16px;
    right: 16px;
    max-width: 320px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px;
    border: 1px solid rgba(0, 255, 136, 0.3);
    padding: 16px;
    z-index: 1001;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 255, 136, 0.1);
}

.scanner-train-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.scanner-train-badge {
    background: linear-gradient(135deg, #00FF88, #00CC6A);
    color: #000;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 800;
}

.scanner-train-name {
    color: white;
    font-size: 15px;
    font-weight: 600;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scanner-stats-row {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

.scanner-stat {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
}

.scanner-stat i {
    color: #00FF88;
    font-size: 12px;
}

.scanner-status {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 255, 136, 0.1);
    border-radius: 10px;
    padding: 10px 12px;
    color: #00FF88;
    font-size: 12px;
}

.scanner-status i {
    font-size: 14px;
}

/* Scanner action badge styling */
.action-badge.scanner-badge {
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.15), rgba(0, 204, 106, 0.15));
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.action-badge.scanner-badge i {
    color: #00CC6A;
}

body.dark .action-badge.scanner-badge {
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.2), rgba(0, 204, 106, 0.2));
}

/* Scanner map marker styles */
.scanner-train-marker {
    background: linear-gradient(135deg, #00FF88, #00CC6A);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-size: 10px;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.6);
    animation: scannerMarkerPulse 1.5s ease-in-out infinite;
}

@keyframes scannerMarkerPulse {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(0, 255, 136, 0.6);
    }

    50% {
        box-shadow: 0 0 40px rgba(0, 255, 136, 0.9);
    }
}

/* Scanner Arrow Marker */
.scanner-train-arrow-wrapper {
    background: transparent;
}



.scanner-train-arrow {
    width: 24px;
    height: 24px;
    color: #00FF88;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    filter: drop-shadow(0 0 2px rgba(0, 255, 136, 0.3));
}


/* Scanner Icon Searching Animation */
.scanner-icon-anim {
    animation: scannerSearch 4s ease-in-out infinite;
    transform-origin: bottom center;
}

@keyframes scannerSearch {
    0% {
        transform: rotate(-25deg);
    }

    50% {
        transform: rotate(10deg);
    }

    100% {
        transform: rotate(-25deg);
    }
}

/* Scanner Light Mode Arrow Overrides */
.scanner-light-mode .scanner-train-arrow {
    color: #1565C0;
    filter: drop-shadow(0 0 2px rgba(21, 101, 192, 0.4));
}

/* ==========================================================================
   SHARED TRIP VIEW MODE
   Displays only Trip Card & Map with Open App Banner
   ========================================================================== */

body.shared-view-mode {
    background: #f2f2f7;
    overflow-y: auto;
    padding-bottom: 80px;
    /* Space for refresh button */
}

body.dark.shared-view-mode {
    background: #000;
}

/* Hide Main App UI in Shared Mode */
body.shared-view-mode #v3-header,
body.shared-view-mode #v3-bottom-nav,
body.shared-view-mode #rail-news-container,
body.shared-view-mode #promo-banner-main,
body.shared-view-mode .page-footer-logo,
body.shared-view-mode #search-results-v3,
body.shared-view-mode .search-section-v3,
body.shared-view-mode #live-display-v3,
body.shared-view-mode .quick-access-grid,
body.shared-view-mode .section-header {
    display: none !important;
}

/* Ensure Trip Card is Visible & Centered */
body.shared-view-mode #trip-card.trip-card {
    display: block !important;
    position: relative;
    top: 0;
    left: 0;
    right: 0;
    bottom: auto;
    width: 100%;
    max-width: 600px;
    margin: 60px auto 20px auto;
    /* Top margin for Open App Banner */
    height: auto;
    transform: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border-radius: 16px;
    z-index: 10;
}

/* Hide close button in shared mode */
body.shared-view-mode .trip-card-close {
    display: none;
}

/* Ensure Map Container is Visible */
body.shared-view-mode #v3-map-container {
    display: block !important;
    position: relative;
    top: 0;
    height: 350px;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    border-radius: 16px;
    overflow: hidden;
    z-index: 5;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Open App Mobile Banner */
.shared-app-banner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 50px;
    background: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 2000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

body.dark .shared-app-banner {
    background: #1C1C1E;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.shared-banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.shared-app-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.shared-banner-text {
    display: flex;
    flex-direction: column;
}

.shared-banner-text strong {
    font-size: 14px;
    color: #000;
    line-height: 1.2;
}

.shared-banner-text span {
    font-size: 11px;
    color: #8E8E93;
}

body.dark .shared-banner-text strong {
    color: #fff;
}

.shared-open-btn {
    background: var(--ios-blue);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
}

/* Manual Refresh Button - Floating */
.shared-refresh-btn {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--ios-green);
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 100;
    cursor: pointer;
    transition: transform 0.2s;
}

.shared-refresh-btn:active {
    transform: translateX(-50%) scale(0.95);
}

/* ==========================================================================
   ADAPTIVE UI STRATEGY
   Desktop (Sidebar) | iOS (Glass/Safe Area) | Android (Material)
   ========================================================================== */

/* --- DESKTOP ANDROID-STYLE LAYOUT (Bottom Menu) --- */
@media (min-width: 1024px) {
    body.is-desktop {
        background: transparent;
    }

    body.is-desktop #app {
        flex-direction: column;
        margin: 0 auto;
        background: transparent;
        min-height: 100vh;
    }

    /* Bottom Navigation Bar - Android Style */
    body.is-desktop .tab-bar-v3 {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: auto;
        flex-direction: row;
        justify-content: space-around;
        padding: 12px 0;
        border-top: 1px solid var(--glass-border);
        border-right: none;
        background: var(--glass-bg-heavy);
        backdrop-filter: blur(40px);
        -webkit-backdrop-filter: blur(40px);
        z-index: 1000;
        align-items: center;
    }

    body.dark.is-desktop .tab-bar-v3 {
        background: rgba(28, 28, 30, 0.7);
    }

    body.is-desktop .tab-btn-v3 {
        width: auto;
        flex: 0 0 auto;
        flex-direction: column;
        justify-content: center;
        padding: 8px 16px;
        gap: 4px;
    }

    body.is-desktop .tab-btn-v3 i {
        font-size: 24px;
        width: auto;
        text-align: center;
    }

    body.is-desktop .tab-btn-v3 span {
        font-size: 11px;
        font-weight: 500;
    }

    body.is-desktop .tab-btn-v3.active {
        background: transparent;
        border-right: none;
        border-bottom: 3px solid var(--ios-blue);
    }

    /* Main Content Adjustment */
    body.is-desktop #main-app-container {
        flex: 1;
        padding-bottom: 80px;
        /* Remove bottom nav padding */
        padding-left: 0;
        overflow-y: auto;
        height: 100vh;
    }

    /* Header tweaks for Desktop */
    body.is-desktop .ios-header {
        position: sticky;
        padding: 30px 40px;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }

    /* Content Width Limits */
    body.is-desktop section {
        max-width: 900px;
        margin: 0 auto;
        padding: 20px 40px;
    }

    /* Grid Layouts for Cards */
    body.is-desktop .quick-access-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }

    body.is-desktop #rail-news-container {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

/* --- IOS NATIVE TWEAKS --- */
body.platform-ios {
    /* Safe Area Insets */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

body.platform-ios .ios-header {
    padding-top: calc(env(safe-area-inset-top) + 10px);
}

body.platform-ios .tab-bar-v3 {
    padding-bottom: calc(env(safe-area-inset-bottom) + 10px);
    height: calc(65px + env(safe-area-inset-bottom));
}

/* Enhanced Blur for iOS */
body.platform-ios .ios-header,
body.platform-ios .tab-bar-v3 {
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    background: rgba(255, 255, 255, 0.65);
}

body.dark.platform-ios .ios-header,
body.dark.platform-ios .tab-bar-v3 {
    background: rgba(28, 28, 30, 0.65);
}

/* --- ANDROID NATIVE TWEAKS --- */
body.platform-android {
    /* Font Adjustment - Roboto is native */
    font-family: 'Roboto', sans-serif;
}

body.platform-android .ios-header {
    /* Use simpler elevation shadow for Android */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    border-bottom: none;
    background: var(--bg-secondary);
    /* Less transparency on Android often looks better */
    padding-top: 40px;
    /* Status bar spacing */
}

/* Android Ripple Effect (Simulation) */
body.platform-android .action-btn,
body.platform-android .search-btn {
    position: relative;
    overflow: hidden;
}

body.platform-android .action-btn:after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

body.platform-android .action-btn:active:after {
    width: 200px;
    height: 200px;
}

/* Delay Popup Style */
.delay-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    /* Darker Overlay */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(8px);
    /* Stronger Blur */
}

.delay-popup.hidden {
    display: none;
}

.delay-popup-content {
    background: rgba(255, 255, 255, 0.95);
    /* Slightly transparent white */
    padding: 24px 28px;
    border-radius: 20px;
    /* Softer Corners */
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.5) inset;
    font-size: 17px;
    font-weight: 600;
    color: #1c1c1e;
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: 85%;
    text-align: center;
    animation: popupIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Spring-like pop */
    position: relative;
    padding-top: 36px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.popup-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #f2f2f7;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #8e8e93;
    font-size: 14px;
    transition: background 0.2s;
}

.popup-close-btn:active {
    background: #e5e5ea;
}

.delay-popup-content i.fa-clock {
    font-size: 28px;
    background: linear-gradient(135deg, #007AFF, #5856D6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

@keyframes popupIn {
    from {
        transform: scale(0.8) translateY(10px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.runs-on-v3 {
    display: flex;
    gap: 4px;
    align-items: center;
}

.day-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: 700;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.05);
}

.day-dot.active {
    background: rgba(52, 199, 89, 0.15);
    color: var(--ios-green);
}

/* ==========================================================================
   PREMIUM UI UPGRADE: Search Results Refinement
   ========================================================================== */

.premium-train-list-header {
    background: var(--glass-bg-heavy);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    padding: 16px 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    margin: 16px 4px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-md);
    animation: fadeInDown 0.5s ease-out;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.premium-train-card {
    background: var(--glass-bg);
    backdrop-filter: blur(30px) saturate(150%);
    -webkit-backdrop-filter: blur(30px) saturate(150%);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-xl);
    padding: 20px;
    margin-bottom: 16px;
    transition: all 0.4s var(--ease-spring);
    position: relative;
    overflow: hidden;
    cursor: pointer;

    /* Reflective Edge */
    background-image: linear-gradient(135deg,
            rgba(255, 255, 255, 0.1) 0%,
            rgba(255, 255, 255, 0.05) 50%,
            transparent 100%);
}

body.dark .premium-train-card {
    background: rgba(30, 30, 32, 0.5);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
}

.premium-train-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 122, 255, 0.12), 0 0 10px rgba(0, 122, 255, 0.1);
    border-color: var(--ios-blue);
    background: rgba(255, 255, 255, 0.85);
}

body.dark .premium-train-card:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 15px rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(45, 45, 48, 0.7);
}

.premium-train-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
    background: var(--ios-blue);
    opacity: 0.8;
}

.premium-train-card.vande::before {
    background: var(--grad-indigo);
}

.premium-train-card.raj::before {
    background: var(--ios-red);
}

.premium-train-card.sf::before {
    background: var(--ios-orange);
}

.premium-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.premium-train-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.premium-train-num {
    background: var(--ios-blue-light);
    color: var(--ios-blue);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 800;
    width: fit-content;
    letter-spacing: 0.5px;
}

.vande .premium-train-num {
    background: rgba(99, 102, 241, 0.15);
    color: #6366f1;
}

.raj .premium-train-num {
    background: var(--ios-red-light);
    color: var(--ios-red);
}

.premium-train-name {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.premium-status-badge {
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.premium-status-badge.on-time {
    background: var(--ios-green-light);
    color: var(--ios-green);
}

.premium-status-badge.delayed {
    background: var(--ios-red-light);
    color: var(--ios-red);
}

.premium-card-times {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(120, 120, 128, 0.08);
    padding: 20px;
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
}

body.dark .premium-card-times {
    background: rgba(0, 0, 0, 0.2);
}

.premium-time-block {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.premium-time-block.right {
    align-items: flex-end;
    text-align: right;
}

.premium-time {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
}

.premium-stn {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary);
}

.premium-duration {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding: 0 30px;
}

.premium-line {
    width: 100%;
    height: 2px;
    background: var(--text-tertiary);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.premium-line::before,
.premium-line::after {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--text-tertiary);
    border-radius: 50%;
    position: absolute;
}

.premium-line::before {
    left: 0;
}

.premium-line::after {
    right: 0;
}

.premium-duration-badge {
    margin-bottom: 8px;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 2px 8px;
    border-radius: 6px;
}

.premium-train-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: 50%;
    color: var(--ios-blue);
    font-size: 12px;
}

.premium-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.premium-days {
    display: flex;
    gap: 4px;
}

.premium-day {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    border-radius: 6px;
    background: var(--status-day-bg);
    color: var(--status-day-color);
    opacity: 0.4;
}

.premium-day.active {
    background: var(--ios-blue);
    color: white;
}

.premium-actions {
    display: flex;
    gap: 8px;
}

.premium-action-btn {
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    padding: 8px 12px;
    border-radius: var(--radius-md);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.premium-action-btn:hover {
    background: var(--ios-blue);
    color: white;
}

.premium-action-btn.primary {
    background: var(--ios-blue);
    color: white;
}

/* --- INLINE AVAILABILITY HORIZONTAL LAYOUT --- */
.inline-avl-grid {
    display: flex;
    overflow-x: auto;
    gap: 12px;
    padding: 12px 2px 20px 2px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
}

.inline-avl-grid::-webkit-scrollbar {
    display: none;
}

.inline-avl-card {
    flex: 0 0 calc(33.33% - 8px);
    min-width: 110px;
    scroll-snap-align: start;
    padding: 12px 10px;
    border-radius: var(--radius-lg);
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: all 0.3s var(--ease-spring);
    cursor: pointer;
}

@media (min-width: 768px) {
    .inline-avl-card {
        flex: 0 0 120px;
    }
}

.inline-avl-card:hover {
    transform: translateY(-4px) scale(1.02);
    border-color: var(--ios-blue);
    box-shadow: 0 12px 24px rgba(0, 122, 255, 0.1);
}

.inline-class-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.inline-class-code {
    font-size: 15px;
    font-weight: 800;
}

.inline-status-badge {
    font-size: 9px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

.inline-status-badge.avl {
    background: rgba(52, 199, 89, 0.15);
    color: var(--status-avl);
}

.inline-status-badge.rac {
    background: rgba(255, 204, 0, 0.15);
    color: var(--status-rac);
}

.inline-status-badge.wl {
    background: rgba(255, 149, 0, 0.15);
    color: var(--status-wl);
}

.inline-status-badge.regret {
    background: rgba(255, 59, 48, 0.15);
    color: var(--status-regret);
}


.inline-avl-text {
    font-weight: 600;
    font-size: 12px;
}

.inline-fare-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
}

.inline-fare-val {
    font-weight: 800;
    color: var(--ios-blue);
}

.inline-avl-loading {
    padding: 30px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.inline-avl-loading i {
    font-size: 24px;
    color: var(--ios-blue);
}

/* Quick Glass UI Override */
.menu-card,
.search-box,
.train-item,
.result-item,
.main-status-card,
.station-card-v3,
.modal-card,
.tab-bar-v3,
.ios-header,
.news-item,
.recent-bar,
.avl-search-card,
.premium-train-card,
.trip-card,
.ntes-card,
.date-item,
.filter-chip {
    backdrop-filter: var(--glass-blur) !important;
    -webkit-backdrop-filter: var(--glass-blur) !important;
    box-shadow: var(--shadow-md) !important;
}

/* ==========================================================================
   STEP 3: ADD THIS NEW GLASS SHIMMER EFFECT
   ========================================================================== */

/* Glass Shimmer Animation */
@keyframes glassShimmer {

    0%,
    100% {
        transform: translate(0, 0);
        opacity: 0.5;
    }

    50% {
        transform: translate(-25%, -25%);
        opacity: 0.8;
    }
}

.menu-card::before,
.premium-train-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center,
            rgba(255, 255, 255, 0.15) 0%,
            transparent 50%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.menu-card:hover::before,
.premium-train-card:hover::before {
    opacity: 1;
    animation: glassShimmer 2s ease-in-out;
}

/* ==========================================================================
   STEP 4: ENHANCED SCROLLBAR
   ========================================================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--glass-bg-light);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

::-webkit-scrollbar-thumb {
    background: var(--glass-bg-heavy);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 10px;
    border: 2px solid var(--glass-border);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 122, 255, 0.3);
}

/* ==========================================================================
   DONE! Your Glass UI is now complete!
   ========================================================================== */

/* --- DESKTOP AD BANNERS --- */
.desktop-ad {
    display: none;
    position: fixed;
    z-index: 50;
    pointer-events: auto;
    transition: opacity 0.3s ease;
}


@media (min-width: 1024px) {
    body.is-desktop .desktop-ad {
        display: block;
    }

    .side-ad {
        top: 100px;
        width: 120px;
        height: 600px;
        background: var(--glass-bg-heavy);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border: 1px solid var(--glass-border);
        border-radius: var(--radius-lg);
        overflow: hidden;
        box-shadow: var(--shadow-md);
    }

    /* Position ads at screen borders - side by side */
    .left-ad {
        left: 0;
    }

    .left-ad-1 {
        top: 100px;
        left: 0;
    }

    .left-ad-2 {
        top: 100px;
        left: 120px;
        /* Next to first banner */
    }

    .right-ad {
        right: 0;
    }

    .right-ad-1 {
        top: 100px;
        right: 120px;
        /* Leave space for second banner */
    }

    .right-ad-2 {
        top: 100px;
        right: 0;
    }
}

/* Hide side ads if window is too narrow for App + Ads */
@media (max-width: 1023px) {
    .side-ad {
        display: none !important;
    }
}

@media (min-width: 1024px) {}

.desktop-ad img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}