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.7);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    padding: clamp(15px, 3vw, 25px);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.18);
    pointer-events: auto;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    max-width: 350px;
}

.ui-panel:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.4);
}

.ui-panel h1 {
    margin: 0;
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    color: #1a1a1a;
    font-weight: 800;
    line-height: 1.2;
}

.ui-panel p {
    margin: 8px 0 15px 0;
    font-size: clamp(0.8rem, 2vw, 0.95rem);
    color: #444;
    line-height: 1.4;
}

#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: relative;
    height: 60px;
    background: linear-gradient(135deg, #c0392b 0%, #e74c3c 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 clamp(10px, 4vw, 30px);
    z-index: 2;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255,255,255,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: 800;
    cursor: pointer;
    font-family: inherit;
    text-transform: uppercase;
    font-size: 0.75rem;
    padding: 10px 24px;
    border-radius: 50px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(241, 196, 15, 0.3);
    letter-spacing: 0.8px;
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.nav-btn:hover {
    background: #ffffff;
    color: #c0392b;
    box-shadow: 0 8px 25px rgba(255, 255, 255, 0.4);
    transform: translateY(-3px) scale(1.02);
}

.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% - 60px);
    width: 100%;
    position: absolute;
    top: 60px;
    bottom: 0;
    left: 0;
    right: 0;
    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: auto;
        bottom: 40px;
        left: 10px;
        right: 10px;
        max-width: none;
        padding: 12px 20px;
        border-radius: 20px 20px 0 0;
        background: rgba(255, 255, 255, 0.95);
        border-bottom: none;
        box-shadow: 0 -10px 30px rgba(0,0,0,0.2);
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        min-height: 50px;
    }

    #fixed-header-wrapper {
        box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    }
    
    #main-container {
        height: calc(100% - 90px);
        top: 90px;
    }

    .ui-panel h1 {
        font-size: 0.9rem !important;
        text-transform: none;
        letter-spacing: 0;
        color: #1a1a1a;
        margin: 0;
        flex: 1;
    }

    .ui-panel p {
        display: none;
    }

    .top-nav-bar {
        height: 60px;
        padding: 0 10px;
        gap: 10px;
    }

    .nav-btn {
        padding: 8px 15px;
        font-size: 0.7rem; 
        max-width: 140px;
        letter-spacing: 0.2px;
    }

    .nav-center, .nav-mention {
        display: none;
    }
    
    .nav-right {
        gap: 5px !important;
    }

    .external-icon {
        height: 20px;
    }

    .mobile-marquee {
        display: flex !important;
        height: 30px;
        background: #b03022;
        align-items: center;
    }
}

/* 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: calc(100% - 40px);
    }
    .main-footer {
        display: flex;
        height: 40px;
        flex-direction: column;
        justify-content: center;
        font-size: 0.65rem;
        padding: 5px;
        text-align: center;
    }
    .main-footer .footer-left, .main-footer .footer-right {
        width: 100%;
        display: flex;
        justify-content: center;
        gap: 5px;
    }
    .main-footer .sep {
        margin: 0 4px;
    }
    .modal-container {
        width: 95%;
    }
}