/* MVC Pro - Styles principaux */

/* Reset global â scroll autorisÃ© par dÃ©faut */
body,
html {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

/* Suppression globale du soulignement des liens */
a {
    text-decoration: none;
    color: inherit;
}

/* Page carte : blocage du scroll pour la vue plein Ã©cran Leaflet */
body.map-page,
body.map-page html,
html:has(body.map-page) {
    height: 100vh;
    /* Fallback anciens navigateurs */
    height: 100dvh;
    /* iOS Safari / Chrome Android fix */
    display: flex;
    /* StratÃ©gie Flexbox pour layout robuste */
    flex-direction: column;
    overflow: hidden;
    overscroll-behavior-y: none;
}

/* Carte Leaflet */
#map {
    flex: 1;
    /* Prend tout l'espace restant sous le header */
    height: auto;
    width: 100%;
    z-index: 1;
}

/* Header - Bite White Desktop */
.header {
    height: 60px;
    width: 100% !important;
    /* Force Full Width */
    max-width: 100vw !important;
    background: #ffffff;
    border-bottom: 1px solid #f0f0f0;
    position: sticky;
    top: 0;
    z-index: 1000;
    left: 0;
    right: 0;
    margin: 0;
    box-sizing: border-box;
}

.logo-container {
    display: flex;
    align-items: center;
    height: 100%;
    cursor: pointer;
    transition: none;
    text-decoration: none;
}

.logo-container:hover {
    transform: none;
}

/* Gradient text sweep effect â left to right on hover */
.logo-text h1 {
    font-size: 17px;
    font-weight: 800;
    color: #1a1a1a;
    margin: 0;
    line-height: 1.15;
    letter-spacing: -0.03em;
    background-image: linear-gradient(90deg, #6ee7b7 0%, #10b981 50%, #059669 100%);
    background-size: 0% 100%;
    background-repeat: no-repeat;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: #1a1a1a;
    transition: background-size 0.45s cubic-bezier(0.22, 1, 0.36, 1),
        -webkit-text-fill-color 0.3s ease;
}

.logo-container:hover .logo-text h1 {
    background-size: 100% 100%;
    -webkit-text-fill-color: transparent;
}

.logo-container:active .logo-text h1 {
    background-image: linear-gradient(90deg, #059669 0%, #047857 50%, #065f46 100%);
    background-size: 100% 100%;
    -webkit-text-fill-color: transparent;
}

.logo-icon {
    width: 34px;
    height: 34px;
    background: transparent;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
}

.logo-icon i {
    font-size: 17px;
    color: #1a1a1a;
}

/* Base text styles already defined in gradient block above */

.logo-text p {
    font-size: 11px;
    color: #999999;
    margin: 1px 0 0;
}

/* Style personnalisÃ© pour les popups Leaflet â Bite style */
.custom-popup .leaflet-popup-content-wrapper {
    background: #1a1a1a;
    color: white;
    border-radius: 8px;
    padding: 8px;
}

.custom-popup .leaflet-popup-tip {
    background: #1a1a1a;
}

/* ContrÃ´les de zoom personnalisÃ©s - AmÃ©lioration visuelle */
.leaflet-control-zoom,
.leaflet-touch .leaflet-control-zoom,
.leaflet-bottom .leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15) !important;
    margin-bottom: 40px !important;
}

.leaflet-control-zoom a {
    background: white !important;
    color: #666666 !important;
    border: none !important;
    border-bottom: 1px solid #edf2f7 !important;
    width: 34px !important;
    height: 34px !important;
    line-height: 34px !important;
    border-radius: 8px 8px 0 0 !important;
    transition: all 0.2s;
}

.leaflet-control-zoom a:last-child {
    border-radius: 0 0 8px 8px !important;
    border-bottom: none !important;
}

.leaflet-control-zoom a:hover {
    background: #fafafa !important;
    color: #10b981 !important;
}

/* User Marker Pulse Animation */
.user-marker-pulse {
    background: transparent;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-marker-pulse .pulse-core {
    width: 16px;
    height: 16px;
    background: #4285f4;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 2;
}

/* Effet pulse - cercle qui s'agrandit */
.user-marker-pulse::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    background: rgba(66, 133, 244, 0.4);
    border-radius: 50%;
    z-index: 1;
    animation: pulse-ring 2s ease-out infinite;
}

/* Second cercle pour effet plus dynamique */
.user-marker-pulse::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    background: rgba(66, 133, 244, 0.2);
    border-radius: 50%;
    z-index: 0;
    animation: pulse-ring 2s ease-out infinite;
    animation-delay: 1s;
}

@keyframes pulse-ring {
    0% {
        width: 16px;
        height: 16px;
        opacity: 0.8;
    }

    100% {
        width: 50px;
        height: 50px;
        opacity: 0;
    }
}

/* Bouton Recentrer Custom — Desktop */
.leaflet-control-custom {
    border-radius: 8px !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15) !important;
    border: none !important;
    transition: all 0.2s;
}

.leaflet-control-custom:hover {
    background-color: #f7fafc !important;
    transform: scale(1.05);
}

.leaflet-control-custom i {
    transition: transform 0.3s;
}

.leaflet-control-custom:active i {
    transform: rotate(45deg);
}

/* --- Bouton Recentrer -- Mobile : Style unifie controles carte v6.8.1 --- */
/* Respecte la position backend (topright, etc.) -- pas de position:fixed   */
/* Meme style que zoom +/- et search -- tokens --mc-*                       */
@media (max-width: 768px) {
    .recenter-control-btn.leaflet-control-custom {
        /* Pas de position:fixed → le bouton reste dans le flux Leaflet natif */
        /* Taille identique aux autres boutons (zoom +/-, search) */
        width: var(--mc-btn-size, 36px) !important;
        height: var(--mc-btn-size, 36px) !important;
        min-width: var(--mc-btn-size, 36px) !important;
        min-height: var(--mc-btn-size, 36px) !important;
        border-radius: var(--mc-radius, 10px) !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;

        /* Style unifié — identique zoom et search */
        background: #ffffff !important;
        border: none !important;
        border-bottom: none !important;
        box-shadow: var(--mc-shadow, 0 2px 8px rgba(0, 0, 0, 0.12)) !important;
        opacity: 1 !important;
        transform: none !important;
        transition: background 0.15s, color 0.15s, box-shadow 0.2s !important;
    }

    .recenter-control-btn.leaflet-control-custom i {
        font-size: 14px !important;
        color: #475569 !important;
        transform: none !important;
        transition: color 0.3s ease;
        line-height: 1 !important;
    }

    /* Hover — même que les autres boutons */
    .recenter-control-btn.leaflet-control-custom:hover {
        background: #f0fdf4 !important;
        color: #10b981 !important;
        transform: none !important;
    }

    /* Tap : micro-enfoncement */
    .recenter-control-btn.leaflet-control-custom:active {
        transform: scale(0.92) !important;
    }

    /* ── État "away" (utilisateur a dragué) — icône plus foncée ── */
    .recenter-control-btn.leaflet-control-custom.away {
        animation: none !important;
    }

    .recenter-control-btn.leaflet-control-custom.away i {
        color: #1e293b !important;
    }

    /* ── GPS acquiring (pulse bleu) ── */
    .recenter-control-btn.leaflet-control-custom.gps-acquiring {
        box-shadow: var(--mc-shadow, 0 2px 8px rgba(0, 0, 0, 0.12)),
            0 0 0 0 rgba(66, 133, 244, 0.4) !important;
    }

    /* ── GPS success — icône bleue brièvement ── */
    .recenter-control-btn.leaflet-control-custom.gps-success {
        background: #ffffff !important;
    }

    .recenter-control-btn.leaflet-control-custom.gps-success i {
        color: #4285f4 !important;
    }

    /* ── GPS erreur — bordure orange subtile ── */
    .recenter-control-btn.leaflet-control-custom.gps-error {
        background: #ffffff !important;
        border: 2px solid #f59e0b !important;
    }

    /* Dark mode */
    [data-theme="dark"] .recenter-control-btn.leaflet-control-custom {
        background: #1e2130 !important;
        color: #a0a4b8 !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
    }

    [data-theme="dark"] .recenter-control-btn.leaflet-control-custom i {
        color: #a0a4b8 !important;
    }

    [data-theme="dark"] .recenter-control-btn.leaflet-control-custom:hover {
        background: #252940 !important;
    }

    [data-theme="dark"] .recenter-control-btn.leaflet-control-custom.gps-success i {
        color: #4285f4 !important;
    }
}

/* NOTE : @media prefers-reduced-motion — déclaration unique consolidée en fin de fichier (~line 2580) */

/* Header Content Layout */
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    width: 100%;
    padding: 0 30px;
    box-sizing: border-box;
    max-width: 100%;
}

/* User Menu */
.user-menu {
    display: flex;
    align-items: center;
}

.btn-auth {
    background: #1a1a1a;
    color: white;
    border: none;
    padding: 10px 22px;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-size: 14px;
}

.btn-auth:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    background: #333333;
}

.user-avatar-container {
    position: relative;
    cursor: pointer;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: #f5f5f5;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1a1a1a;
    font-size: 24px;
    border: 1.5px solid #f0f0f0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.user-avatar:hover {
    border-color: #10b981;
    background: rgba(43, 196, 138, 0.05);
}

.user-dropdown {
    position: absolute;
    top: 55px;
    right: 5px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid #f0f0f0;
    width: 200px;
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 2000;
}

.user-dropdown.active {
    display: flex;
    animation: slideDown 0.3s ease-out;
}

.user-dropdown a {
    padding: 12px 20px;
    text-decoration: none;
    color: #1a1a1a;
    font-size: 14px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-dropdown a:hover {
    background: #f5f5f5;
    color: #1a1a1a;
}

.user-dropdown .logout-link {
    border-top: 1px solid #f0f0f0;
    color: #e53e3e;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

.auth-modal-content {
    background: white;
    width: 100%;
    max-width: 500px;
    border-radius: 8px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
    border: 1px solid #f0f0f0;
    overflow: hidden;
    animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
    padding: 0;
    position: relative;
    border-bottom: 1px solid #f0f0f0;
}

.auth-tabs {
    display: flex;
    background: #fafafa;
}

.tab-btn {
    flex: 1;
    padding: 15px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-weight: 600;
    color: #999999;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
}

.tab-btn.active {
    background: white;
    color: #1a1a1a;
    border-bottom: 2px solid #10b981;
}

.tab-btn:hover:not(.active) {
    color: #666666;
}

.tab-btn.pro-tab {
    background: #fff5f5;
    color: #c53030;
}

.tab-btn.pro-tab.active {
    background: white;
    border-bottom-color: #c53030;
    color: #c53030;
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #999999;
    z-index: 10;
    transition: color 0.2s;
}

.close-modal:hover {
    color: #1a1a1a;
}

.modal-body {
    padding: 30px;
    max-height: 80vh;
    overflow-y: auto;
}

.auth-tab-content {
    display: none;
}

.auth-tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #444444;
    font-size: 14px;
}

.form-group label i {
    width: 20px;
    color: #999999;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1.5px solid #f0f0f0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
    background: #ffffff;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: #1a1a1a;
    outline: none;
    box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.05);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* Buttons */
.btn-submit {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #1a1a1a 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 10px;
    box-shadow: 0 2px 10px rgba(43, 196, 138, 0.15);
}

.btn-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(43, 196, 138, 0.2);
}

.btn-submit:active {
    transform: scale(0.97);
}

.btn-pro {
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
}

.btn-pro:hover {
    box-shadow: 0 10px 20px rgba(229, 62, 62, 0.3);
}

/* Warnings */
.pro-warning {
    background: #fff5f5;
    border-left: 4px solid #f56565;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 25px;
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.pro-warning i {
    color: #f56565;
    font-size: 20px;
    margin-top: 2px;
}

.pro-warning p {
    margin: 0;
    font-size: 13px;
    color: #742a2a;
    line-height: 1.5;
}

/* Animations */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUpMobile {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

/* MEDIA QUERIES MOBILE APP MODE */
@media (max-width: 768px) {

    /* Menu mobile supprimÃ© - plus d'activation */

    /* Transformation du Header en mode Mobile (Flottant) */

    /* Carte s'arrête au-dessus de la bottom nav */
    #map {
        height: calc(100dvh - var(--bottom-nav-h, 56px));
        width: 100%;
    }

    /* Modales Mobile (Slide Up Bottom Sheet) â Sauf la modale Auth */
    .modal-content:not(.auth-modal-content) {
        position: fixed;
        bottom: 0;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 8px 24px 0 0 !important;
        margin: 0 !important;
        animation: slideUpMobile 0.4s cubic-bezier(0, 0.55, 0.45, 1) !important;
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2) !important;
        max-height: 85vh;
        display: flex;
        flex-direction: column;
    }

    /* Modale Auth Mobile â CentrÃ©e comme sur desktop */
    .auth-modal-content {
        position: relative !important;
        width: 92% !important;
        max-width: 480px !important;
        margin: auto !important;
        border-radius: 16px !important;
        animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25) !important;
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-content:not(.auth-modal-content) .modal-header::before {
        content: '';
        width: 40px;
        height: 4px;
        background: #e0e0e0;
        border-radius: 8px;
        position: absolute;
        top: 10px;
        /* PoignÃ©e de drag */
        left: 50%;
        transform: translateX(-50%);
    }

    .modal-content:not(.auth-modal-content) .modal-header {
        padding-top: 20px;
        /* Espace pour la poignÃ©e */
    }

    .modal-body {
        max-height: 80vh;
        overflow-y: auto;
        padding-bottom: 80px;
        /* Espace pour la Bottom Nav */
    }

    /* Forms Mobile */
    .form-row {
        grid-template-columns: 1fr;
    }

    /* Contrôles Leaflet - Reset mobile (le margin Leaflet 10px gère l'espacement) */
    .leaflet-bottom {
        bottom: 0 !important;
    }

    .leaflet-right {
        right: 0 !important;
    }

    .leaflet-top {
        top: 0 !important;
    }
}

/* =====================================================
   MARQUEURS DISTRIBUTEURS
===================================================== */

/* Marqueur temporaire (sÃ©lection) */
.temp-marker-icon {
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.temp-marker-icon i {
    font-size: 30px;
    color: #10b981;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.3));
}

.temp-marker-pulse {
    position: absolute;
    width: 40px;
    height: 40px;
    background: rgba(43, 196, 138, 0.3);
    border-radius: 50%;
    animation: markerPulse 1.5s ease-out infinite;
}

@keyframes markerPulse {
    0% {
        transform: scale(0.5);
        opacity: 1;
    }

    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* Marqueurs distributeurs */
.distributor-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    transition: box-shadow 0.2s ease, opacity 0.35s ease;
    pointer-events: auto !important;
    touch-action: manipulation;
}

.distributor-marker:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.35);
    transition: box-shadow 0.2s ease, opacity 0.35s ease, transform 0.15s ease;
}

.distributor-marker .marker-inner {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    pointer-events: none;
    /* Les clics passent au parent */
}

/* IcÃ´ne Leaflet div personnalisÃ©e */
.custom-div-icon {
    pointer-events: auto !important;
    cursor: pointer !important;
}

.leaflet-marker-icon {
    pointer-events: auto !important;
}

/* Cluster de markers — Le rendu visuel est géré par iconCreateFunction dans distributors_map.js */
/* Les classes CSS servent uniquement au reset Leaflet et aux animations */
.custom-cluster-icon {
    background: transparent !important;
    border: none !important;
}

.cluster-marker {
    cursor: pointer;
    position: relative;
    /* Les propriétés visuelles (bg, size, shadow, border) sont définies inline par JS */
}

.cluster-marker span {
    position: relative;
    z-index: 2;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

/* Les classes de densité NE définissent PAS de background/width/height
   pour éviter d'écraser les styles admin configurables */
.cluster-small,
.cluster-medium,
.cluster-large {
    /* Propriétés visuelles gérées par JS inline — ne pas ajouter ici */
    outline: none;
}

/* ═══════════════════════════════════════
   Styles premium pour les 12 modes cluster
   ═══════════════════════════════════════ */

/* Hover universel */
.cluster-marker:hover {
    transform: scale(1.15) !important;
    z-index: 1000 !important;
    filter: brightness(1.1);
}

/* Pulse — anneau pulsant */
@keyframes clusterPulse {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }

    70% {
        transform: scale(1.8);
        opacity: 0;
    }

    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}

/* Neon — lueur animée */
.cluster-style-neon {
    animation: clusterNeonGlow 2.5s ease-in-out infinite !important;
}

@keyframes clusterNeonGlow {

    0%,
    100% {
        filter: brightness(1) drop-shadow(0 0 4px currentColor);
    }

    50% {
        filter: brightness(1.3) drop-shadow(0 0 12px currentColor);
    }
}

/* Glow — respiration de la lueur */
.cluster-style-glow {
    animation: clusterGlowBreathe 3s ease-in-out infinite !important;
}

@keyframes clusterGlowBreathe {

    0%,
    100% {
        filter: brightness(1);
    }

    50% {
        filter: brightness(1.15);
    }
}

/* Glass — shimmer subtil */
.cluster-style-glass::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.25) 0%, transparent 50%);
    pointer-events: none;
}

/* Ring — double anneau pulsant */
.cluster-style-ring {
    animation: clusterRingPulse 2.5s ease-in-out infinite !important;
}

@keyframes clusterRingPulse {

    0%,
    100% {
        box-shadow: 0 0 0 3px currentColor;
        opacity: 0.9;
    }

    50% {
        box-shadow: 0 0 0 5px currentColor;
        opacity: 1;
    }
}

/* Badge — rotation subtile au hover */
.cluster-style-badge:hover {
    transform: scale(1.12) rotate(2deg) !important;
}

/* Shadow deep — ombre qui respire */
.cluster-style-shadow_deep {
    animation: clusterShadowBreathe 3s ease-in-out infinite !important;
}

@keyframes clusterShadowBreathe {

    0%,
    100% {
        box-shadow: 4px 4px 12px rgba(0, 0, 0, 0.3), -2px -2px 8px rgba(255, 255, 255, 0.1);
    }

    50% {
        box-shadow: 6px 6px 18px rgba(0, 0, 0, 0.4), -3px -3px 12px rgba(255, 255, 255, 0.15);
    }
}

/* Override des styles par défaut de MarkerCluster — neutralisés pour laisser JS gérer */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background: transparent !important;
    border: none !important;
}

.marker-cluster div {
    background: transparent !important;
    color: white !important;
    font-weight: 700 !important;
}

/* NOTE : Ancien bloc popup nettoyé (v5.4.4) — styles actifs dans POPUP MAP PRO SaaS 2026 ci-dessous */


/* =====================================================
   POPUP MAP â PRO SaaS 2026 Â· Clean Â· Elegant
   Desktop Popup + Mobile Bottom Sheet
===================================================== */

/* ââ Leaflet Wrapper Override ââ */
.distributor-popup-wrapper .leaflet-popup-content-wrapper {
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 8px;
    overflow: hidden;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
}

.distributor-popup-wrapper .leaflet-popup-content {
    width: 380px !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.5;
}

.distributor-popup-wrapper .leaflet-popup-tip-container {
    display: none !important;
}

.distributor-popup-wrapper .leaflet-popup-close-button {
    display: none !important;
}

/* ââ Popup Card â Floating Card ââ */
.popup-card {
    width: 100%;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow:
        0 25px 60px -12px rgba(0, 0, 0, 0.20),
        0 8px 24px -8px rgba(0, 0, 0, 0.10),
        0 0 0 1px rgba(0, 0, 0, 0.04);
    animation: popupEntrance 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
    position: relative;
}

/* Ligne lumineuse en haut */
.popup-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    z-index: 10;
}

/* Shimmer effet d'entrÃ©e */
.popup-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    right: 0;
    height: 100%;
    width: 60%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    animation: popupShimmerSweep 1.5s ease 0.6s 1 forwards;
    z-index: 20;
    pointer-events: none;
}

@keyframes popupEntrance {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.92);
    }

    60% {
        opacity: 1;
        transform: translateY(-4px) scale(1.01);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes popupShimmerSweep {
    0% {
        left: -60%;
        opacity: 0;
    }

    40% {
        opacity: 1;
    }

    100% {
        left: 120%;
        opacity: 0;
    }
}

/* ââ Header â Gradient + GÃ©ometric Pattern ââ */
.popup-header {
    padding: 18px 18px 14px;
    position: relative;
    overflow: hidden;
}

/* Pattern dÃ©coratif gÃ©omÃ©trique */
.popup-header::before {
    content: '';
    position: absolute;
    top: -30px;
    right: -30px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    animation: popupOrb 8s ease-in-out infinite alternate;
}

.popup-header::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: -15px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    animation: popupOrb 10s ease-in-out infinite alternate-reverse;
}

@keyframes popupOrb {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(12px, -12px) scale(1.15);
    }
}

/* Layout header */
.popup-header-row {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 2;
    padding-right: 36px;
    /* Space for absolute close btn */
}

/* ââ Hero Visual â Avatar/Emoji ââ */
.popup-hero {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1.5px solid rgba(255, 255, 255, 0.30);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
    animation: popupHeroIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s both;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.popup-hero:hover {
    transform: scale(1.08) rotate(-2deg);
}

.popup-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

@keyframes popupHeroIn {
    from {
        opacity: 0;
        transform: scale(0.4) rotate(-12deg);
    }

    to {
        opacity: 1;
        transform: scale(1) rotate(0);
    }
}

/* ââ Header Text ââ */
.popup-header-text {
    flex: 1;
    min-width: 0;
    animation: popupTextIn 0.45s ease 0.15s both;
}

@keyframes popupTextIn {
    from {
        opacity: 0;
        transform: translateX(-6px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.popup-type-name {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.popup-dist-name {
    display: block;
    margin-top: 2px;
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.75);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ââ Close Button â Top-Right Absolute ââ */
.popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
    z-index: 50;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.popup-close:hover {
    background: rgba(255, 255, 255, 0.3);
    color: #fff;
    transform: scale(1.15) rotate(90deg);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

/* ââ Verification Badges â Filled Style ââ */
.verification-badge {
    display: inline-flex !important;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 100px;
    font-weight: 700;
    letter-spacing: 0.3px;
    white-space: nowrap;
    animation: vbadgePop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s both;
}

.verification-badge.vbadge-official {
    background: rgba(99, 102, 241, 0.85) !important;
    color: #fff !important;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4);
}

.verification-badge.vbadge-verified {
    background: rgba(16, 185, 129, 0.85) !important;
    color: #fff !important;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.4);
}

.verification-badge.vbadge-unverified {
    background: rgba(239, 68, 68, 0.85) !important;
    color: #fff !important;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 10px rgba(239, 68, 68, 0.35);
    animation: vbadgePop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s both,
        vbadgePulse 2.5s ease-in-out infinite 0.8s;
}

@keyframes vbadgePop {
    from {
        opacity: 0;
        transform: scale(0.5);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes vbadgePulse {

    0%,
    100% {
        box-shadow: 0 2px 10px rgba(239, 68, 68, 0.35);
    }

    50% {
        box-shadow: 0 2px 18px rgba(239, 68, 68, 0.6);
    }
}

/* —— Body —— */
.popup-body {
    padding: 14px 18px 12px;
    background: #ffffff;
    position: relative;
    /* Ancre pour le bouton favori positionné en absolute */
}

/* —— Status Row — Badges + Favorite —— */
.popup-status-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
    animation: popupFadeUp 0.35s ease 0.25s both;
}

@keyframes popupFadeUp {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.popup-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10.5px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 100px;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: default;
}

.popup-pill:hover {
    transform: translateY(-1px) scale(1.04);
}

.popup-pill.success {
    background: #ecfdf5;
    color: #059669;
}

.popup-pill.info {
    background: rgba(43, 196, 138, 0.06);
    color: #059669;
}

.popup-pill i {
    font-size: 9px;
}

/* Favorite btn — cœur flottant sans cadre */
.popup-fav-btn {
    background: none;
    border: none;
    color: #d1d5db;
    cursor: pointer;
    font-size: 20px;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.popup-fav-btn:hover {
    color: #f87171;
    transform: scale(1.3);
}

.popup-fav-btn.active {
    color: #ef4444;
    animation: favPulse 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes favPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.4);
    }

    100% {
        transform: scale(1);
    }
}

/* ââ Address Card ââ */
.popup-address {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
    color: #666666;
    line-height: 1.55;
    padding: 10px 12px;
    background: #fafafa;
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid #f0f0f0;
    transition: all 0.2s ease;
    animation: popupFadeUp 0.35s ease 0.3s both;
}

.popup-address:hover {
    background: #f0f0f0;
}

.popup-address i {
    font-size: 13px;
    margin-top: 1px;
    flex-shrink: 0;
    opacity: 0.85;
}

/* ââ Distance Badge â Highlighted & Animated ââ */
.popup-distance-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--dist-color, #3b82f6);
    padding: 10px 14px;
    background: linear-gradient(135deg,
            rgba(var(--dist-color-rgb, 59, 130, 246), 0.10) 0%,
            rgba(var(--dist-color-rgb, 59, 130, 246), 0.04) 100%);
    border-radius: 10px;
    margin-bottom: 10px;
    border: 1.5px solid rgba(var(--dist-color-rgb, 59, 130, 246), 0.18);
    animation: popupFadeUp 0.35s ease 0.32s both, distBadgeGlow 3s ease-in-out infinite 1s;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* Shimmer sweep animation on distance badge */
.popup-distance-badge::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 70%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
    animation: distShimmer 3s ease-in-out infinite 1.5s;
    pointer-events: none;
}

@keyframes distShimmer {
    0% {
        left: -100%;
        opacity: 0;
    }

    30% {
        opacity: 1;
    }

    100% {
        left: 150%;
        opacity: 0;
    }
}

@keyframes distBadgeGlow {

    0%,
    100% {
        border-color: rgba(var(--dist-color-rgb, 59, 130, 246), 0.18);
        box-shadow: 0 0 0 0 rgba(var(--dist-color-rgb, 59, 130, 246), 0);
    }

    50% {
        border-color: rgba(var(--dist-color-rgb, 59, 130, 246), 0.35);
        box-shadow: 0 0 12px 2px rgba(var(--dist-color-rgb, 59, 130, 246), 0.12);
    }
}

.popup-distance-badge:hover {
    border-color: rgba(var(--dist-color-rgb, 59, 130, 246), 0.35);
    background: linear-gradient(135deg,
            rgba(var(--dist-color-rgb, 59, 130, 246), 0.14) 0%,
            rgba(var(--dist-color-rgb, 59, 130, 246), 0.06) 100%);
    transform: translateY(-1px);
}

.popup-distance-badge i {
    font-size: 12px;
    opacity: 0.85;
    animation: distPulse 2s ease-in-out infinite;
}

.popup-distance-badge span {
    font-weight: 600;
    line-height: 1.3;
}

.popup-distance-badge strong {
    font-weight: 800;
    font-size: 13px;
}

@keyframes distPulse {

    0%,
    100% {
        opacity: 0.85;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Dark mode distance badge */
[data-theme="dark"] .popup-distance-badge {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .popup-distance-badge:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.14);
}

/* ââ Action Buttons Grid ââ */
.popup-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 8px;
    animation: popupFadeUp 0.35s ease 0.35s both;
}

.popup-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    border-radius: 8px;
    padding: 10px 6px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.popup-action-btn i {
    font-size: 13px;
    transition: transform 0.25s ease;
}

.popup-action-btn:hover i {
    transform: scale(1.1);
}

.popup-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.popup-action-btn:active {
    transform: translateY(0) scale(0.97);
    transition-duration: 0.08s;
}

.popup-action-btn.act-primary {
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.popup-action-btn.act-secondary {
    background: rgba(43, 196, 138, 0.06);
    color: #059669;
}

.popup-action-btn.act-secondary:hover {
    background: rgba(43, 196, 138, 0.12);
}

/* ââ Secondary Actions Row ââ */
.popup-actions-sm {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
    animation: popupFadeUp 0.35s ease 0.4s both;
}

.popup-sm-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border: none;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    font-size: 10.5px;
    font-weight: 600;
    background: #fafafa;
    color: #666666;
    transition: all 0.25s ease;
}

.popup-sm-btn:hover {
    background: #f0f0f0;
    color: #1a1a1a;
    transform: translateY(-1px);
}

.popup-sm-btn.danger {
    color: #ef4444;
    background: #fef2f2;
}

.popup-sm-btn.danger:hover {
    background: #fee2e2;
}

.popup-sm-btn i {
    font-size: 11px;
}

/* ââ Claim Footer ââ */
.popup-claim {
    text-align: center;
    padding-top: 8px;
    border-top: 1px solid #f0f0f0;
    animation: popupFadeUp 0.35s ease 0.45s both;
}

.popup-claim button {
    background: none;
    border: none;
    font-size: 10.5px;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.25s ease;
}

.popup-claim button:hover {
    color: #10b981;
    background: rgba(43, 196, 138, 0.05);
}

.popup-claim button i {
    font-size: 10px;
}

/* ââ Mixed Types Pills ââ */


/* =====================================================
   MOBILE BOTTOM SHEET â RESPONSIVE
===================================================== */

@media (max-width: 768px) {

    .leaflet-popup.distributor-popup-wrapper,
    .distributor-popup-wrapper.leaflet-popup,
    .distributor-popup-wrapper {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        transform: none !important;
        margin: 0 !important;
        z-index: 10000 !important;
        display: block !important;
        width: 100% !important;
        pointer-events: auto !important;
    }

    .leaflet-popup-pane {
        z-index: 9999 !important;
    }

    .distributor-popup-wrapper .leaflet-popup-content-wrapper {
        border-radius: 8px 24px 0 0 !important;
        animation: mobileSlideUp 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    }

    .distributor-popup-wrapper .leaflet-popup-content {
        width: 100% !important;
    }

    .popup-card {
        border-radius: 8px 24px 0 0;
        box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.20);
    }

    .popup-body {
        padding-bottom: calc(14px + env(safe-area-inset-bottom));
        max-height: 55vh;
        overflow-y: auto;
    }

    @keyframes mobileSlideUp {
        0% {
            transform: translateY(100%);
            opacity: 0;
        }

        100% {
            transform: translateY(0);
            opacity: 1;
        }
    }
}

/* Petit Ã©cran (iPhone SE, etc.) */
@media (max-width: 375px) {
    .popup-type-name {
        font-size: 13px;
    }

    .popup-actions {
        gap: 4px;
    }
}

/* =====================================================
   AMÃLIORATION MOBILE - MARKERS ET POPUPS
===================================================== */

/* Zone de tap plus grande sur mobile */
@media (max-width: 768px) {

    /* Augmenter la taille des markers sur mobile - zone de tap 48x48px minimum */
    .distributor-marker {
        width: 48px;
        height: 48px;
        /* Zone de tap minimale recommandÃ©e: 44x44px, on prend 48 pour marge */
    }

    .distributor-marker .marker-inner {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }

    /* S'assurer que les markers sont cliquables au-dessus de tout */
    .leaflet-marker-pane {
        z-index: 650 !important;
    }

    .leaflet-popup-pane {
        z-index: 700 !important;
    }

    /* EmpÃªcher les problÃ¨mes de touch sur iOS */
    .leaflet-container {
        -webkit-tap-highlight-color: transparent;
        touch-action: pan-x pan-y;
        -webkit-touch-callout: none;
    }

    /* S'assurer que le popup est au-dessus de tout */
    .leaflet-popup {
        z-index: 10000 !important;
    }

    /* Animation feedback visuel sur tap */
    .distributor-marker:active {
        transform: scale(0.95);
        transition: transform 0.1s;
    }

    /* Zone de tap Ã©largie invisible autour du marker */
    .custom-div-icon {
        /* Ajouter une zone de tap Ã©largie */
        padding: 8px !important;
        margin: -8px !important;
    }

    /* Ãviter les conflits avec le scroll de la carte */
    .leaflet-interactive {
        pointer-events: auto !important;
    }

    /* DÃ©sactiver le double-tap zoom sur les markers seulement */
    .leaflet-marker-icon {
        touch-action: manipulation !important;
    }
}

/* Corrections supplÃ©mentaires pour tous les Ã©crans tactiles */
@media (pointer: coarse) {

    /* Ãcrans tactiles - zone de tap Ã©largie */
    .distributor-marker {
        width: 48px;
        height: 48px;
        min-width: 48px;
        min-height: 48px;
    }

    .distributor-marker .marker-inner {
        width: 38px;
        height: 38px;
    }

    /* Feedback visuel immÃ©diat */
    .distributor-marker:active,
    .custom-div-icon:active {
        opacity: 0.9;
        transform: scale(0.95);
    }

    /* Assurer que le z-index est correct */
    .leaflet-pane.leaflet-marker-pane {
        z-index: 650 !important;
    }

    /* Ãviter les sÃ©lections accidentelles de texte */
    .leaflet-container {
        -webkit-user-select: none;
        user-select: none;
    }
}

/* =====================================================
   DARK MODE â Markers, Clusters & Popups
   Palette : #1e2130 / #252940 / #353a52 / #6b7094 / #a0a4b8 / #e4e6f0
   Accent  : #10b981 / #5dd9a8
===================================================== */

/* ââ Markers ââ */
[data-theme="dark"] .distributor-marker {
    background: #1e2130;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .distributor-marker:hover {
    box-shadow: 0 5px 18px rgba(0, 0, 0, 0.6);
}

/* ââ Clusters ââ */
[data-theme="dark"] .cluster-marker {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

/* ââ Popup Card ââ */
[data-theme="dark"] .distributor-popup-wrapper .leaflet-popup-content-wrapper {
    background: #1e2130 !important;
}

[data-theme="dark"] .popup-card {
    background: #1e2130;
    box-shadow:
        0 25px 60px -12px rgba(0, 0, 0, 0.45),
        0 8px 24px -8px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .popup-card::before {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
}

[data-theme="dark"] .popup-card::after {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.03), transparent);
}

/* ââ Popup Body ââ */
[data-theme="dark"] .popup-body {
    background: #1e2130;
}

/* ââ Status Pill ââ */
[data-theme="dark"] .popup-pill.success {
    background: rgba(43, 196, 138, 0.12);
    color: #5dd9a8;
}

[data-theme="dark"] .popup-pill.info {
    background: rgba(43, 196, 138, 0.08);
    color: #5dd9a8;
}

/* ââ Favorite Button ââ */
[data-theme="dark"] .popup-fav-btn {
    color: #6b7094;
}

[data-theme="dark"] .popup-fav-btn:hover {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
}

/* ââ Address Card ââ */
[data-theme="dark"] .popup-address {
    background: #252940;
    border-color: #353a52;
    color: #a0a4b8;
}

[data-theme="dark"] .popup-address:hover {
    background: #2a2e42;
}

/* ââ Action Buttons ââ */
[data-theme="dark"] .popup-action-btn.act-secondary {
    background: rgba(43, 196, 138, 0.08);
    color: #5dd9a8;
}

[data-theme="dark"] .popup-action-btn.act-secondary:hover {
    background: rgba(43, 196, 138, 0.15);
}

[data-theme="dark"] .popup-action-btn:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

/* ââ Small Buttons ââ */
[data-theme="dark"] .popup-sm-btn {
    background: #252940;
    color: #a0a4b8;
}

[data-theme="dark"] .popup-sm-btn:hover {
    background: #353a52;
    color: #e4e6f0;
}

[data-theme="dark"] .popup-sm-btn.danger {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
}

[data-theme="dark"] .popup-sm-btn.danger:hover {
    background: rgba(239, 68, 68, 0.18);
}

/* ââ Claim Footer ââ */
[data-theme="dark"] .popup-claim {
    border-top-color: #353a52;
}

[data-theme="dark"] .popup-claim button {
    color: #6b7094;
}

[data-theme="dark"] .popup-claim button:hover {
    color: #5dd9a8;
    background: rgba(43, 196, 138, 0.08);
}

/* ââ Mixed Types ââ */

/* ââ Compact Popup (Ancienne version) ââ */
[data-theme="dark"] .distributor-popup-card {
    background: #1e2130;
}

[data-theme="dark"] .popup-card-body.compact-body {
    background: #1e2130;
}

[data-theme="dark"] .popup-name {
    color: #e4e6f0;
}

[data-theme="dark"] .popup-info-row {
    background: #252940;
}

[data-theme="dark"] .popup-info-icon {
    background: #1e2130;
    color: #5dd9a8;
}

[data-theme="dark"] .popup-info-label {
    color: #6b7094;
}

[data-theme="dark"] .popup-info-value {
    color: #e4e6f0;
}

[data-theme="dark"] .popup-badge {
    background: rgba(43, 196, 138, 0.08);
    border-color: rgba(43, 196, 138, 0.15);
}

[data-theme="dark"] .popup-badge span {
    color: #a0a4b8;
}

[data-theme="dark"] .popup-comment {
    background: rgba(245, 158, 11, 0.08);
    border-left-color: #f59e0b;
}

[data-theme="dark"] .popup-comment p {
    color: #fbbf24;
}

[data-theme="dark"] .popup-action-item {
    background: #252940;
    color: #a0a4b8;
}

[data-theme="dark"] .popup-action-item:hover {
    background: #353a52;
    color: #e4e6f0;
}

[data-theme="dark"] .popup-action-item.view {
    background: rgba(43, 196, 138, 0.1);
    color: #5dd9a8;
}

[data-theme="dark"] .popup-action-item.view:hover {
    background: rgba(43, 196, 138, 0.18);
}

[data-theme="dark"] .popup-badge.compact-badge {
    background: #252940;
    color: #a0a4b8;
}

[data-theme="dark"] .popup-status-badge.compact-badge {
    background: rgba(43, 196, 138, 0.12);
    color: #5dd9a8;
}

[data-theme="dark"] .popup-address-compact {
    color: #a0a4b8;
    border-bottom-color: #353a52;
}

[data-theme="dark"] .popup-footer-claim {
    border-top-color: #353a52;
}

[data-theme="dark"] .btn-claim-link {
    color: #6b7094;
}

[data-theme="dark"] .btn-claim-link:hover {
    color: #5dd9a8;
}

[data-theme="dark"] .popup-favorite-btn-small {
    color: #6b7094;
}

[data-theme="dark"] .popup-favorite-btn-small:hover {
    color: #f87171;
}

/* ââ Mobile Bottom Sheet Dark ââ */
@media (max-width: 768px) {
    [data-theme="dark"] .popup-card {
        box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.5);
    }

    [data-theme="dark"] .distributor-popup-wrapper .leaflet-popup-content-wrapper {
        background: #1e2130 !important;
    }
}

/* âââââââââââââââââââââââââââââââââââââââ
   LEAFLET ATTRIBUTION â RESPONSIVE
   (Dark mode overrides consolidated below)
   âââââââââââââââââââââââââââââââââââââââ */

/* DARK MODE â Overrides Frontend */

/* Header Desktop */
[data-theme="dark"] .header {
    background: #1a1d27;
    border-bottom-color: #2a2e42;
}

[data-theme="dark"] .logo-text h1 {
    color: #e4e6f0;
}

[data-theme="dark"] .logo-text p {
    color: #6b7094;
}

[data-theme="dark"] .logo-icon i {
    color: #e4e6f0;
}

/* Bouton Auth dark */
[data-theme="dark"] .btn-auth {
    background: #252940;
    color: #e4e6f0;
    border: 1px solid #353a52;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .btn-auth:hover {
    background: #353a52;
}

/* User Avatar dark */
[data-theme="dark"] .user-avatar {
    background: #252940;
    color: #e4e6f0;
    border-color: #353a52;
}

[data-theme="dark"] .user-avatar:hover {
    border-color: #10b981;
    background: rgba(43, 196, 138, 0.08);
}

/* User Dropdown dark */
[data-theme="dark"] .user-dropdown {
    background: #1e2130;
    border-color: #2a2e42;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .user-dropdown a {
    color: #e4e6f0;
}

[data-theme="dark"] .user-dropdown a:hover {
    background: #252940;
    color: #e4e6f0;
}

[data-theme="dark"] .user-dropdown .logout-link {
    border-top-color: #2a2e42;
    color: #f56565;
}

/* Modale Auth dark */
[data-theme="dark"] .auth-modal-content {
    background: #1e2130;
    border-color: #2a2e42;
}

[data-theme="dark"] .modal-header {
    border-bottom-color: #2a2e42;
}

[data-theme="dark"] .auth-tabs {
    background: #1a1d27;
}

[data-theme="dark"] .tab-btn {
    color: #6b7094;
}

[data-theme="dark"] .tab-btn.active {
    background: #1e2130;
    color: #e4e6f0;
}

[data-theme="dark"] .tab-btn:hover:not(.active) {
    color: #a0a4b8;
}

[data-theme="dark"] .tab-btn.pro-tab {
    background: rgba(245, 101, 101, 0.08);
    color: #f88b8b;
}

[data-theme="dark"] .tab-btn.pro-tab.active {
    background: #1e2130;
    color: #f88b8b;
}

[data-theme="dark"] .close-modal {
    color: #6b7094;
}

[data-theme="dark"] .close-modal:hover {
    color: #e4e6f0;
}

[data-theme="dark"] .modal-body {
    background: #1e2130;
}

[data-theme="dark"] .form-group label {
    color: #c8cad6;
}

[data-theme="dark"] .form-group label i {
    color: #6b7094;
}

[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group textarea {
    background: #252940;
    border-color: #353a52;
    color: #e4e6f0;
}

[data-theme="dark"] .form-group input:focus,
[data-theme="dark"] .form-group textarea:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(43, 196, 138, 0.12);
}

[data-theme="dark"] .form-group input::placeholder,
[data-theme="dark"] .form-group textarea::placeholder {
    color: #6b7094;
}

[data-theme="dark"] .pro-warning {
    background: rgba(245, 101, 101, 0.08);
    border-left-color: #f56565;
}

[data-theme="dark"] .pro-warning i {
    color: #f88b8b;
}

[data-theme="dark"] .pro-warning p {
    color: #f88b8b;
}

/* NOTE : Popup dark mode rules consolidated above (lines ~1930-2170) — doublons nettoyés v7.0.0 */

/* Leaflet controls dark */
[data-theme="dark"] .leaflet-control-zoom a {
    background: #1e2130 !important;
    color: #a0a4b8 !important;
    border-bottom-color: #2a2e42 !important;
}

[data-theme="dark"] .leaflet-control-zoom a:hover {
    background: #252940 !important;
    color: #10b981 !important;
}

[data-theme="dark"] .leaflet-control-custom {
    background: #1e2130 !important;
    color: #a0a4b8 !important;
}

[data-theme="dark"] .leaflet-control-custom:hover {
    background: #252940 !important;
}

[data-theme="dark"] .leaflet-control-attribution {
    background: rgba(15, 17, 23, 0.85) !important;
    color: #6b7094 !important;
}

[data-theme="dark"] .leaflet-control-attribution a {
    color: #10b981 !important;
}

/* Version badge dark */
[data-theme="dark"] .logo-container .badge {
    background: rgba(43, 196, 138, 0.12) !important;
    color: #5dd9a8 !important;
    border-color: rgba(43, 196, 138, 0.25) !important;
}

/* Mobile header dark */
@media (max-width: 768px) {
    [data-theme="dark"] .logo-container {
        background: #1a1d27;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    }

    [data-theme="dark"] .btn-auth {
        background: #1a1d27;
        color: #e4e6f0;
        border-color: #2a2e42;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
    }

    [data-theme="dark"] .user-avatar {
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    }

    [data-theme="dark"] .modal-content {
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5) !important;
    }

    [data-theme="dark"] .modal-header::before {
        background: #353a52;
    }
}

[data-theme="dark"] .modal-close:hover {
    background: #353a52;
    color: #fff;
}

/* =====================================================
   MOBILE CROSS-BROWSER COMPATIBILITY FIXES v5.3.0
   Targets: iOS Safari, Samsung Internet, Firefox Android,
   Chrome Android (old), UC Browser, Opera Mini
   ===================================================== */

/* --- iOS Safe Area (Notch support) --- */
@supports (padding: env(safe-area-inset-top)) {
    @media (max-width: 768px) {

        body,
        html {
            /* Ensure content doesn't hide behind notch/home indicator */
            padding-top: env(safe-area-inset-top);
            padding-bottom: env(safe-area-inset-bottom);
        }

        /* Map takes full viewport minus safe areas */
        #map {
            height: calc(100dvh - var(--bottom-nav-h, 56px) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
        }

        /* Attribution above home indicator */
        .leaflet-control-attribution {
            bottom: env(safe-area-inset-bottom) !important;
        }
    }
}

/* --- Dynamic Viewport Height (modern browsers) --- */
/* dvh override supprimé — géré par homepage.css body.map-page #map */

/* --- Vertical Slider Firefox Fix --- */
/* Firefox Android does not support -webkit-appearance: slider-vertical */
@-moz-document url-prefix() {
    .vslider-input {
        -moz-appearance: none;
        appearance: none;
        writing-mode: vertical-lr;
        direction: rtl;
    }

    .vslider-input::-moz-range-track {
        width: 6px;
        background: #cbd5e1;
        border-radius: 99px;
    }

    .vslider-input::-moz-range-thumb {
        width: 20px;
        height: 20px;
        border-radius: 50%;
        background: #fff;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
        border: 2px solid #10b981;
        cursor: pointer;
    }
}

/* --- Samsung Internet & Old WebKit Fixes --- */
@media (max-width: 768px) {

    /* Fix: Samsung Internet ignores overflow hidden with fixed elements */
    .leaflet-container {
        -webkit-overflow-scrolling: touch;
        overflow: hidden;
    }

    /* Fix: Some Android browsers don't support backdrop-filter */
    @supports not (backdrop-filter: blur(10px)) {
        .vpanel-wrap {
            background: rgba(255, 255, 255, 0.98) !important;
        }

        .logo-container {
            background: #ffffff !important;
        }

        .popup-hero {
            background: rgba(255, 255, 255, 0.25) !important;
        }
    }

    /* Fix: Prevent 300ms tap delay on all interactive elements */
    a,
    button,
    input,
    select,
    textarea,
    .leaflet-control-zoom a,
    .leaflet-control-custom,
    .distributor-marker,
    .popup-action-btn,
    .popup-sm-btn,
    .popup-fav-btn {
        touch-action: manipulation;
    }

    /* Fix: Prevent iOS Safari rubber-banding on map */
    .leaflet-container {
        overscroll-behavior: none;
        -webkit-overflow-scrolling: auto;
    }

    /* Fix: .header pointer-events on mobile should not block scrolling */
    .header {
        touch-action: auto;
    }

    /* Fix: Bottom sheet popup z-index stacking on Samsung Internet */
    .leaflet-pane.leaflet-popup-pane {
        z-index: 700 !important;
        pointer-events: auto !important;
    }

    /* Fix: User marker not showing on some Android due to z-index */
    .user-marker-pulse {
        z-index: 500 !important;
    }

}

/* --- iOS Standalone (PWA installed) Fixes --- */
@media (display-mode: standalone) {

    body,
    html {
        /* In standalone mode, avoid overscroll completely */
        overscroll-behavior: none;
    }

    /* Extra safe area padding for PWA mode */
    .header-content {
        padding-top: env(safe-area-inset-top, 0px);
    }

    /* Ensure map fills to bottom safe area — bottom nav aware */
    #map {
        height: calc(100dvh - var(--bottom-nav-h, 56px) - env(safe-area-inset-top, 0px)) !important;
    }

    /* ── Fix PWA scroll sur pages de contenu (fiche distributeur, etc.) ── */
    body:not(.map-page) {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: auto;
        height: auto !important;
    }

    body:not(.map-page) html,
    html:has(body:not(.map-page)) {
        overflow: auto !important;
        height: auto !important;
        overscroll-behavior-y: auto;
    }

    /* Mini-carte dans la fiche distributeur — pas de height forcée */
    body:not(.map-page) #map {
        height: 220px !important;
    }
}

/* --- Accessibility: Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }


    .user-marker-pulse::before,
    .user-marker-pulse::after {
        animation: none !important;
    }
}

/* --- Print (hide map controls) --- */
@media print {

    .leaflet-control-zoom,
    .leaflet-control-custom,
    .vertical-panel-control,
    .header {
        display: none !important;
    }
}

/* --- 
   UNIVERSAL MODAL CENTERING â Mobile & Desktop
   Toutes les modales/popups s'ouvrent centrÃ©es.
   Login, inscription, config, etc.
--- */

/* Base modal overlay â always centered */
.modal,
.popup-overlay,
.auth-modal,
.config-modal,
.wizard-modal,
[class*="modal-overlay"],
[data-modal] {
    display: none;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 99999;
    justify-content: center;
    align-items: center;
}

/* When visible */
.modal.active,
.modal.show,
.popup-overlay.active,
.popup-overlay.show,
.auth-modal.active,
.config-modal.active,
.wizard-modal.active,
[class*="modal-overlay"].active,
[data-modal].active {
    display: flex !important;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: modalOverlayIn 0.25s ease both;
}

@keyframes modalOverlayIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Modal content â centered card */
.modal-content,
.popup-content,
.auth-modal-content,
.config-modal-content,
.wizard-modal-content,
[class*="modal-content"] {
    position: relative;
    max-width: 520px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25);
    animation: modalCardIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes modalCardIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Mobile specific: smaller modals, better padding */
@media (max-width: 768px) {

    .modal-content,
    .popup-content,
    .config-modal-content,
    .wizard-modal-content,
    [class*="modal-content"] {
        width: 92%;
        max-height: 80vh;
        max-width: 400px;
        border-radius: 18px;
    }

    /* ── BOTTOM SHEET MOBILE : Auth Modal ── */
    #authModal.modal {
        align-items: flex-end !important;
        padding: 0 !important;
    }

    #authModal .auth-modal-content {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        max-height: 90vh !important;
        max-height: 90dvh !important;
        border-radius: 24px 24px 0 0 !important;
        padding-bottom: env(safe-area-bottom, 20px) !important;
        animation: authBottomSheetIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) both !important;
    }
}

@keyframes authBottomSheetIn {
    from {
        opacity: 0;
        transform: translateY(100%);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Dark mode modals */
[data-theme="dark"] .modal-content,
[data-theme="dark"] .popup-content,
[data-theme="dark"] .auth-modal-content,
[data-theme="dark"] .config-modal-content,
[data-theme="dark"] [class*="modal-content"] {
    background: #1e293b;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
}

/* NOTE : @media prefers-reduced-motion consolidated above (line ~2580) — doublon nettoyé v7.0.0 */

/* ═══════════════════════════════════════════
   WCAG — Focus Visible (keyboard navigation)
   Anneau de focus clair pour navigation clavier,
   transparent au clic souris.
   ═══════════════════════════════════════════ */
:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    border-radius: 4px;
}

:focus:not(:focus-visible) {
    outline: none;
}