/* Réinitialisation de base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f4f7f6;
    color: #333;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* En-tête */
.app-header {
    background-color: #2c3e50;
    color: white;
    padding: 1rem 1.5rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 10;
}

.app-header h1 {
    font-size: 1.4rem;
    margin-bottom: 0.2rem;
}

.app-header p {
    font-size: 0.85rem;
    color: #bdc3c7;
}

/* Conteneur principal */
.app-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* Barre latérale (Filtres et Liste) */
.sidebar {
    width: 400px;
    background-color: white;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 5px rgba(0,0,0,0.05);
    z-index: 5;
}

/* Section Filtres */
.filters {
    padding: 1.2rem;
    background-color: #ecf0f1;
    border-bottom: 1px solid #ddd;
    position: relative; 
    z-index: 10;
}

.filters h2 {
    font-size: 1.1rem;
    margin-bottom: 0.8rem;
    color: #2c3e50;
}

.input-group {
    margin-bottom: 0.8rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Style de la case à cocher (Favoris) */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 15px;
    margin-bottom: 5px;
    background-color: #fff;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #dcdde1;
}

.checkbox-group label {
    margin-bottom: 0;
    cursor: pointer;
    color: #2980b9;
}

.checkbox-group input {
    width: auto;
    transform: scale(1.3);
    cursor: pointer;
}

.input-group input[type="text"], 
.input-group select {
    width: 100%;
    padding: 0.7rem 0.6rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px; 
    background-color: #fff;
}

.input-group input[type="text"]:focus, 
.input-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* Autocomplétion */
.autocomplete-container {
    position: relative;
}

.suggestions-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: white;
    border: 1px solid #3498db;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    list-style: none;
}

.suggestions-list.active {
    display: block;
}

.suggestions-list li {
    padding: 0.8rem;
    cursor: pointer;
    font-size: 16px;
    border-bottom: 1px solid #f1f1f1;
}

.suggestions-list li:hover {
    background-color: #3498db;
    color: white;
}

/* Section Résultats */
.results-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.2rem;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.results-container h2 {
    font-size: 1.1rem;
    margin-bottom: 0.8rem;
    color: #2c3e50;
}

.results-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
    scroll-behavior: smooth;
}

/* Cartes de Gîtes */
.gite-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.gite-card:hover, .gite-card:active {
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    border-color: #3498db;
}

.gite-card.highlight {
    border-color: #e74c3c;
    box-shadow: 0 0 12px rgba(231, 76, 60, 0.4);
    background-color: #fffaf9;
}

.gite-card h3 {
    font-size: 1.1rem;
    color: #2980b9;
    margin-bottom: 0.4rem;
}

.gite-card p {
    font-size: 0.9rem;
    line-height: 1.4;
    color: #555;
    margin-bottom: 0.3rem;
}

.gite-card .gite-region {
    display: inline-block;
    background-color: #e8f4f8;
    color: #2980b9;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-top: 0.5rem;
}

.gite-card .gite-contact {
    margin-top: 0.8rem;
    padding-top: 0.8rem;
    border-top: 1px dashed #eee;
}

/* Liens du téléphone */
.phone-link {
    color: #2c3e50;
    text-decoration: none;
    font-weight: bold;
}

.phone-link:hover {
    color: #3498db;
    text-decoration: underline;
}

/* Boutons d'actions */
.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 0.8rem;
}

.btn-direction, .btn-info, .btn-fav {
    display: inline-block;
    padding: 0.6rem 0.8rem;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: bold;
    text-align: center;
    border: none;
    cursor: pointer;
    flex: 1; /* Boutons de même largeur */
}

.btn-direction { background-color: #27ae60; }
.btn-direction:hover { background-color: #2ecc71; }

.btn-info { background-color: #34495e; }
.btn-info:hover { background-color: #2c3e50; }

/* Bouton Favoris */
.btn-fav {
    background-color: #ecf0f1;
    color: #333;
    flex: 100%; /* Prend toute la largeur au-dessus des autres pour se démarquer */
    margin-bottom: 5px;
}
.btn-fav:hover { background-color: #bdc3c7; }
.btn-fav.active {
    background-color: #f1c40f;
    color: #fff;
    box-shadow: inset 0 -2px 0 rgba(0,0,0,0.1);
}
.btn-fav.active:hover { background-color: #f39c12; }


/* Zone de la carte */
.map-container {
    flex: 1;
    position: relative;
}

#map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.custom-popup .leaflet-popup-content { min-width: 220px; }
.custom-popup .leaflet-popup-content h3 { font-size: 1.1rem; margin-bottom: 5px; color: #2c3e50;}
.custom-popup .leaflet-popup-content .action-buttons { margin-top: 15px; }

/* Menu de navigation mobile (Caché sur Desktop) */
.mobile-nav {
    display: none;
}

/* Fenêtre Modale */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    width: 95%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 5px 20px rgba(0,0,0,0.4);
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 2rem;
    font-weight: bold;
    color: #7f8c8d;
    cursor: pointer;
}

#modalBody h2 { color: #2980b9; margin-bottom: 0.5rem; padding-right: 35px; }
#modalBody h4 { margin-top: 1.2rem; margin-bottom: 0.5rem; color: #2c3e50; border-bottom: 1px solid #eee; padding-bottom: 0.3rem;}
#modalBody ul { list-style-type: none; padding-left: 0; }
#modalBody li { margin-bottom: 0.5rem; font-size: 0.95rem; line-height: 1.4; }

/* === ADAPTATION MOBILE === */
@media (max-width: 768px) {
    .app-container {
        padding-bottom: 60px; /* Espace pour la barre de navigation */
    }

    .sidebar {
        width: 100%;
        display: none; /* Géré par JS */
    }
    
    .map-container {
        width: 100%;
        display: none; /* Géré par JS */
    }

    /* Classes d'activation pour basculer les vues */
    .sidebar.active { display: flex; }
    .map-container.active { display: block; }

    /* Barre de navigation inférieure */
    .mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 60px;
        background-color: #fff;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        z-index: 1500;
    }

    .mobile-nav button {
        flex: 1;
        background: none;
        border: none;
        font-size: 1rem;
        font-weight: bold;
        color: #95a5a6;
        border-top: 3px solid transparent;
        transition: all 0.2s;
        cursor: pointer;
    }

    .mobile-nav button.active {
        color: #2980b9;
        border-top-color: #2980b9;
        background-color: #f0f8ff;
    }
}