/* ==========================================================================
   EXTENSION CONFIGURATION : MMFR CARTE COMMUNAUTAIRE (mmfr_carte.css)
   Couleurs de référence : 
   - Bleu Nuit (Principal/Header) : #11304a
   - Bleu Clair (Accent/Boutons) : #4b8fcb ou #12a3eb
   - Rouge (Modération/Alertes/Survol) : #d41142 ou #ef4444
   ========================================================================== */

/* --- 1. FONDS ET STRUCTURE GLOBALE --- */
.dashboard-page {
    background-color: #fafbfd;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #334155;
    margin: 0;
    padding: 0;
}

.dashboard-page .container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
    box-sizing: border-box;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    align-items: flex-start;
}

@media (max-width: 992px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }
}

/* --- 2. BARRE DE NAVIGATION COMMUNE (DASHBOARD) --- */
.dashboard-page .navbar {
    background: linear-gradient(135deg, #11304a 0%, #0a1f31 100%);
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(17, 48, 74, 0.15);
}

.dashboard-page .navbar h1 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.dashboard-page .navbar .nav-links {
    display: flex;
    gap: 10px;
    align-items: center;
}

.dashboard-page .navbar .nav-links a {
    color: #f1f5f9;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.dashboard-page .navbar .nav-links a:hover {
    background: #4b8fcb;
    border-color: #4b8fcb;
    color: #ffffff;
}

.dashboard-page .navbar .nav-links a.admin-btn {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.dashboard-page .navbar .nav-links a.admin-btn:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: #ffffff;
}

/* --- RESPONSIVE MOBILE : NAVBAR & RECHERCHE --- */
@media (max-width: 768px) {
    .dashboard-page .navbar {
        flex-direction: column; /* Empile le titre et les boutons */
        padding: 12px;
        gap: 12px;
    }
    .dashboard-page .navbar h1,
    .dashboard-page .navbar h2 {
        font-size: 16px !important;
        text-align: center;
        margin: 0;
    }
    .dashboard-page .navbar .nav-links {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
    #search-poi-container {
        width: calc(100% - 40px); /* Empêche la barre de dépasser de l'écran */
    }
}

/* --- 3. PANNEAUX (PANELS) --- */
.dashboard-page .panel {
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 15px rgba(17, 48, 74, 0.03);
    margin-bottom: 25px;
    overflow: hidden;
}

.dashboard-page .panel-header {
    background: #11304a;
    color: #ffffff;
    padding: 14px 20px;
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-page .panel-body {
    padding: 20px;
}

/* --- 4. FORMULAIRES ET BOUTONS --- */
.dashboard-page .form-group {
    margin-bottom: 15px;
}

.dashboard-page .form-group label {
    display: block;
    font-weight: 700;
    font-size: 13px;
    color: #475569;
    margin-bottom: 6px;
}

.dashboard-page .form-control {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background-color: #ffffff;
    color: #1e293b;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.dashboard-page .form-control:focus {
    outline: none;
    border-color: #4b8fcb;
    box-shadow: 0 0 0 3px rgba(75, 143, 203, 0.15);
}

.dashboard-page .smart-input {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.dashboard-page .smart-input .form-control {
    flex: 1;
}

.dashboard-page .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 700;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    text-decoration: none;
}

.dashboard-page .btn:active {
    transform: scale(0.98);
}

.dashboard-page .btn-primary {
    background-color: #4b8fcb;
    color: #ffffff;
}

.dashboard-page .btn-primary:hover {
    background-color: #3573ab;
}

.dashboard-page .btn-success {
    background-color: #10b981;
    color: #ffffff;
}

.dashboard-page .btn-success:hover {
    background-color: #059669;
}

.dashboard-page .btn-danger {
    background-color: #ef4444;
    color: #ffffff;
}

.dashboard-page .btn-danger:hover {
    background-color: #dc2626;
}

.dashboard-page .btn-small {
    padding: 5px 10px;
    font-size: 11px;
    border-radius: 4px;
}

/* --- 5. ALERTES (NOTIFICATIONS FLASH) --- */
.dashboard-page .alert {
    padding: 12px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 20px;
    border: 1px solid transparent;
}

.dashboard-page .alert-success {
    background-color: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}

.dashboard-page .alert-danger {
    background-color: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

/* --- 6. TABLEAUX DE DONNÉES (ADMIN & CLASSES) --- */
.dashboard-page .data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.dashboard-page .data-table th {
    background-color: #f8fafc;
    color: #475569;
    font-weight: 700;
    padding: 12px 15px;
    border-bottom: 2px solid #e2e8f0;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.dashboard-page .data-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #edf2f7;
    vertical-align: middle;
}

.dashboard-page .data-table tbody tr:hover {
    background-color: #f8fafc;
}

/* Éléments spécifiques d'édition admin */
.dashboard-page .score-input {
    width: 70px;
    padding: 5px;
    font-size: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    text-align: center;
}

.dashboard-page .badge {
    display: inline-block;
    padding: 3px 8px;
    font-size: 10px;
    font-weight: 800;
    border-radius: 4px;
    text-transform: uppercase;
}

.dashboard-page .badge.public { background: #e0f2fe; color: #0369a1; }
.dashboard-page .badge.prive { background: #fee2e2; color: #b91c1c; }

/* --- 7. STYLE DE PAGE CLASSEMENT (PALMARÈS) --- */
.info-bar {
    background-color: #f1f5f9;
    padding: 10px 20px;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.point-badge {
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    padding: 2px 6px;
    border-radius: 4px;
    color: #11304a;
}

/* Lignes podium */
.rank-1 { background-color: #fffdf5; }
.rank-1 .rank-badge { background: #f59e0b !important; color: #ffffff; font-weight: 800; }
.rank-2 { background-color: #f8fafc; }
.rank-2 .rank-badge { background: #94a3b8 !important; color: #ffffff; }
.rank-3 { background-color: #fcfcfc; }
.rank-3 .rank-badge { background: #b45309 !important; color: #ffffff; }

.rank-cell {
    width: 50px;
    text-align: center;
}

.rank-badge {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    margin: 0 auto;
}

.member-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.member-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #cbd5e1;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.rank-1 .member-avatar {
    background: #fef3c7;
    color: #d97706;
    border: 2px solid #f59e0b;
}

.member-name {
    font-size: 14px;
    font-weight: 700;
    color: #11304a;
}

.member-stats {
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
    display: flex;
    align-items: center;
}

.badges-container {
    display: inline-flex;
    gap: 4px;
}

.badge-icon {
    font-size: 14px;
    cursor: help;
}

.points-cell {
    text-align: right;
    width: 120px;
}

.points-value {
    font-size: 18px;
    font-weight: 800;
    color: #11304a;
}

.points-label {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
}

/* --- 8. CARDS DE LISTING DES OUTILS (ESPACE PERSO) --- */
.item-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.item-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 12px 15px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    transition: background-color 0.2s;
}

.item-card:hover {
    background-color: #f8fafc;
}

.item-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.item-info strong {
    font-size: 13.5px;
    color: #11304a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-info span {
    font-size: 11px;
    color: #64748b;
}

.item-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.item-desc {
    width: 100%;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #e2e8f0;
    font-size: 12px;
    color: #475569;
    line-height: 1.4;
}

/* --- 9. FENÊTRES MODALES (MODALS) --- */
.dashboard-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(17, 48, 74, 0.4);
    backdrop-filter: blur(3px);
    align-items: center;
    justify-content: center;
}

.dashboard-modal-content {
    background-color: #ffffff;
    padding: 25px;
    border-radius: 10px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    position: relative;
    box-sizing: border-box;
}

.dashboard-modal-close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 24px;
    font-weight: bold;
    color: #94a3b8;
    cursor: pointer;
}

.dashboard-modal-close:hover {
    color: #ef4444;
}

/* --- 10. INTERFACE DE LA CARTE PRINCIPALE (LEAFLET CORRECTIONS) --- */
#map {
    width: 100%;
    height: calc(100vh - 70px); /* Ajustement automatique si barre au-dessus */
    position: relative;
}

/* Custom DivIcons des catégories de Spots */
.poi-icon {
    display: flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #ffffff;
    box-shadow: 0 3px 8px rgba(0,0,0,0.3);
    border: 2px solid #ffffff;
    transition: transform 0.2s;
}

.poi-icon:hover {
    transform: scale(1.15) rotate(5deg);
    z-index: 99999 !important;
}

.poi-icon i {
    font-size: 13px;
}

/* Palettes de couleurs dédiées par catégorie de bivouac/activités */
.icon-camp { background: #15803d !important; }        /* Vert dodo */
.icon-park { background: #1d4ed8 !important; }        /* Bleu parking */
.icon-nature { background: #166534 !important; }      /* Vert sombre nature */
.icon-service { background: #0ea5e9 !important; }     /* Cyan vidange */
.icon-shower { background: #6366f1 !important; }      /* Indigo douche */
.icon-laundry { background: #a855f7 !important; }     /* Violet linge */
.icon-rest { background: #475569 !important; }        /* Gris repos */
.icon-peak { background: #0f172a !important; }        /* Noir montagne */
.icon-view { background: #f59e0b !important; }        /* Orange panorama */
.icon-fuel { background: #b91c1c !important; }        /* Rouge carburant */
.icon-water { background: #38bdf8 !important; }       /* Bleu clair eau */
.icon-swim { background: #06b6d4 !important; }        /* Turquoise baignade */
.icon-cave { background: #78350f !important; }        /* Marron grotte */
.icon-act_gratuite { background: #ec4899 !important; } /* Rose activité gratuite */
.icon-act_payante { background: #db2777 !important; }  /* Rose foncé payant */
.icon-gpx { background: #232323 !important; border-color: #f59e0b !important; } /* Tracé maître */

/* --- 11. BARRE DE RECHERCHE SUR LA CARTE --- */
#search-poi-container {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1000;
    width: 320px;
}

.search-poi-input {
    width: 100%;
    padding: 12px 15px 12px 40px;
    font-size: 14px;
    background: #ffffff;
    border: none;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.12);
    box-sizing: border-box;
}

#search-poi-container::before {
    content: "🔍";
    position: absolute;
    left: 14px;
    top: 12px;
    font-size: 14px;
    z-index: 1001;
}

.search-poi-results {
    background: #ffffff;
    border-radius: 8px;
    margin-top: 5px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.12);
    max-height: 280px;
    overflow-y: auto;
    display: none;
}

.search-poi-item {
    padding: 10px 15px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #f1f5f9;
}

.search-poi-item:last-child {
    border-bottom: none;
}

.search-poi-item:hover {
    background-color: #f8fafc;
    color: #4b8fcb;
}

/* --- 12. POPUPS LEAFLET CUSTOMISÉES --- */
/* Bloc fantôme pour forcer Leaflet à panner la carte plus bas sous la recherche */
.leaflet-popup::before {
    content: "";
    display: block;
    height: 85px; /* Hauteur de l'espacement voulu en haut */
    width: 100%;
    pointer-events: none; /* Empêche de bloquer les clics sur la carte */
}

.leaflet-popup-content-wrapper {
    border-radius: 10px !important;
    padding: 0 !important;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(17, 48, 74, 0.2) !important;
}

.leaflet-popup-content {
    width: 280px !important;
    margin: 0 !important;
    font-family: inherit !important;
}

.popup-header {
    background: #f8fafc;
    padding: 12px 15px;
    border-bottom: 2px solid #4b8fcb;
}

.popup-header-type {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.popup-header-title {
    font-size: 15px;
    font-weight: 800;
    color: #11304a;
    margin-top: 4px;
    line-height: 1.3;
}

.popup-body {
    padding: 15px;
    font-size: 12.5px;
    line-height: 1.5;
}

.popup-item {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: flex-start;
}

.popup-item-icon {
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

.popup-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 8px;
    color: #ffffff !important;
    text-decoration: none !important;
    font-weight: 700;
    border-radius: 6px;
    font-size: 11.5px;
    box-sizing: border-box;
    text-align: center;
    border: none;
    cursor: pointer;
}

.popup-btn:hover {
    filter: brightness(1.1);
}

/* Couleurs des icones de la carte Leaflet */
.poi-icon {
    background-color: #124273; color: white; border-radius: 50%; border: 2px solid white;
    box-shadow: 0 0 4px rgba(0,0,0,0.5); display: flex; justify-content: center; align-items: center; font-size: 14px;
}
.icon-camp { background-color: #22c55e !important; }
    .icon-park { background-color: #3b82f6 !important; }
    .icon-nature { background-color: #16a34a !important; }
    .icon-service { background-color: #f59e0b !important; }
    .icon-shower, .icon-water { background-color: #0ea5e9 !important; }
    .icon-rest { background-color: #8b5cf6 !important; }
    .icon-view, .icon-peak { background-color: #ec4899 !important; }
    .icon-fuel { background-color: #ef4444 !important; }
    .icon-swim { background-color: #06b6d4 !important; }
    .icon-cave { background-color: #57534e !important; }
    .icon-gpx { background-color: #166534 !important; }
