/* Empilement des modales Bootstrap (robuste)
     Objectif:
     - Backdrop par défaut sous une modale simple
     - En cas de modale empilée (.media-library-modal), placer son backdrop au-dessus des autres modales
         mais en-dessous de la modale du dessus. */
.modal-backdrop { z-index: 1050 !important; }
.modal { z-index: 1055 !important; }
.modal.media-library-modal { z-index: 1060 !important; }
/* Utilise le sélecteur frère général pour cibler le backdrop inséré APRÈS la modale empilée */
.modal.media-library-modal ~ .modal-backdrop { z-index: 1058 !important; }
/* ========================================
   STYLES GÉNÉRAUX ET LAYOUT
   ======================================== */

/* Ajustement global du body pour éviter que le contenu soit masqué par la bannière */
body {
    padding-bottom: 2rem !important;
}

/* Arrière-plan personnalisé avec dégradé */
.bg-custom {
    background-image: -webkit-linear-gradient(top, var(--primary-color) 0%, var(--primary-color-light) 100%);
}

/* Animation pour le changement de vue */
#list,
#map {
    transition: all 0.3s ease-in-out;
}

/* ========================================
   CARTE ET ÉLÉMENTS LEAFLET
   ======================================== */

/* Message de chargement de la carte */
#map-loading-msg {
    position: fixed;
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    z-index: 999;
    background: var(--bg-loading);
}

/* Arrière-plan de la carte Leaflet */
.leaflet-container {
    background: url("/assets/img/bg2.png");
    background-size: contain;
}

/* Styles pour les marqueurs personnalisés */
.custom-marker-icon {
    background: var(--bg-transparent) !important;
    border: none !important;
}

.custom-marker-icon:hover {
    transform: scale(1.1);
    transition: transform 0.2s ease-in-out;
}

/* ========================================
   POPUPS LEAFLET
   ======================================== */

/* Styles de base pour les popups personnalisées */
.custom-popup .leaflet-popup-content-wrapper {
    border-radius: 8px !important;
    box-shadow: 0 4px 12px var(--shadow-medium) !important;
}

.custom-popup .leaflet-popup-content {
    margin: 12px 14px !important;
    line-height: 1.4 !important;
    font-size: 0.9rem !important;
}

.custom-popup .leaflet-popup-tip {
    background: var(--bg-white);
    border: none;
    box-shadow: 0 2px 4px var(--shadow-light) !important;
}

/* Amélioration de l'apparence générale des popups */
.leaflet-popup-content {
    margin: 12px 16px !important;
    line-height: 1.4;
}

.leaflet-popup-content h6 {
    color: var(--text-primary);
    border-bottom: 1px solid var(--text-border);
    padding-bottom: 6px;
}

/* Scrollbar personnalisée pour les popups */
.custom-popup .leaflet-popup-content div[style*="overflow-y"] {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-color) var(--bg-transparent);
}

.custom-popup .leaflet-popup-content div[style*="overflow-y"]::-webkit-scrollbar {
    width: 4px;
}

.custom-popup .leaflet-popup-content div[style*="overflow-y"]::-webkit-scrollbar-track {
    background: var(--bg-transparent);
}

.custom-popup .leaflet-popup-content div[style*="overflow-y"]::-webkit-scrollbar-thumb {
    background-color: var(--scrollbar-color);
    border-radius: 2px;
}

/* ========================================
   LISTE DES ENTITÉS
   ======================================== */

/* Conteneur principal de la liste */
#entities-list {
    border-radius: 0 0 8px 8px !important;
}

/* Éléments de la liste avec effets de survol */
#entities-list .list-group-item {
    border: none;
    border-radius: 8px !important;
    margin-bottom: 10px;
    box-shadow: 0 2px 4px var(--shadow-light);
    transition: transform 0.2s ease;
}

#entities-list .list-group-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow-medium);
}

/* En-tête de la section entités */
.entities-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-color-light) 100%);
    color: white;
    padding: 15px;
    border-radius: 8px 8px 0 0;
}

.entities-header h5 {
    margin: 0;
    font-weight: 600;
}

/* ========================================
   BANNIÈRE TRADEMARK
   ======================================== */

.trademark-banner {
    transition: background-color 0.3s ease, opacity 0.3s ease;
}

.trademark-banner:hover {
    background-color: var(--shadow-dark) !important;
}

/* ========================================
   TOASTS ET NOTIFICATIONS
   ======================================== */

.toast-container {
    z-index: 1200;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* Navigation mobile (écrans jusqu'à 550px) */
@media (max-width: 550px) {
    #nav-title {
        display: none;
    }

    .text-button {
        display: none;
    }
}

/* Mobile moyen (écrans jusqu'à 576px) */
@media (max-width: 576px) {
    body {
        padding-bottom: 1.8rem !important;
    }

    /* Ajustement des popups sur mobile */
    .custom-popup .leaflet-popup-content-wrapper {
        max-width: 250px !important;
    }

    .custom-popup .leaflet-popup-content {
        margin: 8px 10px !important;
        font-size: 0.85rem !important;
    }

    /* Réduction de la taille de la bannière sur mobile */
    .trademark-banner {
        font-size: 0.7rem !important;
    }

    .trademark-banner small {
        font-size: 0.6rem !important;
    }
}

/* Tablettes (écrans jusqu'à 768px) */
@media (max-width: 768px) {
    #entities-list .list-group-item {
        margin-bottom: 8px;
    }

    #entities-list .list-group-item h6 {
        font-size: 0.95rem;
    }

    #entities-list .list-group-item small {
        font-size: 0.75rem;
    }
}


/* ========================================
            STYLES BREADCRUMB/FIL D'ARIANE
        ======================================== */
.breadcrumb-container {
    /* Utiliser les variables de Bootstrap pour s'adapter au thème */
    background: linear-gradient(135deg, var(--bs-tertiary-bg) 0%, var(--bs-secondary-bg) 100%);
    border-bottom: 1px solid var(--bs-border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.breadcrumb-container .breadcrumb {
    background: transparent;
    padding: 0;
}

.breadcrumb-container .breadcrumb-item+.breadcrumb-item::before {
    content: ">";
    color: var(--bs-secondary-color);
    font-weight: bold;
}

.breadcrumb-container .breadcrumb-item a {
    /* Utiliser la couleur de lien du thème actif */
    color: var(--bs-link-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb-container .breadcrumb-item a:hover {
    color: var(--bs-link-hover-color);
    text-decoration: underline;
}

.breadcrumb-container .breadcrumb-item.active {
    color: var(--bs-emphasis-color);
    font-weight: 500;
}

/* Styles pour les dropdowns du breadcrumb */
.breadcrumb-container .dropdown-menu {
    background-color: var(--bs-dropdown-bg);
    border: 1px solid var(--bs-border-color);
    box-shadow: var(--bs-box-shadow, 0 4px 12px rgba(0, 0, 0, 0.15));
    border-radius: 6px;
}

.breadcrumb-container .dropdown-item {
    color: var(--bs-dropdown-link-color, var(--bs-body-color));
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
}

.breadcrumb-container .dropdown-item:hover {
    /* Conserver l'accent de la marque au survol, quel que soit le thème */
    background-color: var(--primary-color) !important;
    color: #fff !important;
}

.breadcrumb-container .dropdown-item.active {
    background-color: var(--primary-color) !important;
    color: #fff !important;
    font-weight: 500;
}

.breadcrumb-container .dropdown-item:focus {
    background-color: var(--primary-color-light) !important;
    color: #fff !important;
}

/* Responsive: sur mobile, réduire l'espacement */
@media (max-width: 768px) {
    .breadcrumb-container {
        padding: 0.5rem 0 !important;
    }
}