.timeline-right {
  /* S'assurer que le panneau droit occupe la hauteur disponible dans l'accordéon */
  height: 100%;
}

/* Spécifique au module Timeline: autoriser une zone bien plus haute lorsqu'il est expandé
   sans impacter les autres charts (classe ajoutée par le module) */
/* sélecteurs d'association, conservés si besoin d'overrides futurs */
.timeline-details-content.chart-details-content,
.chart-details-content.timeline-details-content { max-height: 0; }

.timeline-details-content.expanded {
  /* Espace généreux pour le SVG + la légende + le filtre de dates */
  max-height: 2000px !important;
}

.timeline-chart-container {
  /* Permettre au JS de fixer une hauteur précise sans conflit */
  display: block;
}
/* Timeline Chart Module - Extensions spécifiques seulement */
/* Réutilise les classes génériques : .chart-total-container, .chart-details-content, .probability-tooltip */

/* Améliorations des tooltips - réutilise .probability-tooltip */
.probability-tooltip .tooltip-separator {
    height: 1px;
    background: #e9ecef;
    margin: 8px 0;
}

.probability-tooltip .tooltip-section-title {
    font-weight: 600;
    color: #495057;
    margin: 8px 0 4px 0;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.probability-tooltip .risk-detail {
    padding-left: 12px;
    font-size: 11px;
}

.probability-tooltip .risk-detail .tooltip-label {
    font-size: 10px;
    opacity: 0.8;
}

.probability-tooltip .tooltip-value {
    font-variant-numeric: tabular-nums;
}

/* Styles spécifiques au timeline uniquement */
.timeline-chart-container {
    width: 100%;
    height: auto;
    min-height: 400px;
    position: relative;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.timeline-details {
    display: flex;
    flex-direction: row;
}

.timeline-sidepanel {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 0;
    overflow: hidden;
    max-height: 600px;
    display: flex;
    flex-direction: column;
    height: 550px;
}

.timeline-sidepanel-title {
    font-weight: 600;
    margin-bottom: 12px;
    color: #495057;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 8px;
    flex-shrink: 0;
}

.timeline-sidepanel-title i {
    color: #007bff;
    margin-right: 6px;
}

/* Conteneur scrollable pour les métriques */
.timeline-metrics-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    margin-bottom: 12px;
    padding-right: 4px;
}

.timeline-metrics-scroll::-webkit-scrollbar {
    width: 4px;
}

.timeline-metrics-scroll::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.timeline-metrics-scroll::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.timeline-metrics-scroll::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Catégories */
.timeline-category-title {
    font-weight: 600;
    font-size: 11px;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 12px 0 6px 0;
    padding: 4px 6px;
    background: linear-gradient(90deg, rgba(0, 123, 255, 0.1) 0%, transparent 100%);
    border-left: 3px solid #007bff;
    border-radius: 2px;
}

.timeline-category-title:first-child {
    margin-top: 0;
}

.timeline-category-title i {
    margin-right: 4px;
    font-size: 10px;
}

/* Items de métriques */
.timeline-metric-item {
    display: flex;
    align-items: flex-start;
    padding: 8px 6px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s ease;
    margin-bottom: 2px;
    border: 1px solid transparent;
}

.timeline-metric-item:hover {
    background-color: rgba(0, 123, 255, 0.08);
    border-color: rgba(0, 123, 255, 0.2);
    transform: translateX(2px);
}

.timeline-metric-item input[type="checkbox"] {
    margin-right: 8px;
    margin-top: 2px;
    cursor: pointer;
    flex-shrink: 0;
}

.timeline-color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
    margin-top: 3px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Texte des métriques */
.timeline-metric-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.timeline-metric-label {
    font-size: 12px;
    font-weight: 500;
    color: #212529;
    line-height: 1.2;
}

.timeline-metric-description {
    font-size: 10px;
    color: #6c757d;
    line-height: 1.3;
    font-style: italic;
}

/* Actions */
.timeline-sidepanel-actions {
    border-top: 1px solid #dee2e6;
    padding-top: 8px;
    margin-top: auto;
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.timeline-sidepanel .btn-ghost {
    background: none;
    border: 1px solid #6c757d;
    color: #6c757d;
    padding: 3px 6px;
    font-size: 10px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-transform: uppercase;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.timeline-sidepanel .btn-ghost:hover {
    background: #6c757d;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Styles D3.js pour le graphique SVG uniquement */
.timeline-chart-container svg {
    width: 100%;
    height: 100%;
}

.timeline-chart-container .timeline-line {
    fill: none;
    stroke-width: 2;
    transition: stroke-width 0.2s ease;
}

.timeline-chart-container .timeline-line:hover {
    stroke-width: 3;
}

.timeline-chart-container .timeline-points circle {
    stroke: #fff;
    stroke-width: 1;
    cursor: pointer;
    transition: r 0.2s ease, stroke-width 0.2s ease;
}

.timeline-chart-container .timeline-points circle:hover {
    r: 6;
    stroke-width: 2;
}

.timeline-chart-container .axis {
    font-family: inherit;
    font-size: 12px;
}

.timeline-chart-container .axis path,
.timeline-chart-container .axis line {
    fill: none;
    stroke: #666;
    shape-rendering: crispEdges;
}

.timeline-chart-container .axis text {
    fill: #333;
}

.timeline-legend {
    font-family: inherit;
}

.timeline-legend .legend-item {
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
}

/* Surbrillances synchronisées graphe/legende/liste */
.timeline-legend .legend-item.is-highlighted {
    background: rgba(102, 126, 234, 0.12);
    border-radius: 4px;
}

.timeline-metric-item.is-highlighted {
    background: rgba(102, 126, 234, 0.12);
    border-radius: 6px;
}

.timeline-metric-item.pulse {
    animation: pulse-highlight 1.2s ease-out 1;
}

@keyframes pulse-highlight {
    0% { box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.6); }
    100% { box-shadow: 0 0 0 16px rgba(102, 126, 234, 0); }
}

.timeline-legend .legend-title {
    font-size: 12px;
    font-weight: 600;
    color: #333;
}

.timeline-legend line {
    stroke-width: 2;
}

/* Atténuation/Highlight des séries non ciblées */
.timeline-chart-container svg .is-dimmed {
    opacity: 0.25 !important;
}

.timeline-chart-container svg .is-highlighted {
    opacity: 1 !important;
    filter: drop-shadow(0 0 2px rgba(0,0,0,0.25));
}

/* === OVERVIEW SPÉCIFIQUE TIMELINE === */
.timeline-overview-bar {
    background: #667eea; /* Couleur plate par défaut (remplacée dynamiquement) */
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    color: white;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 15px;
    min-height: 60px;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

/* Couleurs adaptatives selon la catégorie principale sélectionnée */
.timeline-overview-bar.category-alterations {
    background: #007bff;
    box-shadow: 0 3px 10px rgba(0, 123, 255, 0.3);
}

.timeline-overview-bar.category-aleas {
    background: #28a745;
    box-shadow: 0 3px 10px rgba(40, 167, 69, 0.3);
}

.timeline-overview-bar.category-couts-reels {
    background: #17a2b8;
    box-shadow: 0 3px 10px rgba(23, 162, 184, 0.3);
}

.timeline-overview-bar.category-couts-estimes {
    background: #6f42c1;
    box-shadow: 0 3px 10px rgba(111, 66, 193, 0.3);
}

.timeline-overview-bar.category-prix-reference {
    background: #fd7e14;
    box-shadow: 0 3px 10px rgba(253, 126, 20, 0.3);
}

.timeline-overview-bar.category-indicateurs {
    background: #20c997;
    box-shadow: 0 3px 10px rgba(32, 201, 151, 0.3);
}

.timeline-overview-bar.category-mixed {
    background: #6c757d;
    box-shadow: 0 3px 10px rgba(108, 117, 125, 0.3);
}

.timeline-overview-bar.metric-specific {
    /* La couleur sera appliquée dynamiquement via JavaScript */
    transition: all 0.3s ease;
}

.timeline-period-info {
    text-align: left;
    font-size: 13px;
}

.timeline-period-dates {
    font-weight: bold;
    font-size: 15px;
    margin-bottom: 2px;
}

.timeline-period-duration {
    opacity: 0.8;
    font-size: 11px;
}

.timeline-global-stats {
    text-align: center;
    font-size: 13px;
}

.timeline-stats-main {
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 2px;
}

.timeline-stats-detail {
    opacity: 0.8;
    font-size: 11px;
}

.timeline-trend-info {
    text-align: right;
    font-size: 13px;
}

.timeline-trend-icon {
    font-size: 18px;
    margin-bottom: 2px;
    display: block;
}

.timeline-trend-text {
    opacity: 0.8;
    font-size: 11px;
}

/* ===== FILTRE DE DATES ===== */
.timeline-date-filter {
    margin-top: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-right: 1px solid #dee2e6;
    border-radius: 4px;
}

.date-filter-title {
    font-weight: 600;
    margin-bottom: 12px;
    color: #495057;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between; /* titre à gauche, actions à droite */
    gap: 12px;
}

.date-filter-actions {
    display: inline-flex;
    gap: 5px;
    flex: 1;
    display: flex;
    justify-content: flex-end;
}

.date-filter-title i.fa-calendar-days {
    color: #007bff;
    margin-right: 6px;
}

.dates-container {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.date-filter-btn {
    background: none;
    border: 1px solid #6c757d;
    color: #6c757d;
    padding: 3px 6px;
    font-size: 10px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-transform: uppercase;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.date-filter-btn:hover {
    background: #6c757d;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.date-filter-btn.selected {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.date-filter-btn.selected:hover {
    background: #0056b3;
    border-color: #0056b3;
}

.select-all-btn {
    background: #28a745;
    color: white;
    border-color: #28a745;
}

.select-all-btn:hover {
    background: #1e7e34;
    border-color: #1e7e34;
}

.deselect-all-btn {
    background: var(--error-color);
    color: white;
    border-color: var(--error-color);
}

.deselect-all-btn:hover {
    background: #c82333;
    border-color: #c82333;
}

.date-filter-separator {
    width: 1px;
    height: 20px;
    background: #dee2e6;
    margin: 0 4px;
}

.date-btn {
    min-width: 70px;
    justify-content: center;
}

/* === États de chargement === */
.timeline-loading-placeholder {
    padding: 15px 0;
}

.loading-shimmer {
    height: 12px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    margin-bottom: 8px;
    border-radius: 4px;
}

.loading-shimmer:nth-child(1) { width: 80%; }
.loading-shimmer:nth-child(2) { width: 60%; }
.loading-shimmer:nth-child(3) { width: 90%; }

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.timeline-loading-chart {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 600px;
    text-align: center;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}

.timeline-error {
    color: var(--error-color);
    text-align: center;
    padding: 20px;
    font-style: italic;
}

.date-btn i {
    font-size: 9px;
}