/**
 * Nom du fichier : search.map.css
 * Description : Styles dédiés pour la carte Leaflet de la page /search.
 *               Couleurs cohérentes avec la charte Reserva (oasis #0E7490).
 *
 *               FIX z-index v3 (conv 22) :
 *               - Le conteneur #search-map-container crée un stacking context
 *                 isolé avec isolation: isolate ET un z-index négatif/bas.
 *               - TOUS les éléments internes de Leaflet (panes, tiles,
 *                 markers, controls, popups, tooltips) sont contraints
 *                 à des z-index faibles (1-10), mais comme ils sont
 *                 DANS un stacking context isolé, peu importe leur valeur,
 *                 ils ne peuvent pas passer par-dessus la barre de recherche
 *                 (z-20) ni le header (quelle que soit sa valeur).
 * Module : Search
 * Auteur : Reserva
 * Date de création : 17/04/2026
 * Dernière modification : 17/04/2026
 */

/* ===== STACKING CONTEXT ISOLÉ POUR LA CARTE ===== */
/* isolation: isolate crée un nouveau stacking context : tout ce qui est
   à l'intérieur reste à l'intérieur, peu importe les z-index internes. */
#search-map-container {
    position: relative;
    isolation: isolate;
    z-index: 0;
}

/* ===== FIX z-index interne Leaflet ===== */
/* On force tout Leaflet à des valeurs faibles par sécurité
   (ceinture + bretelles avec le stacking context au-dessus). */
#search-map .leaflet-pane         { z-index: 1  !important; }
#search-map .leaflet-tile-pane    { z-index: 2  !important; }
#search-map .leaflet-overlay-pane { z-index: 3  !important; }
#search-map .leaflet-shadow-pane  { z-index: 4  !important; }
#search-map .leaflet-marker-pane  { z-index: 5  !important; }
#search-map .leaflet-tooltip-pane { z-index: 6  !important; }
#search-map .leaflet-popup-pane   { z-index: 7  !important; }
#search-map .leaflet-control      { z-index: 8  !important; }
#search-map .leaflet-top,
#search-map .leaflet-bottom       { z-index: 8  !important; }

/* ===== Conteneur principal de la carte ===== */
#search-map {
    width: 100%;
    height: 420px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
    position: relative;
    z-index: 1;
}

.dark #search-map {
    border-color: #374151;
}

@media (max-width: 640px) {
    #search-map {
        height: 320px;
    }
}

/* ===== Marqueur utilisateur (point bleu pulsant) ===== */
.reserva-user-marker {
    background: transparent;
    border: none;
}

.reserva-user-dot {
    width: 20px;
    height: 20px;
    background: #2563EB;
    border: 3px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.25);
    animation: reserva-pulse 2s ease-in-out infinite;
}

@keyframes reserva-pulse {
    0%, 100% {
        box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.25);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(37, 99, 235, 0.12);
    }
}

/* ===== Marqueur tenant (épingle avec initiale) ===== */
.reserva-tenant-marker {
    background: transparent;
    border: none;
}

.reserva-tenant-pin {
    width: 32px;
    height: 40px;
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 5px;
    /* Forme goutte d'eau */
    background: #0E7490;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    border: 2px solid #ffffff;
}

.reserva-tenant-initial {
    transform: rotate(45deg);
    color: #ffffff;
    font-weight: 700;
    font-size: 14px;
    font-family: system-ui, -apple-system, sans-serif;
}

/* ===== Popup Leaflet personnalisé ===== */
.reserva-popup {
    min-width: 180px;
    padding: 0.25rem 0;
}

.reserva-popup-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #1f2937;
    margin-bottom: 0.375rem;
    line-height: 1.3;
}

.reserva-popup-rating {
    font-size: 0.8125rem;
    color: #4b5563;
    margin-bottom: 0.25rem;
}

.reserva-popup-reviews {
    color: #9ca3af;
    font-size: 0.75rem;
}

.reserva-popup-distance {
    font-size: 0.8125rem;
    color: #0E7490;
    margin-bottom: 0.625rem;
    font-weight: 500;
}

.reserva-popup-btn {
    display: inline-block;
    background: #0E7490;
    color: #ffffff !important;
    text-decoration: none !important;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 600;
    transition: background 0.15s ease;
}

.reserva-popup-btn:hover {
    background: #0C4A6E;
    color: #ffffff !important;
}

/* ===== Dark mode ===== */
.dark .leaflet-popup-content-wrapper {
    background: #1f2937;
    color: #f9fafb;
}

.dark .leaflet-popup-tip {
    background: #1f2937;
}

.dark .reserva-popup-title {
    color: #f9fafb;
}

.dark .reserva-popup-rating {
    color: #d1d5db;
}

.dark .reserva-popup-distance {
    color: #67E8F9;
}

/* ===== Correctif Leaflet : attribution plus discrète ===== */
.leaflet-control-attribution {
    font-size: 10px !important;
    background: rgba(255, 255, 255, 0.85) !important;
}

.dark .leaflet-control-attribution {
    background: rgba(31, 41, 55, 0.85) !important;
    color: #9ca3af !important;
}

.dark .leaflet-control-attribution a {
    color: #67E8F9 !important;
}
