/* =================================================================
   autourdemoi.mobile.css
   CSS mobile dédié — chargé uniquement sur écrans ≤ 768 px
   Pattern : carte plein écran + bottom sheet draggable
   Version compacte : en position "peek", seuls la poignée et les
   onglets restent visibles — recherche / filtre / rayon / stats
   ne réapparaissent qu'en position "mid" ou "full", pour laisser
   le maximum d'espace à la carte.
   ================================================================= */

/* ─────────────────────────────────────────────────────────────────
   TOKENS LOCAUX (overrides uniquement sur mobile)
   ─────────────────────────────────────────────────────────────────*/
:root {
    --mob-sheet-radius:    20px;
    --mob-sheet-bg:        var(--bg, #fff);
    --mob-sheet-shadow:    0 -4px 32px rgba(0,0,0,.14);
    --mob-bar-h:           60px;           /* hauteur barre onglets */
    --mob-handle-h:        22px;           /* zone drag + pill (réduite) */
    --mob-peek:            96px;           /* hauteur mini-sheet : poignée + onglets seulement */
    --mob-mid:             52vh;           /* mi-hauteur */
    --mob-full:            92vh;           /* plein écran sheet */
    --mob-topbar-h:        48px;
    --mob-transition:      cubic-bezier(.32,1,.45,1);
    --mob-accent:          var(--primary, #2563eb);
    --mob-danger:          #ef4444;
    --mob-warning:         #f59e0b;
}

@media (max-width: 768px) {

/* ══════════════════════════════════════════════════════════════════
   RESET LAYOUT DESKTOP — on repart de zéro
   ══════════════════════════════════════════════════════════════════*/
.mobile-topbar  { display: flex !important; }
.app-shell      { display: block !important; position: relative; width: 100%; height: 100%; }

/* Cache la sidebar desktop, on va reconstruire en bottom-sheet */
.sidebar {
    /* neutralise tout ce que autourdemoi.css lui met */
    position: fixed !important;
    inset: auto 0 0 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: var(--mob-full) !important;
    max-height: var(--mob-full) !important;
    border-radius: var(--mob-sheet-radius) var(--mob-sheet-radius) 0 0 !important;
    box-shadow: var(--mob-sheet-shadow) !important;
    background: var(--mob-sheet-bg) !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    z-index: 900 !important;
    /* État initial : peek (juste la poignée + onglets visibles) */
    transform: translateY(calc(var(--mob-full) - var(--mob-peek))) !important;
    transition: transform .38s var(--mob-transition) !important;
    /* Supprime tout border desktop */
    border: none !important;
    border-right: none !important;
}

/* ── États du sheet ────────────────────────────────────────────── */
.sidebar.sheet-peek {
    transform: translateY(calc(var(--mob-full) - var(--mob-peek))) !important;
}
.sidebar.sheet-mid {
    transform: translateY(calc(var(--mob-full) - var(--mob-mid))) !important;
}
.sidebar.sheet-full {
    transform: translateY(0) !important;
}

/* Bloque la transition pendant le drag */
.sidebar.dragging {
    transition: none !important;
}

/* ── Compacité maximale en position "peek" ──────────────────────
   On masque tout sauf la poignée + la barre d'onglets, pour que
   la carte occupe le maximum d'espace visible par défaut.        */
.sidebar.sheet-peek .sidebar-header,
.sidebar.sheet-peek .distance-row,
.sidebar.sheet-peek .stats-bar {
    display: none !important;
}

/* La carte prend tout l'écran */
.map-zone {
    position: fixed !important;
    inset: var(--mob-topbar-h) 0 0 0 !important;
    width: 100% !important;
    height: calc(100% - var(--mob-topbar-h)) !important;
    z-index: 1 !important;
}

#map {
    width: 100% !important;
    height: 100% !important;
}

/* ══════════════════════════════════════════════════════════════════
   TOPBAR MOBILE — redesign
   ══════════════════════════════════════════════════════════════════*/
.mobile-topbar {
    position: fixed !important;
    top: 0; left: 0; right: 0;
    height: var(--mob-topbar-h);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    /* Fond glassmorphisme */
    background: rgba(var(--bg-rgb, 255,255,255), .88) !important;
    backdrop-filter: blur(12px) saturate(1.6);
    -webkit-backdrop-filter: blur(12px) saturate(1.6);
    border-bottom: 1px solid rgba(0,0,0,.07);
    box-shadow: 0 1px 8px rgba(0,0,0,.08);
}

.mobile-topbar h1 {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--txt, #111);
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.mobile-topbar h1 i {
    color: var(--mob-accent);
    font-size: 15px;
}

.topbar-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}

/* Boutons topbar */
.topbar-actions .icon-btn {
    width: 32px; height: 32px;
    border-radius: 9px;
    border: 1px solid rgba(0,0,0,.08);
    background: var(--bg, #fff);
    color: var(--txt-2, #555);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    cursor: pointer;
    transition: background .15s, transform .1s;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
}
.topbar-actions .icon-btn:active { transform: scale(.93); }

/* ══════════════════════════════════════════════════════════════════
   POIGNÉE DE DRAG + PILL
   ══════════════════════════════════════════════════════════════════*/
.mob-drag-handle {
    flex-shrink: 0;
    height: var(--mob-handle-h);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.mob-drag-handle::before {
    content: '';
    width: 36px; height: 4px;
    background: rgba(0,0,0,.18);
    border-radius: 99px;
    transition: background .2s, width .2s;
}

.sidebar.sheet-full .mob-drag-handle::before {
    background: rgba(0,0,0,.12);
}

/* ══════════════════════════════════════════════════════════════════
   HEADER SIDEBAR (dans le sheet)
   ══════════════════════════════════════════════════════════════════*/
.sidebar-header {
    flex-shrink: 0;
    padding: 0 12px 8px !important;
}

.sidebar-title {
    display: none !important; /* Titre masqué : l'info est dans la topbar */
}

/* Barre de recherche */
.search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-2, #f4f4f5);
    border: 1px solid var(--border, #e4e4e7);
    border-radius: 11px;
    padding: 0 11px;
    height: 36px;
    margin-bottom: 8px;
    transition: border-color .2s, box-shadow .2s;
}

.search-bar:focus-within {
    border-color: var(--mob-accent);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.search-bar i {
    color: var(--txt-3, #aaa);
    font-size: 12px;
    flex-shrink: 0;
}

.search-bar input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-size: 13px;
    color: var(--txt, #111);
    min-width: 0;
}

.search-bar input::placeholder { color: var(--txt-3, #aaa); }

/* Champ filtre catégorie (select) — compact sur mobile */
.field-group { padding: 0; margin-bottom: 0; }
.field-label { display: none; }
.field-select {
    height: 34px;
    font-size: 12px;
    padding: 0 26px 0 10px;
}

/* Filtres catégories (ancien système chips, conservé au cas où) — scroll horizontal pill */
.filters {
    display: flex !important;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
    margin-bottom: 0;
}
.filters::-webkit-scrollbar { display: none; }

.filters .chip {
    flex-shrink: 0;
    height: 28px;
    padding: 0 11px;
    border-radius: 99px;
    border: 1.5px solid var(--border, #e4e4e7);
    background: var(--bg, #fff);
    color: var(--txt-2, #555);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, border-color .15s, color .15s, transform .1s;
}

.filters .chip:active { transform: scale(.95); }

.filters .chip.active {
    background: var(--mob-accent);
    border-color: var(--mob-accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(37,99,235,.3);
}

/* ══════════════════════════════════════════════════════════════════
   BARRE DE STATS + DISTANCE
   ══════════════════════════════════════════════════════════════════*/
.distance-row {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-2, #f9f9f9);
    border-top: 1px solid var(--border, #e4e4e7);
    border-bottom: 1px solid var(--border, #e4e4e7);
}

.distance-row label {
    font-size: 11px;
    font-weight: 600;
    color: var(--txt-2, #555);
    white-space: nowrap;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.distance-row input[type=range] {
    flex: 1;
    accent-color: var(--mob-accent);
    height: 4px;
    cursor: pointer;
}

.distance-val {
    font-size: 11px;
    font-weight: 700;
    color: var(--mob-accent);
    min-width: 36px;
    text-align: right;
    flex-shrink: 0;
}

/* Stats bar */
.stats-bar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 12px;
    border-bottom: 1px solid var(--border, #e4e4e7);
}

.stats-count {
    font-size: 11px;
    color: var(--txt-2, #666);
}

.stats-count strong {
    color: var(--mob-accent);
    font-weight: 700;
}

#btnFitBounds {
    font-size: 10px;
    height: 24px;
    padding: 0 9px;
    border-radius: 99px;
    border: 1.5px solid var(--border, #e4e4e7);
    background: var(--bg, #fff);
    color: var(--txt-2, #555);
    display: flex; align-items: center; gap: 5px;
    cursor: pointer;
    font-weight: 600;
}

/* ══════════════════════════════════════════════════════════════════
   ONGLETS — barre fixe dans le sheet (sticky), toujours visible
   ══════════════════════════════════════════════════════════════════*/
.tab-row {
    flex-shrink: 0;
    display: flex !important;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    gap: 0;
    background: var(--bg, #fff);
    border-bottom: 2px solid var(--border, #e4e4e7);
    padding: 0 4px;
    position: sticky;
    top: 0;
    z-index: 2;
}
.tab-row::-webkit-scrollbar { display: none; }

.tab-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    height: 38px;
    padding: 0 10px;
    background: none;
    border: none;
    border-bottom: 2.5px solid transparent;
    margin-bottom: -2px;
    font-size: 11px;
    font-weight: 600;
    color: var(--txt-3, #aaa);
    cursor: pointer;
    white-space: nowrap;
    transition: color .18s, border-color .18s;
}

.tab-btn i {
    font-size: 12px;
}

.tab-btn.active {
    color: var(--mob-accent);
    border-bottom-color: var(--mob-accent);
}

/* Couleurs spécifiques par onglet */
#tabCoeurs.active        { color: var(--mob-danger);  border-bottom-color: var(--mob-danger); }
#tabEvenements.active    { color: var(--mob-warning); border-bottom-color: var(--mob-warning); }
#tabAssociations.active  { color: #16a34a;             border-bottom-color: #16a34a; }
#tabFavoris.active       { color: #f59e0b;             border-bottom-color: #f59e0b; }

/* Badges dans les onglets */
.tab-btn span {
    border-radius: 99px;
    padding: 1px 5px;
    font-size: 9px;
    font-weight: 700;
    line-height: 1.5;
}

/* ══════════════════════════════════════════════════════════════════
   LISTE DES COMMERCES
   ══════════════════════════════════════════════════════════════════*/
.commerce-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    /* Espace pour ne pas être caché par la barre de navigation du téléphone */
    padding-bottom: env(safe-area-inset-bottom, 16px);
}

/* Carte commerce */
.commerce-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--border, #f0f0f0);
    cursor: pointer;
    transition: background .12s;
    position: relative;
}

.commerce-card:active,
.commerce-card.active { background: var(--hover, #f5f5f5); }

.commerce-avatar {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg-2, #f4f4f5);
}

.commerce-avatar-fallback {
    width: 42px; height: 42px;
    border-radius: 11px;
    background: var(--bg-2, #f4f4f5);
    display: flex; align-items: center; justify-content: center;
    font-size: 19px;
    flex-shrink: 0;
}

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

.commerce-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--txt, #111);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.commerce-meta {
    font-size: 11px;
    color: var(--txt-3, #aaa);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.commerce-dist {
    font-size: 10px;
    font-weight: 700;
    color: var(--mob-accent);
    flex-shrink: 0;
    background: rgba(37,99,235,.08);
    padding: 3px 7px;
    border-radius: 99px;
}

/* ── Badge coup de cœur ── */
.badge-coeur {
    display: inline-flex; align-items: center; gap: 3px;
    background: #fee2e2; color: #ef4444;
    border: 1px solid #fca5a5;
    border-radius: 99px;
    font-size: 9px; font-weight: 700; padding: 1px 6px;
    margin-top: 3px;
}

/* ── Carte événement ── */
.event-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--border, #f0f0f0);
    cursor: pointer;
    transition: background .12s;
}
.event-card:active,
.event-card.active { background: var(--hover, #f5f5f5); }

.event-icon {
    width: 40px; height: 40px;
    border-radius: 11px;
    background: #fef3c7;
    display: flex; align-items: center; justify-content: center;
    font-size: 19px;
    flex-shrink: 0;
}

.event-date-badge {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 9px; font-weight: 700;
    color: var(--mob-warning);
    background: #fef3c7;
    border-radius: 99px;
    padding: 2px 7px;
    margin-top: 3px;
}

.event-date-badge.badge-today {
    background: #dcfce7;
    color: #16a34a;
}

/* ── État vide ── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 28px 20px;
    color: var(--txt-3, #aaa);
    text-align: center;
}

.empty-state i { font-size: 28px; opacity: .4; }
.empty-state p { font-size: 12px; line-height: 1.5; margin: 0; }

/* ══════════════════════════════════════════════════════════════════
   CONTRÔLES CARTE — repositionnés pour mobile
   ══════════════════════════════════════════════════════════════════*/
.map-controls {
    position: fixed !important;
    /* Collé à droite, centré verticalement sur la carte visible */
    right: 10px !important;
    top: calc(var(--mob-topbar-h) + 10px) !important;
    bottom: auto !important;
    left: auto !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    z-index: 500 !important;
}

.map-btn {
    width: 34px; height: 34px;
    border-radius: 9px;
    border: 1px solid rgba(0,0,0,.1);
    background: rgba(var(--bg-rgb, 255,255,255), .92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0,0,0,.12);
    color: var(--txt-2, #555);
    font-size: 13px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: transform .1s, background .15s;
}

.map-btn:active { transform: scale(.92); }
.map-btn.active { background: var(--mob-accent); color: #fff; border-color: var(--mob-accent); }

/* Bouton "Ma position" — repositionné au-dessus du sheet */
.locate-btn {
    position: fixed !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    bottom: calc(var(--mob-peek) + 12px) !important;
    right: auto !important;
    top: auto !important;
    z-index: 850 !important;
    /* Style pill flottant, compact */
    height: 38px;
    padding: 0 16px;
    border-radius: 99px;
    background: var(--mob-accent) !important;
    color: #fff !important;
    border: none !important;
    font-size: 12px;
    font-weight: 700;
    display: flex; align-items: center; gap: 7px;
    box-shadow: 0 4px 18px rgba(37,99,235,.4);
    cursor: pointer;
    transition: transform .15s, box-shadow .15s, bottom .38s var(--mob-transition);
    white-space: nowrap;
}

.locate-btn:active {
    transform: translateX(-50%) scale(.96) !important;
    box-shadow: 0 2px 10px rgba(37,99,235,.3);
}

/* Le bouton "Ma position" monte quand le sheet est à mi-hauteur */
body.sheet-is-mid .locate-btn {
    bottom: calc(var(--mob-mid) + 12px) !important;
}

/* Le bouton "Ma position" monte encore quand le sheet est en plein écran */
body.sheet-is-full .locate-btn {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) scale(.8) !important;
}

/* ══════════════════════════════════════════════════════════════════
   OVERLAY (fond sombre quand sheet est ouvert) — optionnel
   ══════════════════════════════════════════════════════════════════*/
.overlay {
    /* On désactive l'overlay desktop sur mobile : le sheet est semi-transparent */
    display: none !important;
}

/* ══════════════════════════════════════════════════════════════════
   BOUTON THÈME DESKTOP — masqué sur mobile (géré par topbar)
   ══════════════════════════════════════════════════════════════════*/
.theme-toggle { display: none !important; }

/* ══════════════════════════════════════════════════════════════════
   POPUPS LEAFLET — adaptés au mobile
   ══════════════════════════════════════════════════════════════════*/
.leaflet-popup-content-wrapper {
    border-radius: 16px !important;
    box-shadow: 0 8px 32px rgba(0,0,0,.18) !important;
    padding: 0 !important;
    overflow: hidden;
}

.leaflet-popup-content {
    margin: 0 !important;
    width: calc(100vw - 64px) !important;
    max-width: 280px !important;
}

.popup-inner {
    padding: 14px !important;
}

.popup-name {
    font-size: 15px !important;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 6px;
}

.popup-meta {
    font-size: 12px;
    color: var(--txt-3, #aaa);
    display: flex; align-items: center; gap: 5px;
    margin-top: 3px;
}

.popup-actions {
    display: flex;
    gap: 7px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.popup-btn {
    height: 36px;
    padding: 0 14px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex; align-items: center; gap: 5px;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: transform .1s;
}
.popup-btn:active { transform: scale(.95); }

.popup-btn-primary {
    background: var(--mob-accent);
    color: #fff;
}

.popup-btn-secondary {
    background: var(--bg-2, #f4f4f5);
    color: var(--txt-2, #555);
    border: 1px solid var(--border, #e4e4e7);
}

/* ══════════════════════════════════════════════════════════════════
   SECTION TITRE DANS LA LISTE (favoris)
   ══════════════════════════════════════════════════════════════════*/
.list-section-title {
    padding: 8px 12px 5px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--txt-3, #aaa);
    background: var(--bg-2, #f9f9f9);
    border-bottom: 1px solid var(--border, #f0f0f0);
    display: flex;
    align-items: center;
    gap: 6px;
    position: sticky;
    top: 0;
    z-index: 1;
}

/* ══════════════════════════════════════════════════════════════════
   ANIMATION KEYFRAME (pulse marqueur utilisateur)
   ══════════════════════════════════════════════════════════════════*/
@keyframes userPulse {
    0%, 100% { transform: scale(1);   opacity: .6; }
    50%       { transform: scale(1.5); opacity: 0;  }
}

/* ══════════════════════════════════════════════════════════════════
   DARK MODE MOBILE
   ══════════════════════════════════════════════════════════════════*/
.dark-mode {
    --mob-sheet-bg: var(--bg, #18181b);
}

.dark-mode .mobile-topbar {
    background: rgba(24,24,27,.9) !important;
    border-bottom-color: rgba(255,255,255,.07);
}

.dark-mode .search-bar {
    background: rgba(255,255,255,.06);
    border-color: rgba(255,255,255,.1);
}

.dark-mode .filters .chip {
    background: rgba(255,255,255,.06);
    border-color: rgba(255,255,255,.1);
    color: var(--txt-2, #aaa);
}

.dark-mode .map-btn {
    background: rgba(24,24,27,.88);
    border-color: rgba(255,255,255,.1);
    color: #ccc;
}

.dark-mode .locate-btn {
    box-shadow: 0 4px 18px rgba(37,99,235,.5);
}

.dark-mode .commerce-dist {
    background: rgba(37,99,235,.18);
    color: #93c5fd;
}

.dark-mode .event-icon {
    background: rgba(245,158,11,.15);
}

.dark-mode .badge-coeur {
    background: rgba(239,68,68,.15);
    border-color: rgba(239,68,68,.3);
    color: #f87171;
}

.dark-mode .mob-drag-handle::before {
    background: rgba(255,255,255,.2);
}

.dark-mode .leaflet-popup-content-wrapper {
    background: var(--bg, #18181b) !important;
    color: var(--txt, #f4f4f5);
}

} /* fin @media (max-width: 768px) */