:root {
    --primary: #0F172A;
    --primary-dark: #020617;
    --accent: #ffcd00;
    --bg: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.65);
    --text-main: #0f172a;
    --text-sub: #64748b;
    --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.06);
    --radius: 16px;
    --glass-border: 1px solid rgba(255, 255, 255, 0.6);
    --metro-red: #ed1c24;
    --metro-blue: #008BD2;
    --metro-yellow: #EBBD02;
    --metro-green: #16a34a;

    /* Apple-like Identity Colors */
    --ios-blue: #007AFF;
    --ios-green: #34C759;
    --ios-orange: #FF9500;
    --ios-purple: #AF52DE;
    --ios-red: #FF3B30;
    --ios-gray: #8E8E93;

    /* Background Lights Intensity (Desktop) */
    --bg-blur: 200px;
    --bg-opacity: 0.6;

    /* Background Colors (Standard) */
    --orb-1: rgba(255, 205, 0, 0.55);
    --orb-2: rgba(30, 118, 218, 0.35);

    /* Theme Orb Colors */
    --orb-cp-1: rgba(22, 163, 74, 0.45);
    --orb-cp-2: rgba(22, 163, 74, 0.653);
    --orb-carris-1: rgba(255, 205, 0, 0.65);
    --orb-carris-2: rgba(255, 204, 0, 0.432);
    --orb-metro-1: rgba(237, 28, 36, 0.45);
    --orb-metro-2: rgba(245, 14, 21, 0.407);
}

/* Background Lights Intensity (Mobile Override) */
@media (max-width: 768px) {
    :root {
        --bg-blur: 200px;
        --bg-opacity: 1;
    }
}

/* Dark Mode Overrides */
body.dark-mode {
    --bg: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.85);
    --text-main: #f8fafc;
    --text-sub: #94a3b8;
    --primary: #38bdf8; /* Lighter blue for better contrast */
    --primary-dark: #0ea5e9;
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
    background-color: #0f172a;
    color: #f8fafc;
}
/* Forçar cores nalguns componentes que tinham #0f172a hardcoded */
body.dark-mode h1, 
body.dark-mode h2, 
body.dark-mode h3, 
body.dark-mode h4,
body.dark-mode .vehicle-item-time,
body.dark-mode .time-display .time-val,
body.dark-mode .map-focus-btn,
body.dark-mode .map-fav-btn,
body.dark-mode .map-btn,
body.dark-mode .location-btn {
    color: #f8fafc !important;
}
body.dark-mode .auth-settings-section {
    background: #1e293b;
    border-color: #334155;
}
body.dark-mode .auth-setting-name {
    color: #f8fafc;
}
body.dark-mode .auth-setting-desc {
    color: #94a3b8;
}
body.dark-mode .auth-modal-card {
    background: #0f172a;
    color: #f8fafc;
    border-color: #334155;
}
body.dark-mode .auth-header h2 {
    color: #f8fafc;
}
body.dark-mode .auth-header p {
    color: #94a3b8;
}
body.dark-mode .auth-tab {
    color: #94a3b8;
}
body.dark-mode .auth-tab.active {
    color: #f8fafc;
}
body.dark-mode .auth-tab:hover {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.05);
}
body.dark-mode .auth-input-group label {
    color: #cbd5e1;
}
body.dark-mode .auth-input-group input {
    background: #1e293b;
    border-color: #334155;
    color: #f8fafc;
}
body.dark-mode .auth-profile-label {
    color: #94a3b8;
}
body.dark-mode .auth-profile-email {
    color: #38bdf8;
}

body.dark-mode .station-card, body.dark-mode .connection-card {
    background: var(--card-bg);
    border: var(--glass-border);
}
body.dark-mode .bus-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
body.dark-mode .bus-item:last-child {
    border-bottom: none;
}
body.dark-mode .stop-name {
    color: #f8fafc;
}
body.dark-mode .stop-locality {
    color: #94a3b8;
}
body.dark-mode .search-input {
    background: #1e293b;
    border-color: #334155;
    color: #f8fafc;
}
body.dark-mode .bottom-nav {
    background: rgba(15, 23, 42, 0.9);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}
body.dark-mode .nav-item {
    color: #94a3b8;
}
body.dark-mode .nav-item.active {
    color: var(--primary);
}
body.dark-mode .modal-content {
    background: #0f172a;
    color: #f8fafc;
}
body.dark-mode .modal-header h2 {
    color: #f8fafc;
}


button, input, textarea, select {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f1f5f9;
    color: var(--text-main);
    -webkit-tap-highlight-color: transparent;
    min-height: 100vh;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    box-sizing: border-box;
    position: relative;
    overflow-x: hidden;
}

/* Hide Delays Visually without Reload */
body.hide-delays .delay-badge {
    display: none !important;
}

/* Glassmorphism Background Blobs */
body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    z-index: -1;
    filter: blur(var(--bg-blur));
    opacity: var(--bg-opacity);
    transition: background 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

body::before {
    width: 40vw;
    height: 40vw;
    min-width: 300px;
    min-height: 300px;
    background: var(--orb-1);
    top: -10vh;
    right: -10vw;
}

body::after {
    width: 60vw;
    height: 60vw;
    min-width: 400px;
    min-height: 400px;
    background: var(--orb-2);
    bottom: -15vh;
    left: -15vw;
}

/* CP Theme Overrides */
body.cp-theme::before {
    background: var(--orb-cp-1);
}

body.cp-theme::after {
    background: var(--orb-cp-2);
}

/* Carris Theme Overrides */
body.carris-theme::before {
    background: var(--orb-carris-1);
}

body.carris-theme::after {
    background: var(--orb-carris-2);
}

/* Metro Theme Overrides */
body.metro-theme::before {
    background: var(--orb-metro-1);
}

body.metro-theme::after {
    background: var(--orb-metro-2);
}

/* Universal Box Sizing */
*,
*::before,
*::after {
    box-sizing: inherit;
}

/* Header */
header {
    background-color: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-bottom: var(--glass-border);
    padding: 14px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    /* Enable flex shrinking */
}

.bus-badge {
    border: 2px solid var(--primary);
    color: var(--primary);
    font-weight: 900;
    font-size: 10px;
    padding: 2px 4px;
    line-height: 1;
    border-radius: 2px;
}

.stop-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    /* Critical for truncation in flex items */
    overflow: hidden;
    /* Mask the marquee */
}

.stop-info h1 {
    margin: 0;
    font-size: 15px;
    font-weight: 800;
    color: var(--primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-transform: uppercase;
    line-height: 1.2;
}

/* Marquee Animation */
.stop-info h1.scrolling {
    overflow: visible;
    text-overflow: clip;
    animation: marquee 4s linear infinite;
    display: inline-block;
    padding-left: 0;
}

@keyframes marquee {

    0%,
    20% {
        transform: translateX(0);
    }

    /* Pause at start */
    80%,
    100% {
        transform: translateX(var(--scroll-dist));
    }

    /* Scroll to end and pause */
}

@keyframes marquee-immediate {
    0% {
        transform: translateX(0);
    }

    /* Start immediately */
    85%,
    100% {
        transform: translateX(var(--scroll-dist));
    }

    /* Scroll to end and pause */
}

.stop-info p {
    margin: 2px 0 0 0;
    font-size: 10px;
    color: #9ca3af;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.clock {
    background-color: black;
    color: var(--accent);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    font-size: 16px;
    letter-spacing: -0.5px;
}

/* Search */
.search-container {
    padding: 16px 20px 4px 20px;
    background-color: transparent;
    max-width: 600px;
    margin: 0 auto;
}

.quick-nav-container {
    display: flex;
    align-items: center;          /* centre short buttons when pill is absent */
    gap: 8px;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    min-height: 60px;             /* nearby-section (45px) + scroll padding-bottom (6px) */
}


.quick-nav-scroll {
    flex: 1;
    overflow-x: auto;
    padding-bottom: 6px;
    padding-left: 4px;
    align-self: stretch;          /* stretch to fill the reserved 51px */
    display: flex;
    align-items: center;          /* vertically centre the buttons inside */
    mask-image: linear-gradient(to right, black 92%, transparent);
    -webkit-mask-image: linear-gradient(to right, black 92%, transparent);
    scrollbar-width: none;
    scrollbar-color: transparent transparent;
}

.quick-nav-scroll::-webkit-scrollbar {
    display: none;
}

.quick-nav-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.quick-nav-scroll::-webkit-scrollbar-thumb {
    background: transparent;
    /* Invisível por defeito */
    border-radius: 10px;
    transition: background 0.3s;
}

.quick-nav-scroll:hover::-webkit-scrollbar-thumb {
    background: rgba(0, 68, 148, 0.15);
    /* Aparece no hover */
}


.quick-actions {
    display: flex;
    gap: 8px;
}

.quick-actions::after {
    content: '';
    display: block;
    width: 24px;
    flex-shrink: 0;
}



.search-form {
    display: none;
    gap: 12px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    padding: 6px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: var(--glass-border);
    margin-top: 12px;
    position: relative;
    /* Space between buttons and form */
    animation: slide-down 0.2s ease-out;
}

/* Suggestions List */
.suggestions-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    border: var(--glass-border);
    margin-top: 8px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.suggestions-list.show {
    display: block;
}

.suggestion-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.suggestion-item:hover {
    background-color: var(--bg);
    color: var(--primary);
}

.suggestion-name {
    font-weight: 600;
}

.suggestion-id {
    color: var(--text-sub);
    font-size: 12px;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
}

.search-form.show {
    display: flex;
}

@keyframes slide-down {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-input-wrapper {
    flex: 1;
    position: relative;
}

input {
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-main);
    outline: none;
    font-family: inherit;
}

input::placeholder {
    color: #94a3b8;
}

input:focus {
    box-shadow: none;
}

button.search-btn {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 0 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
}

.quick-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.quick-btn {
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.5);
    padding: 0 16px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#btn-favorites {
    padding: 0;
    min-width: 36px;
    width: 36px;
}


.quick-btn:hover {
    background-color: rgba(255, 255, 255, 0.8);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: var(--shadow-md);
}

/* Nearby Section — green-tinted frosted pill, aligned with sibling buttons */
.nearby-section {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 45px;                              /* match quick-btn height exactly */
    background: rgba(255, 255, 255, 0);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgb(0, 68, 148);
    border-radius: 999px;
    padding: 0 5px 0 5px;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.1);
    flex-shrink: 0;
    overflow: hidden;
    animation: pill-grow 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes pill-grow {
    0% {
        max-width: 0;
        opacity: 0;
        padding-left: 0;
        padding-right: 0;
    }
    10% {
        opacity: 1;
    }
    100% {
        max-width: 3000px;
        padding-left: 5px;
        padding-right: 5px;
    }
}

/* Icon Wrapper for ping animation */
.nearby-icon-wrapper {
    position: relative;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 4px 0 6px;
    flex-shrink: 0;
}


/* Minimalist location icon */
.nearby-icon {
    position: relative;
    z-index: 1;
    display: inline-block;
    color: rgb(0, 68, 148); /* Back to green */
    flex-shrink: 0;
    animation: nav-icon-dodge 15s infinite;
    animation-delay: -7.0s;
}

@keyframes nav-icon-dodge {
    0%, 50% { transform: translate(0, 0) scale(1); }
    55%, 95% { transform: translate(-4px, 4px) scale(0.9); }
    100% { transform: translate(0, 0) scale(1); }
}

.satellite-wrapper {
    position: absolute;
    top: 1.1px;
    right: 0px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #10b981;
    z-index: 0;
    animation: sat-appear 15s infinite;
    animation-delay: -7.0s;
}

@keyframes sat-appear {
    0%, 50% { opacity: 0; transform: translate(-4px, 4px); }
    55%, 95% { opacity: 1; transform: translateX(0); }
    100% { opacity: 0; transform: translate(4px, -4px); }
}

.satellite-dot {
    position: relative;
    width: 4px;
    height: 4px;
    background-color: rgb(0, 68, 148);
    border-radius: 50%;
    flex-shrink: 0;
}

.sat-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: #ffffff;
    border-style: double;
    border-color: #ffffff;
    opacity: 0;
    animation-duration: 15s;
    animation-iteration-count: infinite;
    animation-timing-function: cubic-bezier(0.1, 0.8, 0.3, 1);
    animation-delay: -7.0s;
    z-index: -1;
}

.sat-ring-1 { animation-name: ping-1; }
.sat-ring-2 { animation-name: ping-2; }
.sat-ring-3 { animation-name: ping-3; }

/* Dot appears and stays still from 55% to 95% */
@keyframes ping-1 {
    0%, 55% { transform: scale(1); opacity: 0; }
    56% { transform: scale(1); opacity: 0.7; }
    76%, 100% { transform: scale(100); opacity: 0; }
}

@keyframes ping-2 {
    0%, 67% { transform: scale(1); opacity: 0; }
    68% { transform: scale(1); opacity: 0.7; }
    88%, 100% { transform: scale(100); opacity: 0; }
}

@keyframes ping-3 {
    0%, 79% { transform: scale(1); opacity: 0; }
    80% { transform: scale(1); opacity: 0.7; }
    100% { transform: scale(100); opacity: 0; }
}

/* Buttons inside the nearby section — original glass bg, compact */
.nearby-section .quick-btn {
    position: relative;
    z-index: 1;
    background: rgba(255, 255, 255, 0.418);
    backdrop-filter: blur(100px) saturate(180%);
    -webkit-backdrop-filter: blur(160px) saturate(180%);
    box-shadow: none;
    height: 36px;                              /* slightly smaller inside the pill */
    padding: 0 10px;
    font-size: 12px;
    opacity: 0;
    background-blend-mode: darken;
    animation: stops-fade-in 0.4s ease-out forwards;
}

.nearby-section .quick-btn:nth-child(2) { animation-delay: 0.51s; }
.nearby-section .quick-btn:nth-child(3) { animation-delay: 0.56s; }
.nearby-section .quick-btn:nth-child(4) { animation-delay: 0.61s; }
.nearby-section .quick-btn:nth-child(5) { animation-delay: 0.66s; }
.nearby-section .quick-btn:nth-child(6) { animation-delay: 0.71s; }

.shrink-out {
    animation: btn-shrink-out 0.5s cubic-bezier(0.8, 0, 0.8, 0.2) forwards !important;
    pointer-events: none;
    overflow: hidden;
    justify-content: flex-start !important;
}

@keyframes btn-shrink-out {
    0% { max-width: 150px; opacity: 1; padding: 0 16px; border-width: 1px; margin-right: 0; }
    90% { opacity: 1; }
    100% { max-width: 0; opacity: 0; padding: 0 0; border-width: 0; margin-right: -8px; min-width: 0; }
}

@keyframes stops-fade-in {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

.nearby-section .quick-btn:hover {
    background: rgba(253, 253, 253, 0.801);
    box-shadow: none;
}

/* Distance label inside nearby buttons */
.quick-btn__dist {
    font-size: 9px;
    font-weight: 600;
    opacity: 0.6;
    margin-left: 3px;
    letter-spacing: 0.2px;
}

/* List */
#arrivals-list {
    list-style: none;
    padding: 0 16px;
    margin: 0 auto;
    max-width: 600px;
    /* Padding bottom = Footer height + safe area + extra spacing */
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.arrival-item {
    background-color: var(--card-bg);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: var(--glass-border);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    /* Changed for local map expansion */
    display: block;
    padding: 0;
    overflow: hidden;
}

.arrival-item:hover {
    background-color: rgba(255, 255, 255, 0.85);
    box-shadow: var(--shadow-md);
}

.arrival-row {
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.bus-map-container {
    height: 0;
    width: 100%;
    background-color: #e2e8f0;
    transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.bus-map-container.open {
    height: 250px;
    border-top: 1px solid #cbd5e1;
}

/* Map instance inside */
.mini-map {
    width: 100%;
    height: 100%;
}

/* Mobile Optimization Media Queries */
@media (max-width: 450px) {

    /* Increased range to cover most phones */
    .header-title {
        gap: 8px;
    }

    .stop-info h1 {
        font-size: 15px;
        /* Keep legible size */
    }

    .search-container {
        padding: 12px;
    }

    #arrivals-list {
        padding: 12px;
        padding-bottom: calc(80px + env(safe-area-inset-bottom));
        gap: 12px;
        background-color: transparent;
    }

    /* Tiles - Floating Glass Effect */
    .arrival-item {
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.35));
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
        border-radius: 20px;
        border: 1px solid rgba(255, 255, 255, 0.5);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
        margin: 0;
        transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .arrival-row {
        padding: 16px 20px;
    }

    /* Line Number - Bigger */
    .line-number {
        width: max-content;
        /* Slightly smaller than desktop but big enough */
        height: 44px;
        font-size: 16px;
        padding: 0 10px !important;
        /* Keep large font */
    }

    /* Time Display - Bigger */
    .time-display {
        min-width: 52px;
        height: 52px;
        margin-left: 12px;
    }

    .time-val {
        font-size: 20px !important;
        /* Force large size */
    }

    .destination {
        font-size: 14px;
        /* Keep standard size */
    }
}



/* Remove default even child striping since we use cards now */
.arrival-item:nth-child(even) {
    background-color: var(--card-bg);
}

.line-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.line-number {
    width: max-content;
    padding: 0 10px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-weight: 800;
    font-size: 16px;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.destination-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    /* Clip scrolling text */
    display: flex;
    flex-direction: column;
}

.destination {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-transform: uppercase;
}

.destination.scrolling {
    cursor: pointer;
    /* Hint that it's clickable */
}

.destination.scrolling.animating {
    overflow: visible;
    text-overflow: clip;
    animation: marquee-immediate 4s linear 1;
    /* Run once */
    display: inline-block;
    padding-left: 0;
}

.status-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 900;
    padding: 2px 4px;
    border-radius: 3px;
    margin-top: 4px;
}

.status-live {
    background-color: #dcfce7;
    color: #15803d;
    animation: pulse-opacity 6s infinite ease-in-out;
}

.status-est {
    background-color: #f3f4f6;
    color: #6b7280;
}

.vehicle-tag {
    font-size: 9px;
    font-family: monospace;
    font-weight: 700;
    color: #9ca3af;
    background-color: #f9fafb;
    padding: 1px 4px;
    border-radius: 3px;
    border: 1px solid #e5e7eb;
    margin-left: 6px;
}

.time-display {
    background-color: #0f172a;
    min-width: 56px;
    padding: 0 8px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--accent);
    margin-left: 16px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    position: relative;
    border: 1px solid #1e293b;
}

.time-val-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.delay-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background-color: #dc2626;
    color: white;
    font-size: 9px;
    font-weight: 800;
    padding: 2px 4px;
    border-radius: 999px;
    line-height: 1;
    white-space: nowrap;
    box-shadow: 0 1px 4px rgba(220, 38, 38, 0.5);
    pointer-events: none;
}

/* Last Service Badge */
.last-service-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 900;
    padding: 2px 4px;
    border-radius: 3px;
    margin-top: 4px;
    background-color: #1e1b4b;
    color: #a5b4fc;
}


.animate-pulse {
    animation: pulse-opacity 1s infinite;
}

.time-val {
    font-size: 20px;
    font-weight: 800;
    line-height: 1;
    font-family: 'Courier New', Courier, monospace;
}

.time-unit {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    margin-top: 2px;
}

.loading,
.error,
.empty {
    padding: 40px;
    text-align: center;
    color: var(--text-sub);
    font-size: 14px;
    font-weight: 500;
}

/* Loading Spinner */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e5e7eb;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 10px;
}

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

@keyframes pulse-opacity {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

.updating .bus-badge {
    animation: pulse-opacity 1s infinite;
    border-color: var(--accent);
    color: var(--accent);
}

/* Toggle Switch */
.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.map-focus-btn {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    color: #0f172a;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.map-focus-btn:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.map-focus-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 0 3px rgba(0, 68, 148, 0.3);
}

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

.map-nav-controls-group {
    margin: 10px;
}

.map-custom-control {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    font-size: 20px;
    color: #0f172a;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.map-custom-control:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.map-custom-control:active {
    transform: scale(0.95);
}

/* Specific footer override for header-controls */
footer .header-controls {
    width: 100%;
    justify-content: space-between;
    gap: 10px;
}

.footer-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex: 1;
    justify-content: center;
}

.footer-quick-btn {
    font-size: 12px;
    height: 34px;
    padding: 0 14px;
    background: rgba(255, 255, 255, 0);
    border: 1px solid rgb(245, 245, 245);
    box-shadow: none;
    color: #334155;
    transition: all 0.2s ease;
}

.footer-quick-btn:hover, .footer-quick-btn:active {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    color: #0F172A;
}

@media (max-width: 450px) {
    .footer-quick-btn .btn-text {
        display: none;
    }
    .footer-quick-btn {
        padding: 0 12px;
        font-size: 16px;
    }
}

.toggle-wrapper {
    display: flex;
    align-items: center;
    background: #e2e8f0;
    border-radius: 20px;
    padding: 2px;
    position: relative;
    cursor: pointer;
    width: 64px;
    height: 28px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.toggle-bg {
    position: absolute;
    left: 2px;
    top: 2px;
    width: 30px;
    height: 24px;
    background: white;
    border-radius: 16px;
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.toggle-wrapper.show-time .toggle-bg {
    transform: translateX(30px);
}

.toggle-label {
    flex: 1;
    text-align: center;
    font-size: 10px;
    font-weight: 700;
    color: #64748b;
    z-index: 1;
    line-height: 24px;
    user-select: none;
}

.toggle-wrapper.show-time .label-time {
    color: var(--primary);
}

.toggle-wrapper:not(.show-time) .label-min {
    color: var(--primary);
}

/* Footer Controls */
footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-top: var(--glass-border);
    padding: 14px 20px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 200;
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.05);
}

/* Map Button */
.map-btn {
    background-color: white;
    border: 1px solid #e2e8f0;
    font-size: 16px;
    padding: 0 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    margin-right: -4px;
    /* Tighten gap */
}

.map-btn:hover {
    background-color: #f8fafc;
    border-color: var(--primary);
}

/* Map Modal */
.map-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    /* Above everything */
    background: white;
    display: none;
    /* Hidden by default */
    flex-direction: column;
    animation: fade-in 0.2s ease-out;
}

.map-modal.show {
    display: flex;
}

@keyframes fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

#map {
    width: 100%;
    flex: 1;
    /* Take remaining height */
    background: #e2e8f0;
}

/* Map Footer Controls */
.map-footer-controls {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 12px;
    width: max-content;
}

.map-action-btn {
    height: 48px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 999px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #0f172a;
    font-weight: 700;
}

.map-fav-btn {
    padding: 0 24px;
    font-size: 14px;
    background: linear-gradient(135deg, rgba(223, 188, 56, 0.57), rgba(223, 188, 56, 0.35));
    backdrop-filter: blur(10px) saturate(200%);
    color: #405C78;
    font-size: large;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
    min-width: 0px;
}

.close-map-btn {
    padding: 0 24px;
    font-size: 14px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.57), rgba(255, 255, 255, 0.35));
    backdrop-filter: blur(10px) saturate(200%);
    color: #405C78;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
    min-width: 140px;
}

.traffic-map-btn {
    padding: 0 16px;
    font-size: 14px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.4), rgba(59, 130, 246, 0.2));
    backdrop-filter: blur(10px) saturate(200%);
    color: #0F172A;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.traffic-map-btn.traffic-active {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.4), rgba(239, 68, 68, 0.2));
    color: #7f1d1d;
}

.map-action-btn:hover {
    box-shadow: 0 12px 40px rgba(72, 72, 72, 0.352);
}


/* Map Message */
.map-message {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(15, 23, 42, 0.9);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    z-index: 10001;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
    white-space: nowrap;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.map-message.visible {
    opacity: 1;
}

.favorites-modal {
    position: fixed;
    inset: 0;
    z-index: 12000;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 12px;
}

.favorites-modal.show {
    display: flex;
}

.favorites-sheet {
    width: min(680px, 100%);
    max-height: min(82vh, 760px);
    overflow: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.90), rgba(255, 255, 255, 0.85));
    backdrop-filter: blur(25px) saturate(0%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-radius: 20px;
    border: var(--glass-border);
    box-shadow: var(--shadow-md);
    padding: 16px;
}

.favorites-sheet::-webkit-scrollbar {
    display: none;
}

.favorites-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.favorites-header h2 {
    margin: 0;
    color: var(--primary);
    font-size: 18px;
}

.favorites-close-btn {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 999px;
    font-size: 16px;
    background: #e2e8f0;
    color: #334155;
}

.favorites-subtitle {
    margin: 6px 0 12px;
    color: var(--text-sub);
    font-size: 13px;
}

.favorites-url-row {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.favorites-map-row {
    margin-bottom: 12px;
}

.favorites-map-btn {
    width: 100%;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, #0F172A, #1E293B);
    color: white;
    font-weight: 700;
    font-size: 14px;
    padding: 10px 14px;
}

#favorites-url-input,
#favorites-search-input {
    width: 100%;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(255, 255, 255, 0.7);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
}

.favorites-action-btn {
    border: 0;
    border-radius: 10px;
    background: var(--primary);
    color: white;
    font-weight: 700;
    padding: 0 14px;
    white-space: nowrap;
}

.favorites-selected {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.favorite-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 999px;
    padding: 7px 10px;
    background: rgba(0, 68, 148, 0.08);
    color: #0f172a;
    font-size: 12px;
    font-weight: 600;
}

.favorite-chip button {
    border: 0;
    border-radius: 999px;
    width: 20px;
    height: 20px;
    background: rgba(51, 65, 85, 0.18);
    color: #0f172a;
    line-height: 1;
}

.favorites-results {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
}

.favorites-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.favorites-big-btn {
    min-height: 62px;
    border: 0;
    border-radius: 14px;
    background: rgba(0, 68, 148, 0.08);
    color: #0f172a;
    font-weight: 800;
    font-size: 15px;
    padding: 10px 12px;
}

.favorites-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.favorites-back-btn {
    border: 0;
    border-radius: 10px;
    background: #e2e8f0;
    color: #0f172a;
    font-weight: 700;
    padding: 8px 10px;
    white-space: nowrap;
}

.favorites-path {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.favorites-path span {
    background: rgba(15, 23, 42, 0.08);
    color: #334155;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    padding: 5px 9px;
}

.favorite-choice-btn {
    min-height: 50px;
}

.favorite-result-item {
    text-align: left;
    border: 0;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(148, 163, 184, 0.25);
    padding: 10px 12px;
}

.favorite-result-main {
    font-size: 14px;
    color: #0f172a;
    font-weight: 700;
}

.favorite-result-meta {
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
}

.favorites-empty {
    color: #64748b;
    font-size: 13px;
    padding: 8px 2px;
}

@media (max-width: 600px) {
    .favorites-modal {
        padding: 0;
        align-items: flex-end;
    }

    .favorites-sheet {
        max-height: 88vh;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        padding: 14px;
        background: rgba(255, 255, 255, 0);
        /* Inicia transparente */
        backdrop-filter: blur(0px);
        /* Inicia sem desfoque */
        animation: slideUpFavorites 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    }

    .favorites-url-row {
        flex-direction: column;
    }

    .favorites-action-btn {
        height: 38px;
    }

    .favorites-grid {
        grid-template-columns: 1fr;
    }
}

@keyframes slideUpFavorites {
    from {
        transform: translateY(100%);
        background-color: rgba(255, 255, 255, 0);
        backdrop-filter: blur(0px) saturate(100%);
    }

    to {
        transform: translateY(0);
        background-color: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(25px) saturate(180%);
    }
}

/* Line Filters */
.line-filters {
    display: none;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    padding: 0 4px;
    animation: slide-down 0.2s ease-out;
}

.line-filters.show {
    display: flex;
}

.line-filter-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 14px;
    color: white;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
    border: 2px solid transparent;
    opacity: 1;
}

.line-filter-badge:hover {
    box-shadow: var(--shadow-md);
}

.line-filter-badge.inactive {
    opacity: 0.4;
    background-color: #cbd5e1 !important;
    color: #64748b;
    box-shadow: none;
}


/* Routing Modal */
.routing-modal {
    position: fixed;
    inset: 0;
    z-index: 12000;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 12px;
}

.routing-modal.show {
    display: flex;
}

.routing-sheet {
    width: min(680px, 100%);
    max-height: min(82vh, 760px);
    overflow: auto;
    scrollbar-width: none;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.75));
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.1);
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.routing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.routing-header h2 {
    margin: 0;
    color: var(--primary);
    font-size: 18px;
}

.routing-close-btn {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 999px;
    font-size: 16px;
    background: #e2e8f0;
    color: #334155;
    cursor: pointer;
}

.routing-inputs-container {
    display: flex;
    align-items: stretch;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.3));
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 16px;
    padding: 8px 12px;
    margin-bottom: 16px;
    margin-top: 12px;
    position: relative;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}

.routing-timeline {
    width: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 0;
    margin-right: 12px;
}

.routing-timeline-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 0 1px #cbd5e1;
    z-index: 2;
}

.origin-dot {
    background: #3b82f6;
}

.dest-dot {
    background: #ef4444;
}

.routing-timeline-line {
    flex: 1;
    width: 2px;
    background: #e2e8f0;
    margin: 4px 0;
}

.routing-inputs-fields {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.routing-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 44px;
}

.routing-input-wrapper input {
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    font-size: 14px;
    font-weight: 500;
    color: #0f172a;
    padding: 0;
}

.routing-input-wrapper input:focus {
    outline: none;
}

.routing-input-wrapper input::placeholder {
    color: #94a3b8;
}

.routing-input-divider {
    height: 1px;
    background: rgba(148, 163, 184, 0.2);
    margin: 4px 0;
    width: calc(100% - 32px);
}

.routing-icon-btn {
    background: transparent;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s;
    color: #475569;
}

.routing-icon-btn:hover {
    background: rgba(15, 23, 42, 0.05);
}

.routing-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    z-index: 10;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 8px;
    display: flex;
    flex-direction: column;
}

.routing-results-dropdown:empty {
    display: none;
}

.routing-result-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    text-align: left;
}

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

.routing-result-item:hover {
    background: #f8fafc;
}

.routing-result-name {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
}

.routing-result-id {
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
}

.routing-selected-stop {
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    width: 100%;
}

.routing-selected-stop-clear {
    border: none;
    background: none;
    color: #94a3b8;
    font-size: 14px;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
}

.routing-selected-stop-clear:hover {
    background: #f1f5f9;
    color: #475569;
}

.routing-swap-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #475569;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: all 0.2s;
    z-index: 2;
}

.routing-swap-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.routing-connections-results {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    flex: 1;
    -ms-overflow-style: none;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to bottom, black calc(100% - 20px), transparent 100%);
    mask-image: linear-gradient(to bottom, black calc(100% - 20px), transparent 100%);
    padding-bottom: 24px;
}

.routing-connections-results::-webkit-scrollbar {
    display: none;
}

.routing-mini-search-btn {
    background: #0F172A;
    color: white;
    border: none;
    border-radius: 999px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 68, 148, 0.3);
    transition: all 0.2s;
}

.routing-mini-search-btn:hover {
    background: #0058bf;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 68, 148, 0.4);
}

.routing-mini-search-btn:active {
    transform: translateY(1px);
}

.routing-carousel {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 12px;
    padding-bottom: 12px;
    -ms-overflow-style: none;
    scrollbar-width: none;
    width: 100%;
}

.routing-carousel::-webkit-scrollbar {
    display: none;
}

.routing-carousel-item {
    flex: 0 0 92%;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
}

.routing-connection-card {
    background: white;
    border-radius: 12px;
    padding: 14px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    display: flex;
    align-items: center;
    gap: 12px;
}

.routing-line-badge {
    font-size: 16px;
    font-weight: 800;
    padding: 6px 12px;
    border-radius: 8px;
    color: white;
    min-width: 60px;
    text-align: center;
}

.routing-connection-details {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.routing-connection-dest {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
}

.routing-connection-meta {
    font-size: 12px;
    color: #64748b;
    margin-top: 2px;
}

@media (max-width: 600px) {
    .routing-modal {
        padding: 0;
        align-items: flex-end;
    }
    .routing-sheet {
        max-height: 88vh;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        animation: slideUpFavorites 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    }
}

/* Routing Transfers UI */
.routing-transfer-card {
    background: white;
    border-radius: 12px;
    padding: 14px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.routing-step {
    display: flex;
    align-items: center;
    gap: 12px;
}

.routing-step-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 2px 0;
}

.routing-step-icon-col {
    display: flex;
    justify-content: center;
    width: 60px; /* matches routing-line-badge min-width */
}

.routing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
    border: 2px solid white;
    box-shadow: 0 0 0 1px #cbd5e1;
}

.routing-line-vertical {
    width: 2px;
    height: 16px;
    background: #e2e8f0;
}

.routing-step-content {
    flex: 1;
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
}

.routing-step-meta {
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
}

/* Inline Realtime ETA */
.routing-inline-eta {
    margin-top: 10px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #475569;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.routing-inline-eta.rt-success {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
    animation: fadeIn 0.4s ease-out;
}

.routing-inline-eta-loading {
    width: 12px;
    height: 12px;
    border: 2px solid #cbd5e1;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Advanced Routing UI */
.routing-map-pick-btn {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.2));
    backdrop-filter: blur(10px) saturate(200%);
    -webkit-backdrop-filter: blur(10px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    width: 44px;
    height: 44px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.routing-map-pick-btn:hover {
    background: rgba(255, 255, 255, 0.7);
    border-color: #3b82f6;
}

.routing-gps-btn {
    margin-top: 8px;
    background: transparent;
    color: #3b82f6;
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    padding: 4px 0;
}
.routing-gps-btn:hover {
    text-decoration: underline;
}



.routing-map-banner {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.9);
    color: white;
    padding: 12px 24px;
    border-radius: 99px;
    font-size: 14px;
    font-weight: 600;
    z-index: 10001;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    pointer-events: none;
}
/* Route lines styling */
path.route-shadow {
    stroke-opacity: 0.0 !important; /* Hidden in normal mode */
    transition: stroke-opacity 0.2s, stroke-width 0.2s;
}
path.route-main {
    stroke-opacity: 1.0 !important; /* Visible in normal mode */
    transition: stroke-opacity 0.2s;
}

/* Traffic active overrides */
.traffic-active path.route-main {
    stroke-opacity: 0.35 !important; /* Linha semi-transparente para ver o trânsito */
}
.traffic-active path.route-shadow {
    stroke-opacity: 0.0 !important; /* Esconde completamente qualquer linha preta */
}

@keyframes trainPulse {
    0% { transform: scale(1); opacity: 0.25; }
    70% { transform: scale(1.8); opacity: 0; }
    100% { transform: scale(1.8); opacity: 0; }
}

/* ========================================================= */
/* --- UNIFIED DESIGN TOKENS & FUNCTIONAL COLORS --- */
/* ========================================================= */

:root {
    --token-primary: #0F172A;
    --token-primary-hover: rgba(15, 23, 42, 0.05);
    
    /* Functional Colors */
    --token-blue: #007AFF;
    --token-blue-light: rgba(0, 122, 255, 0.1);
    
    --token-red: #FF3B30;
    --token-red-light: rgba(255, 59, 48, 0.1);
    
    --token-purple: #AF52DE;
    
    --token-danger: #EF4444;
    --token-warning: #FF9500;
}

body.dark-mode {
    --token-primary: #f8fafc;
    --token-primary-hover: rgba(248, 250, 252, 0.1);
}

.bx {
    font-size: 24px;
    vertical-align: middle;
}

/* Base Quick Buttons Overhaul */
.footer-quick-btn {
    border-radius: 14px !important;
    height: 44px !important;
    padding: 0 16px !important;
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 0, 0, 0.04) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05) !important;
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: var(--token-primary) !important;
    transition: background 0.2s ease;
}
body.dark-mode .footer-quick-btn {
    background: rgba(30, 41, 59, 0.85) !important;
    border-color: rgba(255, 255, 255, 0.05) !important;
    color: var(--token-primary) !important;
}

.footer-quick-btn .bx {
    font-size: 26px;
}

/* Base Hover */
.footer-quick-btn:active { 
    background-color: var(--token-primary-hover) !important; 
}

/* --- Intentional Colors --- */
/* Search Button */
#btn-search .bx { color: var(--token-blue) !important; }
#btn-search:active { background-color: var(--token-blue-light) !important; color: var(--token-blue) !important; }

/* Routing Button */
#btn-routing .bx { color: var(--token-red) !important; }
#btn-routing:active { background-color: var(--token-red-light) !important; color: var(--token-red) !important; }

/* Map Button */
.map-btn .bx { color: var(--token-purple) !important; }

/* Unified Primary Icons (Fallback) */
.routing-icon-btn .bx, #routing-gps-btn .bx, .routing-swap-btn .bx { 
    color: var(--token-primary); 
    font-size: 24px; 
}

/* Warning / Highlights (Favorites) */
.map-fav-btn .bx { color: var(--token-warning) !important; font-size: 26px; }

/* Destructive / Close Actions */
.close-map-btn .bx, 
.favorites-close-btn .bx, 
.routing-close-btn .bx, 
.auth-close-btn .bx, 
.routing-selected-stop-clear .bx {
    color: var(--token-danger) !important;
    font-size: 28px;
}
