/* css/carte.css */

/* Variables et styles généraux */
:root {
    --climbout-green: #1D3B2C;
    --climbout-beige: #E6DCCB;
    --climbout-orange: #FF8A00;
    --text-dark: #333;
    --text-light: #f4f4f4;
    --light-grey: #f0f0f0;
    --modern-background: #F5F5F5;
    --skeleton-bg: #e0e0e0;
}
body {
    font-family: 'Open Sans', sans-serif;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    background-color: var(--modern-background);
    color: var(--text-dark);
    line-height: 1.6;
}
h1, h2, h3, h4, h5, h6 {
    font-family: 'Montserrat', sans-serif;
    color: var(--climbout-green);
    margin-top: 0;
}
a {
    text-decoration: none;
    color: var(--climbout-green);
}
a:hover {
    color: var(--climbout-orange);
}
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: 600;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* 1. Conteneur principal de la carte et de la recherche */
#map-container-wrapper {
    position: relative;
    width: 100%;
    height: calc(100vh - 67px); 
}

/* 2. La carte */
#map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* 3. Barre de recherche et résultats */
.search-on-map-container {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    width: 90%;
    max-width: 500px;
}
.search-widget-container {
    position: relative;
}
.search-bar {
    display: flex;
    align-items: center;
    background-color: #fff;
    border-radius: 25px; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 0;
}
#mapSearchInput {
    border: none;
    outline: none;
    width: 100%;
    padding: 15px 20px;
    font-size: 16px;
    border-radius: 25px;
    background-color: transparent;
}
#clearMapSearch {
    cursor: pointer;
    padding: 0 15px 0 5px; 
    font-size: 20px;
    color: #888;
    display: none;
}
#mapSearchResults {
    background-color: #fff;
    border-radius: 25px; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-top: 8px;
    max-height: 400px;
    overflow-y: auto;
    display: none;
}
.result-item {
    display: flex;
    align-items: center;
    padding: 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}
.result-item:last-child {
    border-bottom: none;
}
.result-item:hover {
    background-color: #f5f5f5;
}
.result-item-icon {
    font-size: 18px;
    color: #888; /* MODIFICATION: Couleur changée de orange à gris */
    margin-right: 15px;
    width: 20px;
    text-align: center;
}
.result-item-text {
    display: flex;
    flex-direction: column;
}
.result-item-name {
    font-weight: 600;
}
.result-item-type {
    font-size: 0.85em;
    color: #777;
}
.no-results-message {
    padding: 15px;
    text-align: center;
    color: #888;
}

/* 4. Loader pour la carte */
#map-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}
.loader-spinner {
    border: 5px solid var(--light-grey);
    border-top: 5px solid var(--climbout-orange);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 5. Styles pour la modale et la sidebar */

/* --- Conteneur général de la modale (mobile) --- */
#pisteModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background-color: #fff;
    padding: 0;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    height: 90vh;
    max-height: 700px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
}

/* --- Conteneur général de la sidebar (desktop) --- */
#sidebar-panel {
    position: fixed;
    top: 80px; 
    bottom: 20px;
    left: -440px;
    width: 100%;
    max-width: 400px; 
    background-color: #fff;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15); 
    border-radius: 12px;
    z-index: 1500;
    transition: left 0.3s ease-in-out;
    display: flex;
}
#sidebar-panel.open {
    left: 20px;
}

/* Conteneur interne pour le contenu avec padding */
.modal-content-inner {
    width: 100%;
    padding: 20px; 
    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

/* --- Vues internes (Détail et Liste) --- */
#sidebarDetailsView, #modalDetailsView {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

#modalPistesList, #sidebarPistesList {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}


/* --- Header commun (Retour, Titre, Fermer) --- */
.sidebar-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.modal-global-title {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0; 
    flex-grow: 1; 
    text-align: center; 
}

#sidebarBackToList, #modalBackToList {
    font-size: 1em;
    font-weight: 600;
    color: var(--text-dark);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    width: 60px;
    justify-content: flex-start;
}
#sidebarBackToList:hover, #modalBackToList:hover {
    color: var(--climbout-orange);
}
#sidebarBackToList::before, #modalBackToList::before {
    font-family: 'Font Awesome 6 Free'; 
    content: "\f060"; 
    font-weight: 900;
}

.modal-close-btn { 
    font-size: 1.8em;
    font-weight: 400;
    color: var(--text-dark);
    cursor: pointer;
    line-height: 1;
    width: 60px;
    text-align: right;
}

/* --- Conteneur du Nom du bloc et Difficulté --- */
.title-difficulty-container {
    display: flex;
    justify-content: space-between; 
    align-items: center;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.modal-title {
    font-size: 1.7em;
    color: var(--text-dark);
    font-weight: 700;
    margin: 0; 
}

.modal-difficulty {
    display: flex; 
    align-items: center;
    font-weight: 700; 
    font-size: 1.2em;
    gap: 8px;
    background-color: transparent !important; 
    color: var(--text-dark) !important;
    padding: 0;
    border-radius: 0;
}

.difficulty-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: none;
}

/* --- Image et Source --- */
.modal-image-container {
    flex: 1;
    min-height: 0;
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    border-radius: 8px;
    overflow: hidden;
}

.modal-image-container img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    margin: 0 auto;
}

.modal-image-container canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.modal-source {
    font-size: 0.8em;
    color: #888;
    text-align: center;
    margin-top: 8px;
    margin-bottom: 15px;
    flex-shrink: 0;
}

.modal-start-type {
    display: none !important;
}

/* --- Zone Basse (CTA) --- */
.modal-cta-bottom {
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
    text-align: center;
    flex-shrink: 0;
}

.modal-message {
    font-size: 0.9em;
    color: #555;
    margin-bottom: 10px;
}

.store-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 5px;
}
.store-buttons a {
    flex-shrink: 1;
}
.store-buttons img {
    height: 40px;
    width: auto;
    transition: transform 0.2s ease;
}
.store-buttons img:hover {
    transform: scale(1.05);
}

/* --- Styles pour la liste des pistes --- */
.pistes-list-modal {
    list-style: none;
    padding: 0;
    margin: 0;
}
.pistes-list-modal li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 5px;
    border-bottom: 1px solid var(--light-grey);
    cursor: pointer;
    transition: background-color 0.2s;
}
.pistes-list-modal li:hover {
    background-color: #f9f9f9;
}
.piste-name {
    font-weight: 600;
}
.piste-difficulty {
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.9em;
    color: white;
}