/* Override padding du conteneur parent pour maximiser l'espace (modèle base_adm) */
#data_main {
    padding: 0 !important;
}

.gantt-container {
    padding: 0px;
    background-color: transparent;
    /* Remplir tout le parent (data_main = height:100% overflow:auto) */
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.card-main {
    border: none;
    border-radius: 0px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    background: #ffffff;
}

.gantt-header-title {
    color: #2c3e50;
    font-weight: 700;
}

/* La carte Gantt SVG prend tout l'espace restant */
.gantt-svg-card {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-bottom: 0;
}

/* Fix défilement horizontal et vertical pour le container Gantt */
#gantt_svg_container {
    flex: 1;
    min-height: 100px;
    overflow-x: auto !important;
    overflow-y: auto !important;
    position: relative;
    width: 100%;
}

/* Scrollbar miroir en haut du diagramme Gantt */
#gantt_top_scrollbar {
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
    margin-bottom: 0;
}
#gantt_top_scrollbar > div {
    height: 1px;
}

#gantt_svg {
    min-width: 100%;
    overflow: visible;
}

/* Flèches de dépendance — les couleurs sont appliquées dynamiquement par JS */
#gantt_svg g.arrow path {
    stroke-width: 2px;
    opacity: 0.85;
    transition: stroke 0.2s ease, stroke-width 0.2s ease, opacity 0.2s ease;
}

#gantt_svg .gantt .bar-wrapper .bar {
    fill: #8a2be2 !important;
    cursor: pointer;
    transition: fill 0.15s;
}

#gantt_svg .gantt .bar-wrapper:hover .bar {
    fill: #b05cff !important;
}

#gantt_svg .gantt .bar-progress {
    fill: #0d6efd !important;
}

#gantt_svg .gantt .bar-label {
    fill: #212529 !important;
    font-weight: 600 !important;
}

/* Custom CSS pour le tableau des étapes */
.table-gantt th {
    background-color: #f1f3f5;
    color: #495057;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.action-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

#modalTacheGantt {
    z-index: 1060 !important;
}
.modal-backdrop {
    z-index: 1050 !important;
}

/* =========================================
   Section Split-Pane (Tableau et Gantt côte à côte)
   ========================================= */

.gantt-split-container {
    background-color: #f8f9fa;
}

.gantt-left-pane {
    box-shadow: 2px 0 5px rgba(0,0,0,0.05);
    z-index: 5;
}

.gantt-table-header,
.gantt-top-scrollbar-wrapper {
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    box-sizing: border-box !important;
}

/* Redimensionneur central */
.gantt-resizer {
    width: 6px;
    background-color: #e9ecef;
    cursor: col-resize;
    z-index: 10;
    transition: background-color 0.2s;
    border-left: 1px solid #dee2e6;
    border-right: 1px solid #dee2e6;
}

.gantt-resizer:hover, .gantt-resizer.is-resizing {
    background-color: #0d6efd;
}

/* Alignement parfait de l'en-tête (rouge) avec l'en-tête Frappe Gantt (bleu = 60px) */
table.table-gantt thead,
table.table-gantt thead tr {
    height: 84px !important;
    min-height: 84px !important;
    max-height: 84px !important;
}

table.table-gantt thead th {
    height: 84px !important;
    min-height: 84px !important;
    max-height: 84px !important;
    line-height: 84px !important;
    vertical-align: middle !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* Alignement parfait des lignes du tableau avec Frappe Gantt */
/* Frappe Gantt utilise (bar_height 24 + padding 22) = 45px par défaut */
table.table-gantt tbody tr {
    height: 45px !important;
    min-height: 45px !important;
    max-height: 45px !important;
}

table.table-gantt tbody td {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    height: 45px !important;
    min-height: 45px !important;
    max-height: 45px !important;
    line-height: 45px !important;
    vertical-align: middle !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-bottom: 1px solid #e9ecef;
}

/* Curseur et style selon le mode d'interaction (Navigation vs Édition) */
#gantt_svg.gantt-mode-pan .bar-wrapper {
    cursor: grab !important;
}
#gantt_svg.gantt-mode-pan .bar-wrapper .handle {
    display: none !important;
}
#gantt_svg.gantt-mode-edit .bar-wrapper {
    cursor: move !important;
}
