/* ================================================
   BeOut — Styles (source unique, sans Tailwind)
   ================================================ */

/* ===== POLICE ===== */
@font-face {
    font-family: 'Outfit';
    src: url('../fonts/Outfit/Outfit-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900;
    font-display: swap;
}

/* ===== RESET MINIMAL ===== */
*, *::before, *::after { box-sizing: border-box; }
a    { text-decoration: none; }
button { cursor: pointer; touch-action: manipulation; }
h1, h2, h3, h4, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

/* Supprime le délai 300ms sur tous les éléments tactiles */
a, button, input, select, textarea, .style-option, .fav-item {
    touch-action: manipulation;
}


/* ===== LAYOUT ===== */
body {
    margin: 0;
    padding: 0;
    height: 100vh;
    height: 100dvh; /* iOS Safari : exclut la barre d'URL */
    overflow: hidden;
    font-family: 'Outfit', sans-serif;
}

input, button, select, textarea {
    font-family: inherit;
}

#map {
    width: 100%;
    height: 100%;
    touch-action: none; /* laisser Leaflet gérer tous les gestes tactiles */
}

/* ===== HEADER ===== */
header {
    position: absolute;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    box-shadow: 0 2px 8px rgba(167, 167, 167, 0.6);
}

@supports not (backdrop-filter: blur(12px)) {
    header { background: rgba(255, 255, 255, 0.95); }
}

.header-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.header-logo-icon {
    font-size: 1.875rem;
    color: var(--color-primary);
}

.header-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text-primary);
}

.header-search {
    flex: 1;
    max-width: 42rem;
}

.search-wrapper {
    position: relative;
}

.search-input {
    width: 100%;
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.4);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    font-size: 0.9375rem;
}

.search-input:focus {
    background: rgba(255, 255, 255, 0.8);
    border-color: var(--color-primary-light);
    box-shadow: 0 0 0 2px rgba(147, 197, 253, 0.4);
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-placeholder);
    pointer-events: none;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

/* Texte masqué sur mobile */
.hide-mobile { display: inline; }

/* ===== SIDEBAR FAVORIS ===== */
/* ── Bouton flottant favoris ────────────────────────────────────────── */
#fav-picker {
    position: fixed;
    top: calc(var(--header-h, 60px) + 10px);
    right: 68px;
    z-index: 1000;
    pointer-events: none;
}

#fav-picker-toggle {
    pointer-events: auto;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
    color: #ef4444;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    position: relative;
}

#fav-picker-toggle:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.05);
}

.fav-count-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
}

.fav-count-badge.hidden { display: none; }

/* ── Panel favoris dédié ──────────────────────────────────────────── */
#favorites-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2000;
    background: var(--color-bg-activity-panel);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.14);
    height: 42vh;
    display: flex;
    flex-direction: column;
    transform: translateY(102%);
    transition: transform 0.38s cubic-bezier(0.32, 0.72, 0, 1),
                height 0.28s ease;
    overflow: hidden;
    will-change: transform;
}

#favorites-panel.panel-open {
    transform: translateY(0);
}

#favorites-panel.panel-expanded {
    height: 60vh;
}

#fav-drag-handle {
    width: 36px;
    height: 4px;
    background: var(--color-border-default);
    border-radius: 2px;
    margin: 10px auto 4px;
    flex-shrink: 0;
    cursor: pointer;
    touch-action: none;
}

#fav-panel-close {
    position: absolute;
    top: 10px;
    right: 14px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--color-bg-muted);
    border: none;
    color: var(--color-text-muted);
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    z-index: 10;
}

#fav-panel-close:hover { background: var(--color-bg-border); }

#fav-panel-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Desktop → panel droit indépendant */
@media (min-width: 768px) {
    #favorites-panel {
        top: 64px;
        bottom: 0;
        right: 0;
        left: auto;
        width: 340px;
        height: auto;
        border-radius: 0;
        box-shadow: -4px 0 24px rgba(0, 0, 0, 0.10);
        transform: translateX(100%);
        transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    }

    #favorites-panel.panel-open { transform: translateX(0); }
    #favorites-panel.panel-expanded { height: auto; }

    #fav-drag-handle { display: none; }
}

/* ── Items favoris dans le panel ──────────────────────────────────── */
.fav-list-content {
    padding: 0.75rem;
}

.fav-list-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-bg-border);
}

.fav-list-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-text-primary);
}

.fav-list-header i { color: #ef4444; }

.fav-item {
    padding: 0.75rem;
    background: rgba(249, 250, 251, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 0.5rem;
}

.fav-item:hover { background: rgba(243, 244, 246, 0.6); }
.fav-item:active { background: rgba(230, 230, 230, 0.8); }

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

.fav-item-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--color-text-primary);
}

.remove-favorite {
    background: none;
    border: none;
    color: #ef4444;
    padding: 0.35rem;
    line-height: 1;
    transition: color 0.2s, transform 0.15s;
    flex-shrink: 0;
    touch-action: manipulation;
}

.remove-favorite:hover { color: #b91c1c; transform: scale(1.15); }

.fav-item-meta {
    margin-top: 0.35rem;
}

.fav-empty {
    color: var(--color-text-muted);
    text-align: center;
    padding: 2.5rem 1rem;
    font-size: 0.9rem;
}

/* Scrollbar sidebar */
#favoritesContent::-webkit-scrollbar { width: 6px; }
#favoritesContent::-webkit-scrollbar-track { background: #f1f1f1; }
#favoritesContent::-webkit-scrollbar-thumb { background: var(--color-primary); border-radius: 3px; }
#favoritesContent::-webkit-scrollbar-thumb:hover { background: var(--color-primary-dark); }

/* ===== TOAST ===== */
#toast {
    position: fixed;
    top: calc(var(--header-h, 60px) + 0.75rem);
    left: 50%;
    transform: translateX(-50%) translateY(-8rem);
    z-index: 800;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--color-success);
    max-width: calc(100vw - 2rem);
}

#toast.toast-success { background-color: var(--color-success); }
#toast.toast-error   { background-color: var(--color-error); }
#toast.toast-info    { background-color: var(--color-primary); }

/* ===== MARQUEUR UTILISATEUR ===== */
.user-marker-container { z-index: 1000; }

.user-marker {
    width: 36px;
    height: 36px;
    background: var(--color-user-marker);
    border: 3px solid var(--color-user-marker-border);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    cursor: move;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-marker-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.1); }
}

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

/* ===== MARQUEUR ACTIVITÉ ===== */
.activity-marker-pin {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: 4px solid white;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    color: white;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-primary); /* couleur par défaut */
}

/* ===== CLUSTERS PAR CATÉGORIE ===== */
.custom-cluster {
    background: transparent !important;
    border: none !important;
}

.activity-cluster-pin {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
    color: white;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.cluster-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: white;
    color: var(--color-text-primary);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
    line-height: 1;
}

/* Cacher les styles par défaut de Leaflet.markercluster */
.leaflet-cluster-anim .leaflet-marker-icon,
.leaflet-cluster-anim .leaflet-marker-shadow {
    transition: transform 0.3s ease-out, opacity 0.3s ease-in;
}

/* ===== SÉLECTEUR DE STYLE DE CARTE ===== */
#style-picker {
    position: fixed;
    top: calc(var(--header-h, 60px) + 10px);
    right: 16px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    /* Ne pas bloquer les clics sur la carte quand le panel est fermé */
    pointer-events: none;
}

#style-picker-toggle,
#style-picker-panel.open {
    pointer-events: auto;
}

#style-picker-toggle {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
    color: var(--color-text-secondary);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
}

#style-picker-toggle:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.05);
}

#style-picker-panel {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    border-radius: 14px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 140px;
    /* Masqué par défaut — s'ouvre vers le bas */
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px) scale(0.97);
    transform-origin: top right;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

#style-picker-panel.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.style-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.style-option:hover {
    background: rgba(0, 0, 0, 0.05);
}

.style-option.active {
    background: rgba(59, 130, 246, 0.1);
}

.style-option.active .style-label {
    color: var(--color-primary-dark);
    font-weight: 600;
}

.style-preview {
    width: 28px;
    height: 20px;
    border-radius: 5px;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.style-preview--papillon { background: linear-gradient(135deg, #e8f0de, #c8ddc8); }
.style-preview--satellite { background: linear-gradient(135deg, #2d4a1e, #5a8a3a); }
.style-preview--nuit      { background: linear-gradient(135deg, #1a1a2e, #16213e); }
.style-preview--simple    { background: linear-gradient(135deg, #f0f4f8, #b8d4e8); }
.style-preview--propre    { background: linear-gradient(135deg, #006994, #00b8d4); }

.style-label {
    font-size: 13px;
    color: var(--color-text-secondary);
    user-select: none;
}

/* ===== LOADER CARTE ===== */
#map-loader {
    position: absolute;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(72px);
    z-index: 999;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 7px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--color-text-secondary);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    white-space: nowrap;
}

#map-loader.visible {
    transform: translateX(-50%) translateY(0);
}

.map-loader-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--color-bg-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

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

/* ===== LEAFLET ===== */
.leaflet-control-zoom { display: none !important; }

.leaflet-control-attribution {
    font-size: 10px;
    background: rgba(255, 255, 255, 0.6) !important;
    padding: 2px 6px !important;
}
.leaflet-control-attribution a { color: #555; }

/* ===== ACTIVITY PANEL — bottom sheet mobile / side panel desktop ===== */
#activity-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2000;
    background: var(--color-bg-activity-panel);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.14);
    height: 38vh;
    display: flex;
    flex-direction: column;
    transform: translateY(102%);
    transition: transform 0.38s cubic-bezier(0.32, 0.72, 0, 1),
                height 0.28s ease;
    overflow: hidden;
    will-change: transform;
}

#activity-panel.panel-open {
    transform: translateY(0);
}

#activity-panel.panel-expanded {
    height: 56vh;
}

#panel-drag-handle {
    width: 36px;
    height: 4px;
    background: var(--color-border-default);
    border-radius: 2px;
    margin: 10px auto 4px;
    flex-shrink: 0;
    cursor: pointer;
    touch-action: none;
}

#panel-close {
    position: absolute;
    top: 10px;
    right: 14px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--color-bg-muted);
    border: none;
    color: var(--color-text-muted);
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    z-index: 10;
}

#panel-close:hover { background: var(--color-bg-border); }

#panel-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Le contenu du panel prend toujours toute la largeur disponible */
#panel-content .popup-content {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}

#panel-content .popup-header,
#panel-content .popup-body,
#panel-content .popup-footer {
    width: 100%;
    box-sizing: border-box;
}

/* Image de la fiche : hauteur réduite */
#panel-content .popup-header {
    min-height: 72px;
    padding: 0.65rem 1rem;
}

#panel-content .popup-header.has-image {
    min-height: 100px;
    max-height: 100px;
    overflow: hidden;
}

/* Sur desktop → panneau latéral gauche */
@media (min-width: 768px) {
    #activity-panel {
        top: 64px; /* hauteur du header */
        bottom: 0;
        left: 0;
        right: auto;
        width: 380px;
        height: auto;
        border-radius: 0;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.10);
        transform: translateX(-100%);
        transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    }

    #activity-panel.panel-open  { transform: translateX(0); }
    #activity-panel.panel-expanded { height: auto; } /* pas de snap sur desktop */

    #panel-drag-handle { display: none; }

    /* Le popup-header n'a plus de coins arrondis sur desktop */
    #activity-panel .popup-header { border-radius: 0; }
}

/* Ajustement du popup-header à l'intérieur du panel */
#activity-panel .popup-header {
    border-radius: 0;
}

/* ===== POPUP LOADING / ERREUR ===== */
.popup-loading {
    padding: 1rem;
    text-align: center;
}

.popup-loading-spinner {
    font-size: 1.5rem;
    color: var(--color-primary);
}

.popup-loading-text {
    margin-top: 0.5rem;
    color: var(--color-text-muted);
}

.popup-error {
    padding: 1rem;
    text-align: center;
    color: var(--color-error);
}

/* ===== POPUP CONTENU ===== */
.popup-header {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    color: white;
    padding: 1rem;
    border-radius: 12px 12px 0 0;
}

/* Image (Wikidata / og:image) — couvre le rectangle, invisible par défaut */
.popup-header-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.popup-header-text { position: relative; z-index: 2; }

.popup-header.has-image .popup-header-img { opacity: 1; }

.popup-header.has-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.1) 100%);
    z-index: 1;
    pointer-events: none;
}

.popup-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.popup-body {
    padding: 1rem;
}

.popup-info-block { margin-bottom: 0.75rem; }

.popup-address {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #4b5563;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.popup-address-icon { color: var(--color-primary-dark); flex-shrink: 0; }

.popup-description {
    color: var(--color-text-secondary);
    font-size: 0.875rem;
}

.popup-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.popup-link {
    color: var(--color-primary-dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.2s;
}

.popup-link:hover { color: #1e40af; }
.popup-link-label { text-decoration: underline; }

.popup-footer {
    padding: 0 1rem 1rem 1rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Boutons du popup */
.popup-btn {
    flex: 1;
    min-width: 120px;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s, color 0.2s;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.popup-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-favorite        { background-color: var(--color-btn-favorite); color: var(--color-btn-favorite-text); }
.btn-favorite:hover  { background-color: var(--color-btn-favorite-hover); }
.btn-favorite.active { background-color: var(--color-btn-favorite-active); color: white; }

.btn-todo            { background-color: var(--color-btn-todo); color: var(--color-btn-todo-text); }
.btn-todo:hover      { background-color: var(--color-btn-todo-hover); }
.btn-todo.active     { background-color: var(--color-btn-todo-active); color: white; }

.btn-itinerary       { background-color: var(--color-btn-itinerary); color: var(--color-btn-itinerary-text); }
.btn-itinerary:hover { background-color: var(--color-btn-itinerary-hover); }

.btn-similar         { background-color: var(--color-btn-similar); color: var(--color-btn-similar-text); }
.btn-similar:hover   { background-color: var(--color-btn-similar-hover); }

/* Badge catégorie */
.category-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
    background-color: var(--color-bg-border);
    color: var(--color-text-secondary);
}

.category-musee,
.category-musée     { background-color: #dbeafe; color: #1e40af; }
.category-parc      { background-color: #d1fae5; color: #065f46; }
.category-cinema,
.category-cinéma    { background-color: #e0e7ff; color: #4338ca; }
.category-vie-nocturne,
.category-nightclub { background-color: #f3e8ff; color: #6b21a8; }
.category-restaurant{ background-color: #fed7aa; color: #9a3412; }
.category-golf      { background-color: #d1fae5; color: #065f46; }

/* ===== ANIMATION ===== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
.fade-in-up { animation: fadeInUp 0.5s ease-out; }

/* ===== RESPONSIVE MOBILE ===== */
@media (max-width: 640px) {
    /* Header : tout sur une seule ligne */
    .header-container {
        flex-wrap: nowrap;
        gap: 0.5rem;
        padding: 0.55rem 0.75rem;
    }

    .header-logo {
        flex-shrink: 0;
    }

    .header-search {
        flex: 1;
        min-width: 0;
        max-width: none;
    }

    /* 16px minimum pour éviter le zoom automatique iOS sur focus */
    .search-input { font-size: 16px; }

    .hide-mobile { display: none; }


    /* Popup */
    .leaflet-popup-content-wrapper {
        max-width: calc(100vw - 4rem) !important;
    }

    /* max-width uniquement pour le popup Leaflet flottant, pas pour le panel plein écran */
    .leaflet-popup .popup-content { max-width: 280px; }
    .popup-title   { font-size: 1.125rem; }

    .popup-footer {
        flex-direction: column;
        gap: 0.5rem;
    }

    .popup-btn { width: 100%; justify-content: center; }

    /* Marqueur utilisateur */
    .user-marker      { width: 32px; height: 32px; }
    .user-marker-icon { width: 20px; height: 20px; }
}

/* ===================================================================
   AUTH & COMPTE — styles ajoutés
   =================================================================== */

/* ── Bouton compte dans le header ──────────────────────────────────── */
.account-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.7);
    color: var(--color-text-secondary);
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, border-color 0.2s;
    overflow: hidden;
    padding: 0;
}

.account-btn:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: var(--color-primary);
}

.account-btn.logged-in {
    background: var(--color-primary);
    border-color: var(--color-primary-dark);
    color: white;
}

.account-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.account-initials {
    font-size: 0.875rem;
    font-weight: 700;
    color: white;
}

/* ── Backdrop commun aux overlays ──────────────────────────────────── */
.overlay-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: var(--color-backdrop);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.overlay-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

/* ── Modal Login ────────────────────────────────────────────────────── */
.login-modal {
    background: white;
    border-radius: 16px;
    padding: 2rem 1.75rem;
    width: min(420px, calc(100vw - 2rem));
    max-height: calc(100dvh - 2rem);
    overflow-y: auto;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2);
    position: relative;
    animation: slideInUp 0.25s ease;
}

@keyframes slideInUp {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.login-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.125rem;
    color: var(--color-text-placeholder);
    padding: 0.25rem;
    transition: color 0.2s;
}

.login-close-btn:hover { color: var(--color-text-secondary); }

.login-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.login-logo {
    font-size: 2.5rem;
    color: var(--color-primary);
    display: block;
    margin-bottom: 0.5rem;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text-heading);
    margin-bottom: 0.25rem;
}

.login-subtitle {
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.login-field {
    margin-bottom: 1rem;
}

.login-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 0.375rem;
}

.login-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1.5px solid var(--color-border-default);
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: white;
}

.login-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.login-input-otp {
    text-align: center;
    font-size: 1.5rem;
    letter-spacing: 0.5rem;
    font-weight: 700;
}

.login-btn {
    width: 100%;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    margin-bottom: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: background 0.2s, opacity 0.2s;
    touch-action: manipulation;
    position: relative;
    z-index: 10;
}

/* Empêche le container reCAPTCHA d'intercepter les taps sur les boutons */
#login-recaptcha-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 0;
    overflow: visible;
    pointer-events: none;
}
#login-recaptcha-container > * {
    pointer-events: auto;
}

.login-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.login-btn-primary {
    background: var(--color-primary);
    color: white;
}

.login-btn-primary:hover:not(:disabled) { background: var(--color-primary-dark); }

.login-btn-secondary {
    background: var(--color-bg-muted);
    color: var(--color-text-secondary);
}

.login-btn-secondary:hover:not(:disabled) { background: var(--color-bg-border); }

.login-error {
    background: #fef2f2;
    color: var(--color-error-dark);
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

.login-legal {
    font-size: 0.75rem;
    color: var(--color-text-placeholder);
    text-align: center;
    margin-top: 0.75rem;
}

/* ── Panneau compte (drawer latéral droit) ─────────────────────────── */
#account-panel {
    position: fixed;
    inset: 0;
    z-index: 2000;
    pointer-events: none;
}

#account-panel.open {
    pointer-events: auto;
}

.account-backdrop {
    position: absolute;
    inset: 0;
    background: var(--color-backdrop-account);
    opacity: 0;
    transition: opacity 0.3s ease;
}

#account-panel.open .account-backdrop {
    opacity: 1;
}

.account-drawer {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(380px, 100vw);
    background: var(--color-bg-account-panel);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
}

#account-panel.open .account-drawer {
    transform: translateX(0);
}

.account-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--color-bg-muted);
    flex-shrink: 0;
}

.account-drawer-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-text-heading);
}

.account-close-btn {
    background: none;
    border: none;
    font-size: 1.125rem;
    color: var(--color-text-placeholder);
    padding: 0.25rem;
    transition: color 0.2s;
}

.account-close-btn:hover { color: var(--color-text-secondary); }

/* Profil */
.account-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    flex-shrink: 0;
}

.account-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.account-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--color-primary);
    color: white;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.account-avatar img { width: 100%; height: 100%; object-fit: cover; }

.account-initials-lg {
    font-size: 1.25rem;
    font-weight: 700;
}

.account-avatar-edit {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--color-text-secondary);
    color: white;
    border: 2px solid white;
    font-size: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.account-info { flex: 1; min-width: 0; }

.account-pseudo-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.account-pseudo {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-text-heading);
}

.account-edit-btn {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 0.875rem;
    padding: 0.125rem 0.25rem;
    cursor: pointer;
    transition: color 0.2s;
}

.account-edit-btn:hover { color: var(--color-primary); }

.account-phone {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    letter-spacing: 0.05em;
}

/* Formulaire édition inline */
.account-edit-form {
    padding: 0.75rem 1.25rem;
    background: var(--color-bg-subtle);
    border-bottom: 1px solid var(--color-bg-muted);
}

.account-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1.5px solid var(--color-border-default);
    border-radius: 8px;
    font-size: 0.9375rem;
    outline: none;
    margin-bottom: 0.5rem;
    transition: border-color 0.2s;
}

.account-input:focus { border-color: var(--color-primary); }

.account-edit-actions {
    display: flex;
    gap: 0.5rem;
}

/* ── Zone d'upload avatar ── */
.avatar-upload-label {
    display: block;
    cursor: pointer;
    margin-bottom: 0.75rem;
}

.avatar-upload-preview {
    min-height: 120px;
    border: 2px dashed var(--color-border-default);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    background: #ffffff;
    transition: border-color 0.2s, background 0.2s;
}

.avatar-upload-label:hover .avatar-upload-preview,
.avatar-upload-label.drag-over .avatar-upload-preview {
    border-color: var(--color-primary);
    background: #eff6ff;
}

.avatar-upload-icon {
    font-size: 2rem;
    color: var(--color-text-placeholder);
}

.avatar-upload-hint {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    text-align: center;
    line-height: 1.5;
}

.avatar-upload-hint small {
    font-size: 0.75rem;
    color: var(--color-text-placeholder);
}

.avatar-upload-img-preview {
    width: 100%;
    max-height: 140px;
    object-fit: cover;
    border-radius: 8px;
}

.account-btn-primary:disabled {
    background: #93c5fd;
    cursor: not-allowed;
}

.account-btn-primary {
    padding: 0.375rem 0.875rem;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.account-btn-primary:hover { background: var(--color-primary-dark); }

.account-btn-secondary {
    padding: 0.375rem 0.875rem;
    background: var(--color-bg-muted);
    color: var(--color-text-secondary);
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s;
}

.account-btn-secondary:hover { background: var(--color-bg-border); }

/* Accordéons */
.account-sections {
    flex: 1;
    padding: 0.75rem 0;
}

.account-accordion {
    border-bottom: 1px solid var(--color-bg-muted);
}

.account-accordion-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-size: 0.9375rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
}

.account-accordion-toggle:hover { background: var(--color-bg-subtle); }

.accordion-chevron {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--color-text-placeholder);
    transition: transform 0.2s;
}

.accordion-chevron.rotated { transform: rotate(180deg); }

.account-accordion-body {
    padding: 0 1.25rem 0.875rem;
    max-height: 35vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.account-empty-msg {
    font-size: 0.875rem;
    color: var(--color-text-placeholder);
    text-align: center;
    padding: 0.75rem 0;
}

/* Amis */
.friend-add-wrap {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.friend-add-wrap .account-input {
    flex: 1;
    margin-bottom: 0;
}

.account-btn-primary-sm {
    padding: 0.375rem 0.625rem;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    flex-shrink: 0;
    transition: background 0.2s;
}

.account-btn-primary-sm:hover { background: var(--color-primary-dark); }

.account-btn-danger-sm {
    padding: 0.375rem 0.625rem;
    background: #fee2e2;
    color: var(--color-error-dark);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    flex-shrink: 0;
    transition: background 0.2s;
}

.account-btn-danger-sm:hover { background: #fecaca; }

.account-section-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-placeholder);
    margin-bottom: 0.5rem;
}

.friend-request-item,
.friend-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-bg-subtle);
}

.friend-avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #dbeafe;
    color: #1e40af;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.friend-name {
    flex: 1;
    font-size: 0.9375rem;
    color: var(--color-text-secondary);
    font-weight: 500;
}

.friend-request-actions {
    display: flex;
    gap: 0.375rem;
}

.friend-remove-btn {
    background: none;
    border: none;
    color: var(--color-border-default);
    font-size: 0.875rem;
    cursor: pointer;
    padding: 0.25rem;
    transition: color 0.2s;
}

.friend-remove-btn:hover { color: var(--color-error); }

/* Listes d'activités */
.account-activity-list { display: flex; flex-direction: column; gap: 0.25rem; }

.account-activity-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.5rem;
    border-bottom: 1px solid var(--color-bg-subtle);
    cursor: pointer;
    border-radius: var(--border-radius-sm, 6px);
    transition: background-color 0.15s;
}
.account-activity-item:hover {
    background-color: var(--color-bg-muted);
}

.account-activity-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.account-activity-name {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--color-text-heading);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-activity-type {
    font-size: 0.75rem;
    color: var(--color-text-placeholder);
    text-transform: capitalize;
}

.account-activity-remove {
    background: none;
    border: none;
    color: var(--color-border-default);
    font-size: 0.875rem;
    cursor: pointer;
    padding: 0.25rem;
    flex-shrink: 0;
    transition: color 0.2s;
}

.account-activity-remove:hover { color: var(--color-error); }

/* Badge note dans la liste */
.activity-rating-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    display: inline-block;
}

.activity-rating-badge.rating-1,
.activity-rating-badge.rating-2 { background: #fee2e2; color: #b91c1c; }
.activity-rating-badge.rating-3  { background: #fef3c7; color: #92400e; }
.activity-rating-badge.rating-4,
.activity-rating-badge.rating-5  { background: #d1fae5; color: #065f46; }

/* Déconnexion */
.account-logout-btn {
    margin: 1rem 1.25rem 1.5rem;
    padding: 0.75rem;
    background: #fee2e2;
    color: var(--color-error-dark);
    border: none;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    transition: background 0.2s;
    flex-shrink: 0;
}

.account-logout-btn:hover { background: #fecaca; }

/* ── Note moyenne — badge dans le header du popup ──────────────────── */
.popup-header-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.25rem;
}

.rating-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
}

.rating-badge-green  { background: var(--color-rating-badge-green); color: var(--color-success-text); }
.rating-badge-orange { background: var(--color-rating-badge-orange); color: var(--color-warning-text); }
.rating-badge-red    { background: var(--color-rating-badge-red);  color: var(--color-error-text); }

/* ── Barre de notation (5 boutons dans la fiche) ──────────────────── */
.rating-section {
    padding: 0.75rem 1rem 0.75rem;
}

.rating-bar {
    display: flex;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--color-bg-border);
}

.rating-btn {
    flex: 1;
    padding: 0.5rem 0.25rem;
    border: none;
    border-right: 1px solid var(--color-bg-border);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: transform 0.15s, filter 0.15s, font-weight 0.15s;
    transition: filter 0.15s;
    line-height: 1.2;
}

.rating-btn:last-child { border-right: none; }

.rating-btn:hover { filter: brightness(0.92); }

.rating-btn-1 { background: var(--color-rating-1); color: var(--color-rating-1-text); }
.rating-btn-2 { background: var(--color-rating-2); color: var(--color-rating-2-text); }
.rating-btn-3 { background: var(--color-rating-3); color: var(--color-rating-3-text); }
.rating-btn-4 { background: var(--color-rating-4); color: var(--color-rating-4-text); }
.rating-btn-5 { background: var(--color-rating-5); color: var(--color-rating-5-text); }

.rating-btn-active {
    outline: 2.5px solid currentColor;
    outline-offset: -2.5px;
    filter: brightness(0.85);
    font-weight: 800;
    transform: scale(1.05);
    z-index: 1;
    position: relative;
}

/* Bouton spinner d'attente */
.hidden { display: none !important; }

/* ── Responsive mobile — compte & login ──────────────────────────── */
@media (max-width: 640px) {
    .login-modal {
        padding: 1.5rem 1.25rem;
        border-radius: 16px 16px 0 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-height: 90dvh;
        animation: slideInUpMobile 0.25s ease;
        transition: transform 0.15s ease;
        will-change: transform;
    }

    @keyframes slideInUpMobile {
        from { transform: translateY(100%); }
        to   { transform: translateY(0); }
    }

    .overlay-backdrop { align-items: flex-end; }

    .account-drawer { width: 90vw; }

    .rating-btn { font-size: 0.65rem; padding: 0.5rem 0.1rem; }
}
