/* 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 */
#top-bar {
    background: #ffffff;
    padding: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
}

#toggle-view-btn {
    padding: 8px 15px;
    border: none;
    background: #007BFF;
    color: #fff;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    transition: background 0.3s;
}

#toggle-view-btn:hover {
    background: #0056b3;
}

/* 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);
}

/* 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" - ULTRA VISIBLE */
#near-me-btn,
.btn-near-me {
    margin-left: 15px !important;
    padding: 10px 20px !important;
    border: 2px solid #4CAF50 !important;
    background: #4CAF50 !important;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%) !important;
    color: white !important;
    cursor: pointer !important;
    border-radius: 8px !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 3px 10px rgba(76, 175, 80, 0.4) !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2) !important;
}

#near-me-btn:hover,
.btn-near-me:hover {
    background: #45a049 !important;
    transform: translateY(-3px) !important;
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.6) !important;
}

#near-me-btn:active,
.btn-near-me:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 5px rgba(76, 175, 80, 0.4) !important;
}

#near-me-btn:disabled,
.btn-near-me:disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
    transform: none !important;
}

/* 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 */
#stats-container {
    margin-left: 20px;
    position: relative;
}

#stats-summary {
    font-weight: bold;
    display: flex;
    align-items: center;
}

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

#stats-details {
    display: none;
    position: absolute;
    top: 40px;
    left: 0;
    background: #fff;
    padding: 10px;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    max-height: 200px;
    overflow-y: auto;
    width: 200px;
    z-index: 1000;
}

#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 */
#search-bar {
    margin-left: auto;
    width: 250px;
    padding: 8px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

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

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

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

.zoom-controls button {
    width: 40px;
    height: 40px;
    font-size: 20px;
    border: none;
    background: #007BFF;
    color: white;
    cursor: pointer;
    border-radius: 5px;
    transition: background 0.3s;
}

.zoom-controls button:hover {
    background: #0056b3;
}

/* LISTE */
#list-container {
    flex: 1;
    display: none;
    background: #f0f2f5;
    overflow-y: auto;
    padding: 10px 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 */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

#loading-spinner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #007BFF;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s 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;
    }
}