:root {
    --rouge-colmar: #d42426;
    --bleu-fonce: #001a6e;
    --gris-fond: #f8f9fa;
    --texte-sombre: #2c3e50;
    --font-ui: 'Fira Sans Condensed', sans-serif;
    --font-texte: 'Montserrat', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

html,
body,
button,
input,
select,
textarea {
    font-synthesis: none;
}

button {
    font: inherit;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bleu-fonce);
}

.fira-black {
    font-family: var(--font-ui);
    font-weight: 900;
    text-transform: uppercase;
}

.montserrat {
    font-family: var(--font-texte);
    font-weight: 500;
    line-height: 1.5;
}

/* =====================================================
   EN-TÊTE
===================================================== */
.en-tete-app {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: calc(90px + env(safe-area-inset-top, 0px));
    min-height: calc(90px + env(safe-area-inset-top, 0px));
    padding:
        calc(env(safe-area-inset-top, 0px) + 10px) 14px 12px;
    background: var(--bleu-fonce);
    z-index: 1000;
    display: grid;
    grid-template-columns:
        minmax(0, 1fr) clamp(110px, 34vw, 180px) minmax(0, 1fr);
    align-items: center;
    column-gap: 8px;
}

/* =====================================================
   PARTIE GAUCHE DU HEADER
===================================================== */
.en-tete-gauche {
    position: relative;
    z-index: 3;
    min-width: 0;
    justify-self: stretch;
    /*
     * Visible afin de ne pas couper
     * l’animation du point d’affluence.
     */
    overflow: visible;
}

#widget-affluence {
    width: 100%;
    min-width: 0;
    overflow: visible;
}

#etiquette-affluence {
    display: block;
    color: #ffffff !important;
    font-size: clamp(13px, 3.8vw, 18px);
    line-height: 1.05;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

html[lang="de"] #etiquette-affluence {
    font-size: 12px;
    letter-spacing: -0.2px;
    overflow: visible;
    text-overflow: clip;
}

#conteneur-statut-affluence {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 5px;
    /*
     * Espace supplémentaire autour du point
     * pour permettre l’animation circulaire.
     */
    padding: 10px 0 10px 10px;
    margin: -10px 0 -10px -10px;
    overflow: visible;
}

#point-affluence {
    position: relative;
    width: 12px;
    height: 12px;
    flex: 0 0 12px;
    border-radius: 50%;
    background-color: var(--couleur-point, #f39c12);
    box-shadow: 0 0 0 0 var(--couleur-point);
}

#texte-affluence {
    display: block;
    min-width: 0;
    max-width: 100%;
    color: white;
    font-size: clamp(14px, 4.2vw, 18px);
    font-weight: 800;
    line-height: 1.05;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#texte-affluence.texte-affluence-allemand {
    font-size: clamp(13px, 3.8vw, 17px);
}

.animation-pulsation {
    animation:
        pulsation-point 2s infinite cubic-bezier(0.66, 0, 0, 1);
}

@keyframes pulsation-point {
    to {
        box-shadow: 0 0 0 10px transparent;
    }
}

/* =====================================================
   LOGO CENTRAL
===================================================== */
.logo {
    position: absolute;
    left: 50%;
    top: calc(env(safe-area-inset-top, 0px) + 45px);
    transform: translate(-50%, -50%);
    display: block;
    width: clamp(110px, 34vw, 180px);
    height: auto;
    max-width: none;
    max-height: 76px;
    object-fit: contain;
    z-index: 2;
}

/* =====================================================
   PARTIE DROITE DU HEADER
===================================================== */
.en-tete-droite {
    position: absolute;
    top: calc(env(safe-area-inset-top, 0px) + 45px);
    right: 14px;
    left: auto;
    width: auto;
    min-width: 0;
    transform: translateY(-50%);
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.bouton-langue {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0;
    padding: 5px;
    background: none;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
}

.icone-drapeau {
    font-size: 20px;
    line-height: 1;
}

.drapeau-svg {
    display: block;
    width: 26px !important;
    height: 26px !important;
    object-fit: contain;
    flex-shrink: 0;
}

/* =====================================================
   MENU DES LANGUES
===================================================== */
.menu-langue {
    position: absolute;
    top: calc(env(safe-area-inset-top, 40px) + 40px);
    right: 20px;
    min-width: 130px;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    z-index: 9999 !important;
}

.menu-langue.masque {
    display: none;
}

.menu-langue button {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start;
    width: 100%;
    gap: 15px;
    padding: 12px 20px;
    border: none;
    border-bottom: 1px solid #f0f0f0;
    background: white;
    font-family: var(--font-texte);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}

/* =====================================================
   BULLES DU CIRCUIT
===================================================== */
.bulle-circuit {
    position: absolute;
    padding: 6px 12px;
    background-color: #001a6e;
    color: #ffffff;
    border: 2px solid #ffffff;
    border-radius: 20px;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
    font-family: var(--font-texte);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    transition:
        opacity 0.3s ease,
        visibility 0.3s ease;
}

/* Le départ reste centré sur le bout de la ligne */
.bulle-depart {
    transform: translate(-50%, -50%);
}

/* L’arrivée remonte au-dessus de l’étoile */
.bulle-arrivee {
    transform: translate(-50%, calc(-100% - 25px));
}

/* Disparition progressive lors du dézoom */
.masquer-bulles .bulle-circuit {
    opacity: 0;
    visibility: hidden;
}

/* =====================================================
   BANDEAU D’ALERTE
===================================================== */
#bandeau-alerte {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    box-sizing: border-box;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: #f39c12;
    color: #ffffff;
    font-family: var(--font-texte);
    font-size: 15px;
    font-weight: 600;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 999;
}

#bandeau-alerte.masque {
    display: none !important;
}

.icone-alerte {
    font-size: 20px;
}

body.theme-nuit #bandeau-alerte {
    background-color: #d35400;
}

/* =====================================================
   CARTE
===================================================== */
#carte {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--gris-fond);
    z-index: 1;
}

.leaflet-control-zoom {
    display: none;
}

.leaflet-tile-pane {
    transition: filter 0.4s ease-in-out;
}

/* =====================================================
   EFFET DE FLOU
===================================================== */
.blur {
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    color: var(--bleu-fonce);
}

body.theme-nuit .blur {
    background: rgba(10, 32, 64, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
}

/* =====================================================
   SUPERPOSITIONS SUR LA CARTE
===================================================== */
.superpositions-carte {
    position: fixed;
    bottom: calc(105px + env(safe-area-inset-bottom, 0px));
    left: 0;
    width: 100%;
    padding: 0 15px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    pointer-events: none;
    z-index: 1000;
}

.superpositions-carte>* {
    pointer-events: auto;
}

/* =====================================================
   BOUTON CIRCUIT
===================================================== */
.pilule-circuit {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    border: 2px solid transparent;
    border-radius: 30px;
    cursor: pointer;
    transition: border-color 0.25s ease;
}

.pilule-circuit span {
    font-size: 16px;
}

.pilule-circuit.actif {
    border-color: var(--rouge-colmar) !important;
}

body.theme-nuit .pilule-circuit.actif {
    border-color: var(--rouge-colmar) !important;
}

.ligne-rouge {
    width: 30px;
    height: 4px;
    background-color: var(--rouge-colmar);
    border-radius: 2px;
}

/* =====================================================
   BOUTON DE LOCALISATION
===================================================== */
.bouton-localiser {
    width: 52px;
    height: 52px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    cursor: pointer;
}

#icone-localisation {
    width: 28px;
    height: 28px;
    object-fit: contain;
    transition: all 0.2s ease;
}

.marqueur-position-utilisateur {
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.4));
}

/* =====================================================
   NAVIGATION INFÉRIEURE
===================================================== */
.navigation-bas {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: calc(95px + env(safe-area-inset-bottom, 0px));
    display: flex;
    align-items: stretch;
    background: var(--bleu-fonce);
    z-index: 3000;
}

.element-nav {
    width: 20%;
    min-width: 0;
    flex: 1 1 20%;
    padding:
        7px 3px calc(7px + env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: transparent;
    border: none;
    border-right: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    opacity: 0.6;
    overflow: hidden;
    cursor: pointer;
    transition:
        opacity 0.2s ease,
        background-color 0.2s ease;
}

.element-nav:last-child {
    border-right: none;
}

.element-nav.actif {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.15);
}

.emplacement-icone {
    width: 100%;
    height: 36px;
    flex: 0 0 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icone-svg-nav {
    display: block;
    width: clamp(28px, 8vw, 34px);
    height: clamp(28px, 8vw, 34px);
    object-fit: contain;
    flex-shrink: 0;
}

.element-nav.actif .icone-svg-nav {
    width: 32px;
    height: 32px;
}

.element-nav span {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 34px;
    margin-top: 5px;
    padding: 0 2px;
    font-family: var(--font-ui);
    font-size: clamp(11px, 3.1vw, 14px);
    font-weight: 600;
    line-height: 1.05;
    text-align: center;
    white-space: normal;
    overflow: hidden;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: auto;
}

/* =====================================================
   PANNEAU DE DÉTAIL
===================================================== */
.panneau-bas {
    position: fixed;
    bottom: calc(85px + env(safe-area-inset-bottom, 0px));
    left: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    padding: 25px 25px 30px;
    background: white;
    border-radius: 25px 25px 0 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15);
    transform: translateY(150%);
    transition:
        transform 0.35s cubic-bezier(0.1, 0.8, 0.3, 1);
    z-index: 2000;
}

.panneau-bas.visible {
    transform: translateY(0);
}

.bouton-fermer-fiche {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 35px;
    height: 35px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: none;
    border: none;
    color: #a0a0a0;
    font-size: 22px;
    cursor: pointer;
}

.contenu-panneau {
    max-height: 55vh;
    margin-bottom: 10px;
    overflow-y: auto;
    color: var(--texte-sombre);
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.contenu-panneau::-webkit-scrollbar {
    display: none;
}

.titre-panneau {
    margin-bottom: 15px;
    padding-right: 30px;
    color: #000;
    font-family: var(--font-ui);
    font-size: 28px;
    font-weight: 900;
    line-height: 1.1;
}

.image-panneau {
    width: 100%;
    height: 180px;
    margin-bottom: 15px;
    object-fit: cover;
    border-radius: 16px;
}

.horaires-panneau {
    margin-bottom: 15px;
    color: #000;
    font-family: var(--font-texte);
    font-size: 18px;
    font-weight: 600;
}

.description-panneau {
    margin-bottom: 20px;
    color: #555;
    font-family: var(--font-texte);
    font-size: 14px;
    line-height: 1.4;
}

.pied-panneau {
    display: flex;
    justify-content: center;
}

.bouton-itineraire {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: white;
    color: var(--rouge-colmar);
    border: none;
    border-radius: 30px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    font-family: var(--font-texte);
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s;
}

.bouton-itineraire:active {
    transform: scale(0.95);
}

/* =====================================================
   ÉCRAN DE CHARGEMENT PWA
===================================================== */
#ecran-chargement-pwa {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--bleu-fonce);
    transition: opacity 0.5s ease-out;
    z-index: 9999;
}

.logo-chargement-haut {
    position: absolute;
    top: 18%;
    width: 240px;
    height: auto;
    animation: pulsation-chargement 2s infinite;
}

.logo-chargement-bas {
    position: absolute;
    bottom: 8%;
    width: 140px;
    height: auto;
    opacity: 0.9;
}

.chargeur {
    width: 55px;
    padding: 6px;
    aspect-ratio: 1;
    border-radius: 50%;
    background: #ffffff;
    --_m:
        conic-gradient(#0000 10%, #000),
        linear-gradient(#000 0 0) content-box;
    -webkit-mask: var(--_m);
    mask: var(--_m);
    -webkit-mask-composite: source-out;
    mask-composite: subtract;
    animation: rotation-chargeur 1s infinite linear;
}

@keyframes rotation-chargeur {
    to {
        transform: rotate(1turn);
    }
}

@keyframes pulsation-chargement {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

/* =====================================================
   OVERLAY MOBILE UNIQUEMENT
===================================================== */
#overlay-mobile {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    background-color: var(--fond-app);
    text-align: center;
    box-sizing: border-box;
    z-index: 10000;
}

#overlay-mobile.masque {
    display: none !important;
}

.contenu-overlay-mobile {
    max-width: 500px;
    padding: 2.5rem;
    background-color: #fff;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.theme-nuit .contenu-overlay-mobile {
    background-color: var(--fond-carte-nuit, #222);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.icone-mobile {
    display: block;
    margin-bottom: 1rem;
    font-size: 4rem;
}

#titre-mobile-seulement {
    margin-bottom: 1rem;
    color: var(--rouge-colmar, #d42426);
    font-family: var(--font-ui);
    font-size: 1.5rem;
    font-weight: 700;
}

#texte-mobile-seulement {
    color: var(--texte-sombre, #333);
    font-family: var(--font-texte);
    font-size: 1.1rem;
    line-height: 1.5;
}

.theme-nuit #texte-mobile-seulement {
    color: var(--texte-clair, #eee);
}

/* =====================================================
   ÉCRANS ANDROID ET MOBILES ÉTROITS
===================================================== */
@media screen and (max-width: 400px) {
    .en-tete-app {
        padding-left: 10px;
        padding-right: 10px;
        grid-template-columns:
            minmax(0, 1fr) clamp(110px, 34vw, 180px) minmax(0, 1fr);
        column-gap: 5px;
    }

    html[lang="de"] #etiquette-affluence {
        font-size: 11px;
        letter-spacing: -0.3px;
    }

    .logo {
        width: clamp(110px, 34vw, 180px);
        height: auto;
        max-width: none;
        max-height: 72px;
    }

    #etiquette-affluence {
        font-size: 14px;
    }

    #texte-affluence {
        font-size: 16px;
    }

    #texte-affluence.texte-affluence-allemand {
        font-size: 13px;
    }

    .bouton-langue {
        padding: 3px;
    }

    .element-nav {
        padding-left: 1px;
        padding-right: 1px;
    }

    .en-tete-droite {
        right: 10px;
    }



    .element-nav span {
        min-height: 30px;
        font-size: 11px;
        font-weight: 600;
        line-height: 1.05;
        letter-spacing: -0.1px;
    }

    .icone-svg-nav {
        width: 27px;
        height: 27px;
    }

    .element-nav.actif .icone-svg-nav {
        width: 29px;
        height: 29px;
    }
}

/* =====================================================
   TRÈS PETITS ÉCRANS
===================================================== */
@media screen and (max-width: 350px) {
    .en-tete-app {
        grid-template-columns:
            minmax(0, 1fr) clamp(110px, 34vw, 180px) minmax(0, 1fr);
    }

    html[lang="de"] #etiquette-affluence {
        font-size: 10px;
        letter-spacing: -0.3px;
    }

    .logo {
        width: clamp(110px, 34vw, 180px);
        height: auto;
        max-width: none;
        max-height: 68px;
    }

    #etiquette-affluence {
        font-size: 12px;
    }

    #texte-affluence {
        font-size: 14px;
    }

    #texte-affluence.texte-affluence-allemand {
        font-size: 13px;
    }

    .element-nav span {
        font-size: 9px;
        font-weight: 600;
    }
}
/* Lien séjour compact sous l'affluence, dans la hauteur du bandeau. */
.lien-mon-sejour {
    display: flex;
    align-items: center;
    gap: 4px;
    width: fit-content;
    max-width: 100%;
    margin-top: 6px;
    color: #fff;
    font-family: var(--font-texte);
    font-size: clamp(9px, 2.7vw, 11px);
    font-weight: 500;
    line-height: 1.3;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.lien-mon-sejour img {
    width: 10px;
    height: 10px;
    flex: 0 0 10px;
    object-fit: contain;
}

.lien-mon-sejour span {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
