/* ============================================================
   map-ui.css — Panneau latéral avec recherche + filtres intégrés
   SpotRegio — Version 2.0
   ============================================================ */

/* ============================================================
   VARIABLES
   ============================================================ */
:root {
    --sidebar-width: 340px;
    --sidebar-bg: #ffffff;
    --sidebar-shadow: 4px 0 24px rgba(0, 0, 0, 0.10);
    --accent: #D4AF37;
    --accent-dark: #B8960C;
    --text-primary: #1a1a2e;
    --text-secondary: #666;
    --text-light: #999;
    --border: #e8e8e8;
    --hover-bg: #f8f7f5;
    --card-radius: 10px;
    --rating-5: #D4AF37;
    --rating-4: #4A90D9;
    --rating-3: #5cb85c;
    --rating-2: #aaa;
    --rating-1: #ccc;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   PANNEAU LATÉRAL
   ============================================================ */
#map-sidebar {
    position: fixed;
    top: 110px;          /* sous le header (60px) + bandeau doré (50px) */
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - 110px);
    z-index: 500;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition);
    pointer-events: none; /* Le inner réactive */
}

#map-sidebar.sidebar-closed {
    transform: translateX(calc(-1 * var(--sidebar-width)));
}

#map-sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--sidebar-bg);
    box-shadow: var(--sidebar-shadow);
    overflow: hidden;
    pointer-events: all;
}

/* ============================================================
   BARRE DE RECHERCHE (dans le panneau)
   ============================================================ */
#map-search-section {
    padding: 10px 10px 0;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--border);
    position: relative;
}

#map-search-bar {
    display: flex;
    align-items: center;
    background: #f5f4f1;
    border-radius: 22px;
    padding: 0 14px;
    height: 44px;
    gap: 8px;
    border: 2px solid transparent;
    transition: border-color var(--transition), background var(--transition);
    margin-bottom: 8px;
}

#map-search-bar:focus-within {
    background: #fff;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.12);
}

#map-search-icon {
    font-size: 0.95rem;
    flex-shrink: 0;
    color: var(--text-secondary);
}

#map-search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.88rem;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    background: transparent;
    min-width: 0;
}

#map-search-input::placeholder {
    color: var(--text-light);
}

#map-search-clear {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    font-size: 0.85rem;
    padding: 3px 5px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
    flex-shrink: 0;
}

#map-search-clear:hover {
    background: var(--border);
    color: var(--text-primary);
}

/* Suggestions */
#map-search-suggestions {
    position: absolute;
    top: 100%;
    left: 10px;
    right: 10px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    border: 1px solid var(--border);
    max-height: 320px;
    overflow-y: auto;
    z-index: 600;
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background var(--transition);
    border-bottom: 1px solid var(--border);
}

.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover { background: var(--hover-bg); }

.suggestion-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    width: 28px;
    text-align: center;
}

.suggestion-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.suggestion-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggestion-name mark {
    background: rgba(212, 175, 55, 0.25);
    color: var(--accent-dark);
    border-radius: 2px;
    padding: 0 1px;
}

.suggestion-meta {
    font-size: 0.72rem;
    color: var(--text-light);
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggestion-rating {
    font-size: 0.7rem;
    color: var(--accent);
    flex-shrink: 0;
}

.suggestion-empty {
    padding: 16px;
    text-align: center;
    color: var(--text-light);
    font-size: 0.82rem;
    font-family: 'Inter', sans-serif;
}

/* ============================================================
   FILTRES (dans le panneau)
   ============================================================ */
#map-filters-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 10px;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
}

#map-filters-bar::-webkit-scrollbar { display: none; }

.map-filter-group {
    position: relative;
    flex-shrink: 0;
}

.map-filter-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    background: var(--hover-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    font-size: 0.78rem;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--transition), border-color var(--transition);
    font-weight: 500;
}

.map-filter-btn:hover {
    background: #f0ede6;
    border-color: var(--accent);
}

.map-filter-btn.filter-active {
    background: #fdf9ee;
    border-color: var(--accent);
    color: var(--accent-dark);
}

.filter-arrow {
    font-size: 0.65rem;
    opacity: 0.7;
}

.filter-active-dot {
    font-size: 0.5rem;
    color: var(--accent);
}

#map-filters-reset {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 5px 8px;
    background: none;
    border: 1px solid #e0b0b0;
    border-radius: 16px;
    font-size: 0.75rem;
    color: #c0392b;
    cursor: pointer;
    white-space: nowrap;
    font-family: 'Inter', sans-serif;
    transition: background var(--transition);
    flex-shrink: 0;
}

#map-filters-reset:hover { background: #fdf0f0; }

/* Dropdowns des filtres */
.map-filter-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 200px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.14);
    z-index: 600;
    overflow: hidden;
}

.filter-dd-header {
    padding: 10px 14px 6px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-light);
    font-family: 'Inter', sans-serif;
    border-bottom: 1px solid var(--border);
}

.filter-dd-scroll {
    max-height: 240px;
    overflow-y: auto;
}

.filter-dd-scroll::-webkit-scrollbar { width: 3px; }
.filter-dd-scroll::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

.filter-dd-group {
    padding: 6px 14px 2px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-light);
    font-family: 'Inter', sans-serif;
    background: #fafafa;
}

.filter-dd-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 0.82rem;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    transition: background var(--transition);
}

.filter-dd-item:hover { background: var(--hover-bg); }

.filter-dd-item input[type="radio"] {
    accent-color: var(--accent);
    flex-shrink: 0;
}

.filter-dd-item span:first-of-type { flex: 1; }

.filter-count {
    font-size: 0.7rem;
    color: var(--text-light);
    background: var(--hover-bg);
    padding: 1px 5px;
    border-radius: 8px;
    flex-shrink: 0;
}

/* ============================================================
   EN-TÊTE DU PANNEAU (compteur)
   ============================================================ */
#map-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    height: 38px;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

#map-sidebar-count {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
    font-weight: 500;
}

#map-sidebar-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    width: 26px;
    height: 26px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
}

#map-sidebar-toggle:hover { background: var(--hover-bg); }

/* ============================================================
   LISTE DES CARTES POI
   ============================================================ */
#map-sidebar-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
    scroll-behavior: smooth;
}

#map-sidebar-list::-webkit-scrollbar { width: 4px; }
#map-sidebar-list::-webkit-scrollbar-track { background: transparent; }
#map-sidebar-list::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

/* Bouton "Voir plus" */
#map-sidebar-more {
    padding: 10px 12px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

#map-sidebar-load-more {
    width: 100%;
    padding: 9px;
    background: var(--hover-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.82rem;
    color: var(--text-primary);
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    transition: background var(--transition);
}

#map-sidebar-load-more:hover {
    background: #f0ede6;
    border-color: var(--accent);
    color: var(--accent-dark);
}

/* Bouton réouvrir */
#map-sidebar-open-btn {
    position: absolute;
    right: -34px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 60px;
    background: var(--sidebar-bg);
    border: 1px solid var(--border);
    border-left: none;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-secondary);
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 3px 0 8px rgba(0,0,0,0.08);
    pointer-events: all;
}

#map-sidebar.sidebar-closed #map-sidebar-open-btn { display: flex; }
#map-sidebar-open-btn:hover { background: var(--hover-bg); }

/* ============================================================
   CARTES POI
   ============================================================ */
.sidebar-card {
    display: flex;
    gap: 10px;
    padding: 8px;
    border-radius: var(--card-radius);
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
    border: 2px solid transparent;
    margin-bottom: 3px;
}

.sidebar-card:hover {
    background: var(--hover-bg);
    transform: translateY(-1px);
}

.sidebar-card.selected {
    border-color: var(--accent);
    background: #fdf9ee;
}

.sidebar-card-img {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}

.sidebar-card-img-placeholder {
    background: linear-gradient(135deg, #f0ede6, #e8e4da);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

.sidebar-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-card-type {
    font-size: 0.67rem;
    color: var(--text-light);
    font-family: 'Inter', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-card-name {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.sidebar-card-location {
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-card-rating {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 1px;
}

.sidebar-card-rating .stars { font-size: 0.7rem; letter-spacing: 0.5px; }
.sidebar-card-rating .rating-num { font-size: 0.7rem; font-weight: 600; font-family: 'Inter', sans-serif; }

.rating-5 .stars, .rating-5 .rating-num { color: var(--rating-5); }
.rating-4 .stars, .rating-4 .rating-num { color: var(--rating-4); }
.rating-3 .stars, .rating-3 .rating-num { color: var(--rating-3); }
.rating-2 .stars, .rating-2 .rating-num { color: var(--rating-2); }
.rating-1 .stars, .rating-1 .rating-num { color: var(--rating-1); }

/* États vides / chargement */
.sidebar-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 36px 20px;
    gap: 10px;
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
}

.sidebar-spinner {
    width: 26px;
    height: 26px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.sidebar-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 36px 20px;
    gap: 8px;
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
}

.sidebar-empty span { font-size: 1.8rem; }
.sidebar-empty p { margin: 0; font-size: 0.82rem; line-height: 1.5; }

.sidebar-error {
    padding: 20px;
    text-align: center;
    color: #e53935;
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
}


/* ============================================================
   MARQUEUR DE GÉOLOCALISATION ANIMÉ (pulsant vert émeraude)
   ============================================================ */

/* Animation de pulsation des cercles concentriques */
@keyframes geoloc-pulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    70% {
        transform: scale(2.8);
        opacity: 0;
    }
    100% {
        transform: scale(2.8);
        opacity: 0;
    }
}

@keyframes geoloc-pulse-2 {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }
    70% {
        transform: scale(2.2);
        opacity: 0;
    }
    100% {
        transform: scale(2.2);
        opacity: 0;
    }
}

@keyframes geoloc-dot-glow {
    0%, 100% {
        box-shadow:
            0 0 0 0 rgba(16, 185, 129, 0.6),
            0 0 8px rgba(16, 185, 129, 0.4);
    }
    50% {
        box-shadow:
            0 0 0 6px rgba(16, 185, 129, 0),
            0 0 16px rgba(16, 185, 129, 0.6);
    }
}

/* Conteneur principal du marqueur géolocalisation */
.geoloc-marker-container {
    position: relative;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Cercles de pulsation (onde) */
.geoloc-pulse-ring {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.35);
    animation: geoloc-pulse 2.4s ease-out infinite;
    top: 0;
    left: 0;
}

.geoloc-pulse-ring-2 {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.25);
    animation: geoloc-pulse-2 2.4s ease-out infinite;
    animation-delay: 0.6s;
    top: 0;
    left: 0;
}

/* Cercle extérieur vert émeraude */
.geoloc-outer-ring {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.3);
    border: 2px solid rgba(16, 185, 129, 0.7);
    top: 0;
    left: 0;
}

/* Point central blanc avec bordure verte */
.geoloc-center-dot {
    position: relative;
    z-index: 2;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.4);
    animation: geoloc-dot-glow 2.4s ease-in-out infinite;
}

/* ============================================================
   BOUTON "MA POSITION" SUR LA CARTE
   ============================================================ */
#btn-my-location {
    position: absolute;
    bottom: 120px;
    right: 12px;
    z-index: 1000;
    width: 40px;
    height: 40px;
    background: #ffffff;
    border: 2px solid rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
    font-size: 18px;
    line-height: 1;
    color: #555;
}

#btn-my-location:hover {
    background: #f0fdf4;
    border-color: #10b981;
    color: #10b981;
    transform: scale(1.05);
}

#btn-my-location.active {
    background: #ecfdf5;
    border-color: #10b981;
    color: #10b981;
}

#btn-my-location.loading {
    animation: spin 1s linear infinite;
    pointer-events: none;
}

/* Tooltip du bouton */
#btn-my-location::after {
    content: 'Ma position';
    position: absolute;
    right: 48px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(30, 30, 30, 0.85);
    color: #fff;
    font-size: 0.72rem;
    font-family: 'Inter', sans-serif;
    padding: 4px 8px;
    border-radius: 5px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

#btn-my-location:hover::after {
    opacity: 1;
}

/* Cercle de précision de géolocalisation */
.geoloc-accuracy-circle {
    /* Géré dynamiquement via Leaflet circle */
}