/* RESET & BASE */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #f0f2f5;
}

/* CONTENEUR PRINCIPAL */
#main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* BARRE DU HAUT - Thème Or Vénitien */
#top-bar {
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    padding: 12px 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    border-bottom: 2px solid #CAAF5E;
}

#toggle-view-btn {
    padding: 8px 16px;
    border: 1px solid #CAAF5E;
    background: transparent;
    color: #CAAF5E;
    cursor: pointer;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
}

#toggle-view-btn:hover {
    background: #CAAF5E;
    color: #1a1a1a;
}

/* BOUTON CHANGEMENT DE THÈME */
#theme-toggle-btn {
    margin-left: 15px;
    padding: 8px 15px;
    border: 2px solid #CAAF5E;
    background: linear-gradient(135deg, #1a1a1a 0%, #2c2c2c 100%);
    color: #CAAF5E;
    cursor: pointer;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(202, 175, 94, 0.3);
}

#theme-toggle-btn:hover {
    background: linear-gradient(135deg, #CAAF5E 0%, #A89048 100%);
    color: #000;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(202, 175, 94, 0.5);
}

#theme-toggle-btn:active {
    transform: translateY(0);
}

/* BOUTON GLOBE 3D */
#globe-btn {
    margin-left: 15px;
    padding: 8px 15px;
    border: 2px solid #CAAF5E;
    background: linear-gradient(135deg, #1a1a1a 0%, #2c2c2c 100%);
    color: #CAAF5E;
    cursor: pointer;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(202, 175, 94, 0.3);
}

#globe-btn:hover {
    background: linear-gradient(135deg, #CAAF5E 0%, #A89048 100%);
    color: #000;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(202, 175, 94, 0.5);
}

#globe-btn.active {
    background: linear-gradient(135deg, #CAAF5E 0%, #A89048 100%);
    color: #000;
}

#globe-btn:active {
    transform: translateY(0);
}

/* GLOBE CONTAINER (MapBox) */
#globe-container {
    flex: 1;
    position: relative;
}

/* MapBox popup styling */
.mapboxgl-popup-content {
    background: #1a1a1a !important;
    color: #fff !important;
    border: 1px solid #CAAF5E !important;
    border-radius: 8px !important;
    padding: 15px !important;
    font-family: 'Segoe UI', Tahoma, sans-serif !important;
}

.mapboxgl-popup-close-button {
    color: #CAAF5E !important;
    font-size: 20px !important;
}

.mapboxgl-popup-tip {
    border-top-color: #1a1a1a !important;
}

/* Thème clair actif */
#theme-toggle-btn.light-theme {
    background: linear-gradient(135deg, #ffffff 0%, #f0f0f0 100%);
    color: #333;
    border-color: #ccc;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

#theme-toggle-btn.light-theme:hover {
    background: linear-gradient(135deg, #e0e0e0 0%, #d0d0d0 100%);
    color: #000;
}

/* BOUTON "PRÈS DE MOI" - Thème Or */
#near-me-btn,
.btn-near-me {
    margin-left: 15px;
    padding: 8px 16px;
    border: 1px solid #CAAF5E;
    background: #CAAF5E;
    color: #1a1a1a;
    cursor: pointer;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
}

#near-me-btn:hover,
.btn-near-me:hover {
    background: #d4c078;
    transform: translateY(-1px);
}

#near-me-btn:active,
.btn-near-me:active {
    transform: translateY(0);
}

#near-me-btn:disabled,
.btn-near-me:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* BADGE DISTANCE */
.distance-badge {
    background: #4CAF50;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    display: inline-block;
    margin-left: 8px;
}

/* GROUPES DE DISTANCE */
.distance-group {
    margin-bottom: 20px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* STATS - Thème Or */
#stats-container {
    margin-left: 20px;
    position: relative;
}

#stats-summary {
    font-weight: 600;
    display: flex;
    align-items: center;
    color: #CAAF5E;
    font-size: 14px;
}

#stats-summary>button {
    margin-left: 10px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: #CAAF5E;
}

#stats-details {
    display: none;
    position: absolute;
    top: 40px;
    left: 0;
    background: #2a2a2a;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    border: 1px solid #CAAF5E;
    max-height: 200px;
    overflow-y: auto;
    width: 220px;
    z-index: 1000;
    color: #fff;
}

#stats-details ul {
    list-style: none;
}

#stats-details li {
    padding: 5px 0;
    border-bottom: 1px solid #f0f0f0;
}

#stats-details li:last-child {
    border-bottom: none;
}

/* BARRE DE RECHERCHE - Thème Or */
#search-bar {
    margin-left: auto;
    width: 250px;
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid #555;
    border-radius: 6px;
    background: #2a2a2a;
    color: #fff;
    transition: border-color 0.2s ease;
}

#search-bar:focus {
    outline: none;
    border-color: #CAAF5E;
}

#search-bar::placeholder {
    color: #888;
}

/* ZONE PRINCIPALE (CARTE + LISTE) */
#content-container {
    flex: 1;
    display: flex;
    width: 100%;
    position: relative;
}

/* CARTE */
#map-container {
    flex: 1;
    position: relative;
}

/* BOUTONS ZOOM - Thème Or */
.zoom-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 999;
}

.zoom-controls button {
    width: 36px;
    height: 36px;
    font-size: 18px;
    border: 1px solid #CAAF5E;
    background: #1a1a1a;
    color: #CAAF5E;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.zoom-controls button:hover {
    background: #CAAF5E;
    color: #1a1a1a;
}

/* LISTE - Thème sombre */
#list-container {
    flex: 1;
    display: none;
    background: #1a1a1a;
    overflow-y: auto;
    padding: 15px 20px;
}

/* CLASSEMENT PAR PAYS PUIS VILLE */
.country-group {
    margin-bottom: 15px;
    border-radius: 6px;
    background-color: #ffffff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    border: 1px solid #ddd;
    overflow: hidden;
}

.country-header {
    background-color: #ffffff;
    cursor: pointer;
    padding: 10px 15px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 16px;
    user-select: none;
}

.country-header .country-label {
    display: flex;
    align-items: center;
}

.country-header .country-flag {
    margin-right: 10px;
    font-size: 20px;
}

.country-header:hover {
    background-color: #f7f7f7;
}

.country-content {
    display: none;
    border-top: 1px solid #eee;
}

/* GROUPES DE VILLES */
.region-group {
    margin: 0;
    border-top: 1px solid #eee;
}

.region-header {
    padding: 8px 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    background-color: #fafafa;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.region-header:hover {
    background-color: #f0f0f0;
}

.region-content {
    display: none;
    padding: 5px 30px 10px 30px;
}

/* REVENDEUR ITEM */
.revendeur-item {
    background: #fff;
    margin-bottom: 8px;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
}

.revendeur-item:hover {
    background: #e9f2ff;
}

/* LOADING SPINNER - Thème Or */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

#loading-spinner {
    border: 4px solid #333;
    border-top: 4px solid #CAAF5E;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* MOBILE RESPONSIVE */
@media (max-width: 768px) {
    #content-container {
        flex-direction: column;
    }

    #map-container {
        height: 400px;
    }

    #search-bar {
        width: 150px;
    }

    #top-bar {
        flex-wrap: wrap;
        gap: 10px;
    }
}

/* ========================================
   STYLES CLUSTERS - MINIMAL
   ======================================== */

/* Curseur pointer sur clusters */
[title*="revendeurs"] {
    cursor: pointer !important;
}