/* ==========================================================================
   TIMELINE V40.6 - STABLE 8 COLS (Fixed Layout + Idle State)
   ========================================================================== */

/* --- CONTENEUR GLOBAL --- */
.adx-timeline-section { 
    margin-bottom: 40px; 
    background: #fff; 
    box-sizing: border-box; 
    overflow: visible; 
}

.timeline-master-container { 
    margin-bottom: 40px; 
    width: 100%; 
    margin-right: 0; 
    margin-left: 0;
    position: relative; 
}
.timeline-master-container:last-child { margin-bottom: 0; }

.timeline-structure-wrapper {
    width: 100%;
    box-sizing: border-box;
}

/* --- TITRES --- */
.timeline-title {
    display: flex; justify-content: space-between; align-items: center;
    font-weight: 800; text-transform: uppercase; color: #2e1f45;
    margin-bottom: 20px; padding-bottom: 10px; border-bottom: 2px solid #eee;
}
.timeline-title.border-yellow { border-bottom-color: #f1c40f; }
.timeline-title.border-blue { border-bottom-color: #3498db; }
.legend-years { font-size: 12px; color: #7f8c8d; font-weight: 600; }

/* ==========================================================================
   GRILLE (8 COLONNES)
   ========================================================================== */
.sidebar-layout { 
    display: grid; 
    grid-template-columns: 170px 1fr; /* Colonne Titre + Colonne Frise */
    gap: 0; 
    width: 100%; 
    align-items: stretch; 
}

/* Définition principale de la grille */
.grid-8-cols { 
    display: grid; 
    grid-template-columns: repeat(8, 1fr); 
    width: 100%; 
    height: 100%; 
    gap: 0; 
}

/* Style des cellules de la grille */
.col-interval { 
    position: relative; 
    display: flex; 
    flex-direction: column; 
    justify-content: flex-start; 
    text-align: center;
     /*border-right: 1px solid #eee; Séparateur vertical */
    min-height: 36px;
}

/* Pas de bordure à la fin de la frise */
.sidebar-layout .main-col.grid-8-cols .col-interval:last-child { 
    border-right: none; 
}

/* MASQUAGE ÉLÉMENTS 8ÈME COLONNE */
/* On garde l'espace de la colonne (pour le label) mais on cache les marqueurs */
.col-interval:nth-child(8) .step-marker, 
.col-interval:nth-child(8) .marker-date-certif,
.col-interval:nth-child(8) .h-year-num { 
    display: none !important; 
}

/* ==========================================================================
   HEADER (ANNÉES)
   ========================================================================== */
.header-row { margin-bottom: 0; position: relative; z-index: 6; }

.h-year-num, .h-certif-label {
    font-weight: 800; font-size: 16px; color: #7f8c8d; line-height: 1; 
    position: absolute; top: 0; width: 100%; text-align: center; z-index: 10;
}
/* Alignement spécifique : Certif à gauche, Années à droite */
.marker-certif { left: 0; transform: translateX(-50%); text-align: left; width: auto; }
.marker-year { right: 0; transform: translateX(50%); text-align: right; width: auto; }


/* ==========================================================================
   FOND ET LIGNES
   ========================================================================== */
.bg-layer { position: absolute; top: 30px; bottom: 0; left: 0; right: 0; z-index: 1; pointer-events: none; }

.grid-line {
    position: absolute; top: 0; bottom: 0; width: 1px;
    background: repeating-linear-gradient(to bottom, #bdc3c7, #bdc3c7 4px, transparent 4px, transparent 8px);
    right: 0; transform: translateX(50%);
}
.grid-line.line-start { left: 0; right: auto; transform: translateX(-50%); }

/* Masquer la ligne pointillée de la 8ème colonne */
.col-interval:nth-child(8) .grid-line:not(.line-start) { display: none; }


/* ==========================================================================
   INFOS GLOBALES (TEXTES)
   ========================================================================== */
.global-info-row { margin-bottom: 15px; position: relative; z-index: 6; }

.info-cell {
    padding: 0 2px; height: 100%;
    display: flex; flex-direction: column; justify-content: flex-start; align-items: center;
    gap: 3px; margin-top: 25px; 
    text-align: center;
}

.info-act { font-size: 10px; font-weight: 800; color: #2e1f45; text-transform: uppercase; line-height: 1.1; }
.info-surv, .info-ctrl { font-size: 9px; color: #7f8c8d; font-style: italic; line-height: 1.1; }

/* Correction pour la dernière cellule d'info */
.global-info-row .col-interval:last-child .info-cell {
    position: relative; left: auto; width: 100%; transform: none; margin: 25px 0 0 0;
}


/* ==========================================================================
   BARRES DE PROGRESSION (DÉGRADÉS)
   ========================================================================== */
.body-bars-container { display: flex; flex-direction: column; gap: 20px; position: relative; z-index: 2; }

.prog-row { 
    height: 36px; 
    border-radius: 18px; 
    background: #f4f6f7; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); 
    position: relative; 
    z-index: auto; 
}

/* Labels à gauche (DPE, Amiante...) */
.label-box { 
    display: flex; align-items: center; padding-left: 10px; padding-right: 5px; 
    color: #fff; white-space: nowrap; z-index: 6; 
    border-top-left-radius: 18px; border-bottom-left-radius: 18px; 
}
.label-content { display: flex; align-items: center; gap: 5px; width: 100%; }
.lbl-icon { font-size: 13px; }
.lbl-text { font-weight: 700; font-size: 11px; }

/* Couleurs */
.label-box.c-dpe, .label-box.c-dpe-mention { background: #27ae60; }
.label-box.c-audit { background: #16a085; }
.label-box.c-amiante, .label-box.c-amiante-mention { background: #c0392b; }
.label-box.c-gaz { background: #d35400; }
.label-box.c-elec { background: #f39c12; }
.label-box.c-plomb { background: #8e44ad; }
.label-box.c-termites { background: #8d6e63; }

/* --- SEGMENTS & DÉGRADÉS --- */
.timeline-track-area { position: relative; height: 100%; }

.prog-segment {
    position: absolute; top: 0; bottom: 0; left: 0; z-index: 2;
    transition: width 0.5s ease-out;
    background-attachment: scroll;
    height: 100%;
    /* 800% car 8 colonnes */
    background-size: 800% 100% !important; 
}

/* Positions précises pour la continuité du dégradé */
.grid-8-cols > .col-interval:nth-child(1) .prog-segment { background-position: 0% 0% !important; }
.grid-8-cols > .col-interval:nth-child(2) .prog-segment { background-position: 14.285% 0% !important; }
.grid-8-cols > .col-interval:nth-child(3) .prog-segment { background-position: 28.571% 0% !important; }
.grid-8-cols > .col-interval:nth-child(4) .prog-segment { background-position: 42.857% 0% !important; }
.grid-8-cols > .col-interval:nth-child(5) .prog-segment { background-position: 57.142% 0% !important; }
.grid-8-cols > .col-interval:nth-child(6) .prog-segment { background-position: 71.428% 0% !important; }
.grid-8-cols > .col-interval:nth-child(7) .prog-segment { background-position: 85.714% 0% !important; }
.grid-8-cols > .col-interval:nth-child(8) .prog-segment { background-position: 100% 0% !important; }

/* Couleurs des dégradés */
.prog-segment.c-dpe, .prog-segment.c-dpe-mention { background: linear-gradient(90deg, #27ae60, #145a32); }
.prog-segment.c-audit { background: linear-gradient(90deg, #16a085, #0e6655); }
.prog-segment.c-amiante, .prog-segment.c-amiante-mention { background: linear-gradient(90deg, #c0392b, #641e16); }
.prog-segment.c-gaz { background: linear-gradient(90deg, #d35400, #a04000); }
.prog-segment.c-elec { background: linear-gradient(90deg, #f39c12, #9a630b); }
.prog-segment.c-plomb { background: linear-gradient(90deg, #8e44ad, #5b2c6f); }
.prog-segment.c-termites { background: linear-gradient(90deg, #8d6e63, #4e342e); }

.prog-segment.first-segment { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.prog-segment.last-segment { border-top-right-radius: 18px; border-bottom-right-radius: 18px; }

.prog-segment.is-excluded {
    background: repeating-linear-gradient(45deg, #e0e0e0, #e0e0e0 10px, #f4f6f7 10px, #f4f6f7 20px) !important;
    background-size: auto !important; 
    opacity: 0.6;
    border-top: 1px dashed #bdc3c7;
    border-bottom: 1px dashed #bdc3c7;
}


/* ==========================================================================
   MARQUEURS & BULLES
   ========================================================================== */
.markers-grid { position: absolute; top: 0; bottom: 0; left: 0; right: 0; z-index: 10; pointer-events: none; }

/* Point blanc - Centrage Vertical Absolu */
.step-marker { 
    width: 14px; height: 14px; background: #fff; border: 3px solid #bdc3c7; border-radius: 50%; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); 
    position: absolute; 
    right: 0; 
    top: 50%; 
    transform: translate(50%, -50%); 
    margin-top: 0;
    z-index: 15; 
}
.step-marker.step-done { border-color: #fff; background: #2e1f45; }

/* Date Certif - Centrage Vertical Absolu & Gauche */
.marker-date-certif {
    font-size: 10px; font-weight: 700; color: #555 !important; 
    background: #fff; padding: 2px 5px; border-radius: 4px; border: 1px solid #eee;
    position: absolute; 
    left: 0; 
    top: 50%; 
    transform: translate(-50%, -50%); 
    z-index: 20; white-space: nowrap; box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Bulle Flottante (Action) */
.floating-action-label {
    position: absolute; top: 50%; transform: translateY(-50%); margin-left: 15px;
    background: #ffffff; color: #333333; border: 1px solid #ccd0d4; 
    font-size: 11px; font-weight: 700; 
    padding: 6px 10px; border-radius: 6px; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08); 
    white-space: nowrap; z-index: 30; display: flex; align-items: center;
}
.floating-action-label .hand-icon { font-size: 14px; margin-right: 6px; }

.floating-action-label::before { 
    content: ''; position: absolute; left: -6px; top: 50%; transform: translateY(-50%);
    border-top: 6px solid transparent; border-bottom: 6px solid transparent; border-right: 6px solid #ccd0d4; 
}

.floating-action-label.flipped { transform: translate(-100%, -50%); margin-left: -15px; }
.floating-action-label.flipped::before { content: none; }
.floating-action-label.flipped::after {
    content: ''; position: absolute; right: -6px; top: 50%; transform: translateY(-50%);
    border-top: 6px solid transparent; border-bottom: 6px solid transparent; border-left: 6px solid #ccd0d4; 
}

/* Animations */
.prog-row { transition: all 0.3s ease; border: 1px solid transparent; }
.prog-row:hover { transform: translateY(-2px); background: #fff; box-shadow: 0 5px 15px rgba(0,0,0,0.1); z-index: 40; border-color: #eee; }
.step-marker { transition: all 0.2s ease-out; }
.prog-row:hover .step-marker { transform: translate(50%, -50%) scale(1.3); border-color: #2e1f45; }

/* ==========================================================================
   ETAT "PAS D'ACTION" (IDLE STATE)
   ========================================================================== */
.floating-action-label.is-idle-state {
    background: #fdfdfd !important;      /* Fond quasi blanc */
    border: 1px solid #dcdcdc !important; /* Bordure grise discrète */
    color: #7f8c8d !important;            /* Texte gris rassurant */
    box-shadow: 0 2px 5px rgba(0,0,0,0.05) !important; /* Ombre légère */
    z-index: 29; /* Juste en dessous du hover */
}

/* La petite flèche du label doit aussi changer de couleur */
.floating-action-label.is-idle-state::before { 
    border-right-color: #dcdcdc !important; 
}
.floating-action-label.is-idle-state.flipped::after {
    border-left-color: #dcdcdc !important; 
}