/* =======================================
   DISPOSITION GÉNÉRALE (3 Colonnes - Desktop)
   ======================================= */
body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f0f0f0;
    display: flex;
    justify-content: center;
    padding: 20px 0; /* Ajusté pour permettre au wrapper de prendre la hauteur */
    min-height: 100vh;
    box-sizing: border-box;
}

/* Conteneur principal pour les 3 colonnes (Filtres | Image | Drive) */
.main-content-wrapper {
    display: flex;
    gap: 20px;
    flex-wrap: nowrap; /* Empêche le wrapping sur les grands écrans pour garder les colonnes */
    justify-content: center; /* Centre les 3 colonnes */
    align-items: flex-start; /* Aligne les colonnes en haut */
    width: 100%;
    max-width: 1600px;
}

/* Conteneurs pour les barres latérales (Filtres et Documentation) */
.button-column-wrapper {
    display: flex;
    flex-direction: column; /* Les titres et les boutons s'empilent */
    align-items: center; /* Centre le titre et les boutons */
    min-width: 160px; /* Assure que les boutons ne sont pas trop serrés */
    max-width: 200px; /* Limite la largeur des colonnes latérales */
    padding: 15px 10px;
    background-color: #e6e6e6; /* Fond pour mieux visualiser les colonnes */
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    flex-shrink: 0;
    height: fit-content; /* S'adapte au contenu */
}
.button-column-wrapper h2 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.1em;
    color: #333;
    text-align: center;
}

/* Conteneur pour les listes de boutons (Filtres et Drive) */
.button-list {
    display: flex;
    flex-direction: column; /* Les boutons sont empilés verticalement */
    gap: 10px;
    width: 100%; /* Les boutons prennent toute la largeur du wrapper */
}

.image-container {
    position: relative; /* CLÉ pour le positionnement de la bannière */
    background-repeat: no-repeat;
    background-position: top left;
    background-size: cover;
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
    /* Dimensions par défaut pour les grands écrans */
    width: 1200px;
    height: 800px;
    flex-shrink: 0; 
    margin: 0; /* Le wrapper centre l'ensemble */
}

/* =======================================
   BANNIÈRE DE NOTIFICATION DÉFILANTE (SUR L'IMAGE)
   ======================================= */
#latestUpdateBanner {
    position: absolute; /* Positionne l'élément par rapport au .image-container */
    top: 0;             /* Fixe en haut du conteneur parent */
    left: 0;
    width: 100%;        /* S'étend sur toute la largeur de l'image */
    
    background-color: rgba(45, 87, 44, 0.85); /* Fond semi-transparent */
    color: white;
    padding: 8px 0; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    text-align: center;
    overflow: hidden; 
    z-index: 10; /* Au-dessus de l'image et en dessous du panneau-travaux */
}

/* Style de la balise <marquee> ou du conteneur de texte */
#latestUpdateBanner marquee, 
#latestUpdateBanner .marquee-content {
    font-size: 1.1em;
    font-weight: bold;
    white-space: nowrap;
}


/* =======================================
   POINTS ET OUTILS (Styles de base conservés)
   ======================================= */

.clickable {
    position: absolute;
    width: 10px;
    height: 10px;
    background: rgb(65, 172, 235);
    border-radius: 50%;
    border: 2px solid white;
    cursor: pointer;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
    transform: translate(-50%, -50%);
}

/* Panneau de Travaux / Fiche de Vie (Ajusté pour la bannière) */
.panneau-travaux {
    position: absolute; 
    
    /* DÉCALAGE VERS LE BAS pour ne pas être sous la bannière */
    margin-top: 35px; 
    z-index: 11; /* Au-dessus de la bannière (z-index: 10) */
    
    transform: translate(-50%, -50%);
    padding: 8px 10px;
    background: #ffc107;
    color: #333;
    border: 2px solid #b38700;
    border-radius: 6px;
    font-weight: bold;
    font-size: 14px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    cursor: pointer;
    text-align: center;
    width: 110px;
}

/* Tooltip */
#hoverTooltip {
    position: absolute;
    background: rgba(255,255,255,0.95);
    border: 1px solid #ccc;
    padding: 6px 8px;
    border-radius: 6px;
    box-shadow: 0 0 6px rgba(0,0,0,0.15);
    pointer-events: none;
    z-index: 1001;
    display: none;
    font-size: 12px;
    color: #333;
    text-align: center;
    width: 130px;
    max-width: 140px;
    line-height: 1.3;
    
}
#hoverTooltip img {
    margin-top: 5px;
    width: 90px;
    max-height: 80px;
    border-radius: 5px;
    object-fit: contain;
}

/* =======================================
   MODALE (Styles de base conservés)
   ======================================= */
#modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    overflow-y: auto;
}
#modal .content {
    background: #d0f792;
    padding: 25px 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    position: relative;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    font-family: 'Segoe UI', sans-serif;
    color: #333;
    animation: fadeIn 0.3s ease;
    overflow-y: auto;
}
#modal .close-button { /* Mise à jour de .close à .close-button pour le HTML */
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ff4d4d;
    border: none;
    font-size: 20px;
    font-weight: bold;
    color: white;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    line-height: 28px;
    text-align: center;
    padding: 0;
}
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Tableaux à l'intérieur de la modale */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-size: 14px;
}
th, td {
    border: 1px solid #999;
    padding: 6px 10px;
    text-align: left;
}
th {
    background-color: #b3d27d;
    position: sticky;
    top: 0;
    z-index: 10;
}
.scrollable-table {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid #999;
    border-radius: 6px;
    margin-top: 10px;
}

/* =======================================
   INFOS DE STATUT FIXES
   ======================================= */
#lastUpdated {
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255,255,255,0.9);
    padding: 5px 15px;
    border-radius: 12px;
    font-size: 14px;
    color: #666;
    box-shadow: 0 0 8px rgba(0,0,0,0.15);
    z-index: 2000;
    user-select: none;
    pointer-events: none;
}
#signature {
    position: fixed;
    bottom: 10px;
    right: 10px;
    font-size: 14px;
    color: #666;
    font-weight: bold;
    font-family: Arial, sans-serif;
    user-select: none;
    pointer-events: none;
    opacity: 0.7;
}

/* Point générique (si utilisé) */
.point {
    width: 15px;
    height: 15px;
    background: red;
    border-radius: 50%;
    position: absolute;
    cursor: pointer;
}

/* Popup de contenu */
.popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px;
    border: 2px solid black;
    z-index: 100;
    display: none;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
}
.close-btn {
    background: #f00;
    color: #fff;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
    margin-top: 10px;
}

/* =======================================
   STYLES DES BOUTONS (Filtres & Drive)
   ======================================= */
.drive-button, #filterButtons button {
    background-color: #4285F4;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    text-align: center;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: background-color 0.2s ease, opacity 0.3s ease;
    min-width: 120px;
    width: 100%; /* Important pour le mode colonne */
}
.drive-button:hover {
    background-color: #357ae8;
}
#filterButtons button {
    color: black;
    /* Les couleurs de fond spécifiques sont définies en JS */
}

/* =======================================
   RESPONSIVITÉ (Mobile/Tablette)
   ======================================= */

/* Tablette (portrait et paysage) */
@media (max-width: 1250px) {
    .image-container {
        width: 768px;
        height: 512px;
    }
    .panneau-travaux {
        font-size: 12px;
        width: 90px;
    }
    #lastUpdated, #signature {
        font-size: 12px;
    }
}

/* Mobile (smartphones) */
@media (max-width: 767px) {
    body {
        padding: 10px;
        flex-direction: column;
        align-items: center;
    }
    .main-content-wrapper {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
    .button-column-wrapper { 
        width: 95%;
        max-width: 95%;
        padding: 10px;
        order: -1; /* Place les boutons au-dessus de l'image */
    }
    .button-list {
        flex-direction: row;
        flex-wrap: wrap; 
        justify-content: center;
        gap: 8px;
    }
    #filterButtons button, .drive-button {
        width: auto; 
        min-width: 100px;
        flex-grow: 1; 
        max-width: 150px; 
        padding: 8px 10px;
        font-size: 12px;
    }
    .image-container {
        width: 95vw;
        height: auto;
        max-width: 450px; 
        min-height: 240px; 
        order: 0;
    }
    .clickable {
        width: 12px;
        height: 12px;
    }
    
    /* Ajustement du panneau-travaux sur mobile */
    .panneau-travaux {
        position: fixed;
        top: 10px; /* Positionnement au bord */
        right: 10px;
        left: auto;
        transform: none;
        width: 80px;
        font-size: 10px;
        padding: 5px;
        border-width: 1px;
        white-space: nowrap;
        margin-top: 0; /* Annule le décalage du desktop */
    }

    /* Ajustement de la bannière sur mobile */
    #latestUpdateBanner {
        padding: 5px 0;
        background-color: #2d572c; /* Fond opaque sur mobile */
        z-index: 5; /* Peut être plus bas car le panneau-travaux est fixed */
    }
    #latestUpdateBanner marquee, 
    #latestUpdateBanner .marquee-content {
        font-size: 0.9em;
    }

    /* Divers */
    #modal .content {
        padding: 15px;
        max-height: 90vh;
    }
    #modal .close-button {
        width: 25px;
        height: 25px;
        font-size: 18px;
        line-height: 23px;
    }
    .popup {
        padding: 15px;
        width: 90%;
    }
    .point {
        width: 20px;
        height: 20px;
        font-size: 16px;
    }
    #lastUpdated, #signature {
        position: static;
        font-size: 10px;
        padding: 3px 8px;
        bottom: 5px;
    }
}