body,
html {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    font-family: 'Montserrat', sans-serif;
    background: #1a1a1a;
}

#map {
    height: 100%;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.ui-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    pointer-events: auto;
}

.ui-panel h1 {
    margin: 0;
    font-size: 1.2rem;
    color: #333;
    font-weight: 700;
}

.ui-panel p {
    margin: 5px 0 15px 0;
    font-size: 0.9rem;
    color: #666;
}

#status-indicator {
    display: flex;
    align-items: center;
    font-size: 0.8rem;
    color: #2ecc71;
    font-weight: bold;
    gap: 5px;
}

#next-update-timer {
    font-weight: normal;
    opacity: 0.8;
    font-size: 0.75rem;
}

.dot {
    height: 8px;
    width: 8px;
    background-color: #2ecc71;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
    box-shadow: 0 0 8px #2ecc71;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(46, 204, 113, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(46, 204, 113, 0);
    }
}

.mt-3 {
    margin-top: 1rem;
}

.d-flex {
    display: flex;
}

.justify-content-between {
    justify-content: space-between;
}

.text-danger {
    color: #e74c3c;
    font-weight: bold;
}

.text-success {
    color: #2ecc71;
    font-weight: bold;
}

.tvt-item {
    border-bottom: 1px solid #eee;
    padding: 8px 0;
    font-size: 0.9rem;
}

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

.route-name {
    color: #555;
}

/* Waze Attribution */
.waze-attribution {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(5px);
    padding: 8px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.75rem;
    color: #333;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.waze-attribution img {
    height: 20px;
    width: auto;
}

/* Interactive TVT Items */
.tvt-item {
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    border-radius: 6px;
    padding: 10px;
    margin: -2px 0;
}

.tvt-item:hover {
    background: rgba(0, 0, 0, 0.03);
}

.tvt-item.active {
    background: rgba(52, 152, 219, 0.1);
    border-left: 4px solid #3498db;
    padding-left: 6px;
}

/* Top Navigation Bar - Modern Design */
.top-nav-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: linear-gradient(135deg, #c0392b 0%, #e74c3c 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 3000;
    font-size: 0.85rem;
    border-bottom: 2px solid rgba(255,255,255,0.15);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.2);
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-btn {
    background: linear-gradient(135deg, #f39c12 0%, #f1c40f 100%);
    border: none;
    color: #2c3e50;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    text-transform: uppercase;
    font-size: 0.75rem;
    padding: 10px 20px;
    border-radius: 25px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(241, 196, 15, 0.4);
    letter-spacing: 0.5px;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.nav-btn:hover {
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    color: #c0392b;
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

.btn-reflex {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    width: 100%;
    margin-top: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.1);
}

.btn-reflex:hover {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    box-shadow: 0 6px 15px rgba(231, 76, 60, 0.4);
}

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

.nav-mention {
    opacity: 0.95;
    font-weight: 600;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-mention::before {
    content: "🔄";
    font-size: 1rem;
}

/* External Links Styling */
.external-links {
    display: flex;
    align-items: center;
    gap: 10px;
}

.external-links a {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: transform 0.2s ease;
}

.external-links a:hover {
    transform: scale(1.1);
}

.external-icon {
    height: 24px;
    width: auto;
    max-width: 24px;
    object-fit: contain;
    transition: transform 0.2s ease;
}

.external-links a:hover .external-icon {
    transform: scale(1.1);
}

.external-links img:not(.external-icon) {
    height: 24px;
    width: auto;
    max-width: 80px;
    object-fit: contain;
}

.separator {
    color: rgba(255, 255, 255, 0.5);
    font-weight: 300;
    font-size: 1.2rem;
}

.client-label {
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
}

/* Marquee / News Ticker */
.nav-center {
    flex: 1;
    overflow: hidden;
    margin: 0 40px;
    height: 100%;
    display: flex;
    align-items: center;
    position: relative;
}

.nav-center::before,
.nav-center::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 60px;
    z-index: 2;
    pointer-events: none;
}

.nav-center::before {
    left: 0;
    background: linear-gradient(to right, rgba(192, 57, 43, 1), transparent);
}

.nav-center::after {
    right: 0;
    background: linear-gradient(to left, rgba(192, 57, 43, 1), transparent);
}

.marquee-container {
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
}

.marquee-content {
    display: inline-block;
    white-space: nowrap;
    animation: marquee 20s linear infinite;
}

.marquee-item {
    display: inline-block;
    padding-right: 120px;
    font-weight: 600;
    color: #fff;
    font-size: 0.85rem;
}

.marquee-item:after {
    content: " • ";
    padding-left: 60px;
    opacity: 0.5;
}

@keyframes marquee {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(-20%, 0, 0); }
}

.marquee-container:hover .marquee-content {
    animation-play-state: paused;
}

.marquee-item a {
    color: #fff;
    text-decoration: underline;
    font-weight: 700;
}

.marquee-item a:hover {
    color: #f1c40f;
}

/* Main Containers & Transitions */
#main-container {
    height: calc(100% - 50px);
    width: 100%;
    position: relative;
    top: 50px;
    overflow: hidden;
}

#waze-iframe-container,
#custom-map-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: calc(100% - 30px); /* Laisse la place pour le footer de 30px */
    transition: transform 1.2s cubic-bezier(0.77, 0, 0.175, 1), opacity 1.2s cubic-bezier(0.77, 0, 0.175, 1), filter 1.2s ease;
    opacity: 0;
    pointer-events: none;
    z-index: 1;
    filter: blur(10px);
}

#waze-iframe-container {
    transform: scale(1.1);
}

#custom-map-container {
    transform: scale(0.9);
}

#waze-iframe-container.active,
#custom-map-container.active {
    opacity: 1;
    pointer-events: auto;
    z-index: 10;
    transform: scale(1);
    filter: blur(0);
}

.overlay-controls,
.overlay-controls-panel {
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 2000;
    pointer-events: none;
}

.overlay-left,
.overlay-right {
    pointer-events: auto;
}

.waze-mention {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(5px);
    padding: 10px 18px;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #333;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Glow Button Styling */
.glow-button {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 18px 40px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(52, 152, 219, 0.4);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-transform: uppercase;
    letter-spacing: 2px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.glow-button:hover {
    box-shadow: 0 15px 40px rgba(52, 152, 219, 0.6);
    transform: translateY(-5px) scale(1.05);
    background: linear-gradient(135deg, #3498db, #3498db);
}

/* Specific overlay to hide/obscure Waze "Larger Map" link if it overlaps, 
   though usually it's in the bottom right or top. 
   We can try to put a transparent div over the area where that button usually is 
   to intercept clicks, but text replacement is only possible with a custom button 
   overlayed precisely. */

.btn-back {
    background: linear-gradient(135deg, #34495e, #2c3e50);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 18px 30px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-close-map {
    background: transparent;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 0 5px;
}

.btn-close-map:hover {
    color: #e74c3c;
}

.mb-2 {
    margin-bottom: 10px;
}

.align-items-center {
    align-items: center;
}

.pulse-marker {
    animation: marker-pulse 2s infinite;
}

@keyframes marker-pulse {
    0% {
        stroke-width: 3;
        stroke-opacity: 1;
    }

    50% {
        stroke-width: 15;
        stroke-opacity: 0;
    }

    100% {
        stroke-width: 3;
        stroke-opacity: 1;
    }
}

/* Premium Popup Styling */
.leaflet-popup-content-wrapper {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px);
    border-radius: 12px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2) !important;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.leaflet-popup-tip {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px);
}

.waze-popup {
    font-family: 'Montserrat', sans-serif;
}

/* Fixed Wrapper to hold both Navbar and Marquee */
#fixed-header-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 3000;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.2);
}

/* Hide marquee on Desktop (screens larger than 768px) */
@media (min-width: 769px) {
    .mobile-marquee {
        display: none;
    }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .ui-panel {
        top: 30px; /* Header (80px) - MainContainer Offset (50px) = 30px */
        left: 0;
        right: 0;
        padding: 8px 0;
        border-radius: 0;
        background: #f8f9fa;
        border-bottom: 1px solid rgba(0,0,0,0.1);
        box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-height: 35px;
    }

    .ui-panel .d-flex {
        margin-bottom: 0 !important;
        width: 100%;
        justify-content: center;
    }

    .ui-panel h1 {
        font-size: 0.8rem !important;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin: 0;
        color: #7f8c8d;
    }

    .ui-panel p {
        display: none;
    }

    .top-nav-bar {
        position: relative; /* Not fixed anymore, wrapper is fixed */
        padding: 0 10px;
        height: auto;
        min-height: 50px;
        flex-wrap: wrap; 
        gap: 5px;
        z-index: 2; /* Still higher than marquee in relative stack */
        box-shadow: none; /* Shadow is on the wrapper */
    }

    .nav-btn {
        padding: 6px 10px;
        font-size: 0.7rem; 
        white-space: normal; 
        line-height: 1.1;
        max-width: 160px;
        text-align: left;
    }

    .nav-center {
        display: none;
    }

    .nav-mention {
        display: none;
    }
    
    .nav-right {
        gap: 8px !important;
    }

    /* Mobile Marquee Visible - Flow layout inside fixed wrapper */
    .mobile-marquee {
        display: flex !important;
        position: relative; /* Stacks naturally below navbar */
        height: 30px;
        background: linear-gradient(to right, rgba(192, 57, 43, 0.95), rgba(231, 76, 60, 0.95));
        z-index: 1;
        align-items: center;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        backdrop-filter: blur(5px);
    }
    
    .mobile-marquee .marquee-container {
        height: 100%;
        display: flex;
        align-items: center;
        width: 100%;
        overflow: hidden;
    }
    
    .mobile-marquee .marquee-item {
        font-size: 0.75rem;
        padding-right: 60px;
        white-space: nowrap;
    }
}

/* Footer Bandeau Design */
.main-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 500;
    height: 30px;
    background: #1a1a1a;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.main-footer a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: color 0.2s;
}

.main-footer a:hover {
    color: #f1c40f;
}

.main-footer .sep {
    margin: 0 8px;
    color: rgba(255, 255, 255, 0.2);
}

/* Modal Premium Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 5000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-container {
    background: #fff;
    width: 90%;
    max-width: 600px;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-container {
    transform: translateY(0);
}

.modal-header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-body {
    padding: 25px;
    max-height: 60vh;
    overflow-y: auto;
    color: #333;
}

.modal-footer {
    padding: 15px 25px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
}

.reflex-item {
    background: #f8f9fa;
    border-left: 4px solid #e74c3c;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.reflex-item h3 {
    margin: 0 0 10px 0;
    font-size: 1rem;
    color: #c0392b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.reflex-item p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.4;
    color: #555;
    display: block !important; /* Overriding mobile hidden p if necessary */
}

.reflex-loader {
    text-align: center;
    padding: 40px;
    color: #999;
}

@media (max-width: 768px) {
    #waze-iframe-container,
    #custom-map-container {
        height: 100%; /* Sur mobile on laisse l'iframe déborder ou scroll */
    }
    .main-footer {
        display: none;
    }
    .modal-container {
        width: 95%;
    }
}