/**
 * Gantt Elastic - Styles CSS
 * Design moderne et responsive pour le système Gantt
 * Version 2.0 - Structure parfaite
 */

/* ===== CONTAINER PRINCIPAL ===== */
.gantt-elastic-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #ffffff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-width: 81vw;
}

/* ===== HEADER ===== */
.gantt-elastic-header {
    background: #2D7979;
    /* background: linear-gradient(135deg, #E7B40E -20%, #2D7979 100%); */
    color: white;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.gantt-elastic-controls {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    justify-content: center;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.gantt-elastic-view-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.gantt-view-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.gantt-view-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.gantt-view-btn.active {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.gantt-elastic-navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.gantt-nav-btn {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.gantt-nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.gantt-elastic-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.gantt-action-btn {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.gantt-action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.gantt-elastic-period {
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    padding: 8px 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    margin-top: 8px;
}

/* ===== BODY PRINCIPAL ===== */
.gantt-elastic-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    height: 0; /* Force le flex à prendre l'espace restant */
    min-height: 0px;
}

/* ===== LISTE DES TÂCHES ===== */
.gantt-elastic-task-list {
    /* width: 300px; */
    border-right: 1px solid #e1e5e9;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
}

.gantt-task-list-header {
    background: #e9ecef;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    font-weight: 600;
    color: #495057;
    font-size: 14px;
    flex-shrink: 0;
    min-height: 50px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.gantt-task-list-column {
    padding: 12px 8px;
    border-right: 1px solid #dee2e6;
    text-align: left;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.gantt-task-list-column:last-child {
    border-right: none;
}

.gantt-task-list-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    margin-bottom: 8px;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* Internet Explorer 10+ */
}

.gantt-row {
    display: flex;
    border-bottom: 1px solid #e9ecef;
    background: white;
    transition: background-color 0.2s ease;
    min-height: 50px;
    animation: fadeIn 0.3s ease;
}

.gantt-row:hover {
    background: #f8f9fa;
}

.gantt-row.selected {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
}

.gantt-task-cell {
    padding: 12px 8px;
    border-right: 1px solid #e9ecef;
    font-size: 14px;
    color: #495057;
    flex-shrink: 0;
    overflow: hidden;
}

.gantt-task-cell:last-child {
    border-right: none;
}

/* ===== CHART PRINCIPAL ===== */
.gantt-elastic-chart {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* min-width: 0; */
}

.gantt-elastic-chart-header {
    background: #f8f9fa;
    border-bottom: 1px solid #e1e5e9;
    display: flex;
    min-height: 50px;
    overflow-x: auto;
    flex-shrink: 0;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* Internet Explorer 10+ */
}

.gantt-elastic-chart-header::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.gantt-chart-header-cell {
    min-width: 60px;
    padding: 12px 8px;
    border-right: 1px solid #e1e5e9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    color: #495057;
    flex-shrink: 0;
    position: relative;
    box-sizing: border-box;
}

/* Styles spécifiques pour la vue année */
.gantt-elastic-container[data-view-mode="year"] .gantt-chart-header-cell {
    padding: 8px 4px;
    font-size: 12px;
    font-weight: 600;
}

.gantt-elastic-container[data-view-mode="year"] .gantt-chart-header-date {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.gantt-chart-header-cell:last-child {
    border-right: none;
}

.gantt-chart-header-cell.today {
    background: #e3f2fd;
    color: #1976d2;
    font-weight: 600;
}

.gantt-chart-header-cell.weekend {
    background: #fff3e0;
    color: #f57c00;
}

.gantt-chart-header-date {
    text-align: center;
    white-space: nowrap;
}

.gantt-elastic-chart-content {
    flex: 1;
    overflow-x: auto;
    overflow-y: auto;
    position: relative;
    background: white;
    min-height: 0;
}

.gantt-elastic-chart-content > div {
    position: relative;
    width: 100%;
    height: 100%;
}

.gantt-elastic-chart-content::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.gantt-elastic-chart-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.gantt-elastic-chart-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.gantt-elastic-chart-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Masquer la scrollbar verticale */
.gantt-elastic-chart-content::-webkit-scrollbar:vertical {
    width: 0;
    background: transparent;
}

/* ===== GRILLE DE CELLULES ===== */
.gantt-grid-cell {
    border-right: 1px solid #e1e5e9;
    border-bottom: 1px solid #e1e5e9;
    background: #fafafa;
    position: absolute;
    min-height: 50px;
    box-sizing: border-box;
}

.gantt-grid-cell:last-child {
    border-right: none;
}

.gantt-task-list-content .gantt-row.zebra {
    background: #f7f7f7;         /* gris clair */
}

/* Zébrage chart (grille). 
   Optionnellement un ton très léger pour ne pas “casser” le weekend/today */
   .gantt-grid-cell.zebra {
    background: rgba(0,0,0,0.065);
}

.gantt-grid-cell.today {
    background: #e3f2fd;
}

.gantt-grid-cell.weekend {
    background: #fff3e0;
}

#gantt-chart-content .gantt-grid-cell.today   { background: #e3f2fd; }
#gantt-chart-content .gantt-grid-cell.weekend { background: #fff3e0; }

/* ===== BARRES DE TÂCHES ===== */
.gantt-task-bar {
    position: absolute;
    height: 30px;
    top: 10px;
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
    display: flex;
    align-items: center;
    padding: 0 8px;
    color: white;
    font-size: 12px;
    font-weight: 500;
    /* min-width: 20px; */
}

/* ===== GROUPES DE TÂCHES ===== */
.gantt-row-group {
    background: #f0f8ff;
    border-left: 3px solid #888282;
    font-weight: 600;
}

.gantt-task-cell-group {
    background: #e3f2fd;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    color: #717274;
}

.gantt-task-bar-group {
    height: 35px;
    border: 2px solid #717274;
    font-weight: 600;
    font-size: 13px;
    border-radius: 15px 15px 0 0;
}

/* ===== BOUTONS TOGGLE DES GROUPES ===== */
.group-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 3px;
    transition: all 0.2s ease;
    color: #666;
}

.group-toggle-btn:hover {
    background-color: #f0f0f0;
    color: #333;
}

.group-toggle-btn i {
    font-size: 12px;
    transition: transform 0.2s ease;
}

.group-toggle-btn.collapsed i {
    transform: rotate(-90deg);
}

.group-label {
    font-weight: 600;
    font-size: 12px;
    color: #333;
}

.group-count {
    color: #666;
    font-size: 11px;
    margin-left: 4px;
}

.gantt-row-task-in-group {
    background-color: #fafbfc;
    border-left: 3px solid #e9ecef;
}

/* .gantt-row-task-in-group .gantt-task-cell {
    display: flex;
    align-items: center;
    justify-content: center;
} */

.gantt-task-bar:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.gantt-task-bar.selected {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.3);
    z-index: 5;
}

.gantt-task-bar-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
    transition: width 0.3s ease;
    border-radius: 4px 0 0 4px;
}

.gantt-task-bar-label {
    position: relative;
    z-index: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* width: 100%; */
    text-align: center;
    font-size: 11px;
    line-height: 1.2;
}

/* ===== LIENS ===== */
.gantt-link {
    position: absolute;
    height: 2px;
    background: #4caf50;
    cursor: pointer;
    z-index: 1;
}

.gantt-link:hover {
    background: #2196f3;
    height: 3px;
}

.gantt-link.selected {
    background: #2196f3;
    height: 3px;
    box-shadow: 0 0 4px rgba(33, 150, 243, 0.5);
}

/* ===== LIGNE AUJOURD'HUI ===== */
.gantt-today-line {
    position: absolute;
    top: 0;
    bottom: 0;
    /* width: 2px; */
    background: #ff5722;
    z-index: 2;
    pointer-events: none;
}

.gantt-today-line::after {
    content: '';
    position: absolute;
    top: 0;
    left: -3px;
    /* width: 8px; */
    height: 8px;
    background: #ff5722;
    border-radius: 50%;
}

/* ===== SCROLLBARS PERSONNALISÉES ===== */
.gantt-task-list-content::-webkit-scrollbar,
.gantt-elastic-chart-content::-webkit-scrollbar,
.gantt-elastic-chart-header::-webkit-scrollbar {
    /* width: 8px; */
    height: 8px;
}

.gantt-task-list-content::-webkit-scrollbar-track,
.gantt-elastic-chart-content::-webkit-scrollbar-track,
.gantt-elastic-chart-header::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.gantt-task-list-content::-webkit-scrollbar-thumb,
.gantt-elastic-chart-content::-webkit-scrollbar-thumb,
.gantt-elastic-chart-header::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.gantt-task-list-content::-webkit-scrollbar-thumb:hover,
.gantt-elastic-chart-content::-webkit-scrollbar-thumb:hover,
.gantt-elastic-chart-header::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.9;
    }
    50% {
        opacity: 0.7;
    }
}

/* ===== ÉTAT DE CHARGEMENT ===== */
.gantt-elastic-container.loading {
    position: relative;
}

.gantt-elastic-container.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(2px);
    z-index: 1000;
    animation: pulse 2s infinite;
}

.gantt-elastic-container.loading::before {
    content: 'Chargement...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1001;
    font-size: 16px;
    font-weight: 500;
    color: #333;
    background: white;
    padding: 1rem 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid #e0e0e0;
}

/* ===== ÉTAT VIDE ===== */
.gantt-elastic-chart-content:empty::after {
    content: 'Aucune tâche à afficher';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #999;
    font-size: 16px;
    font-style: italic;
}

.gantt-task-list-content:empty::after {
    content: 'Aucune tâche';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #999;
    font-size: 14px;
    font-style: italic;
}

/* ===== RESPONSIVE DESIGN ===== */
/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .gantt-elastic-container {
        min-height: 300px;
        max-height: 70vh;
    }

    .gantt-elastic-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 12px 16px;
    }

    .gantt-elastic-view-controls,
    .gantt-elastic-navigation,
    .gantt-elastic-actions {
        justify-content: center;
        flex-wrap: wrap;
    }

    .gantt-view-btn,
    .gantt-nav-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .gantt-elastic-task-list {
        width: 180px;
        min-width: 150px;
    }

    .gantt-task-list-column {
        padding: 6px 4px;
        font-size: 11px;
    }

    .gantt-task-cell {
        padding: 4px 4px;
        font-size: 11px;
        min-height: 30px;
    }

    .gantt-chart-header-cell {
        min-width: 35px;
        padding: 6px 2px;
        font-size: 10px;
    }

    .gantt-task-bar {
        height: 20px;
        font-size: 10px;
        min-width: 20px;
    }

    .gantt-elastic-chart-content {
        overflow-x: auto;
        overflow-y: auto;
    }
}

@media (max-width: 480px) {
    .gantt-elastic-container {
        min-height: 250px;
        max-height: 60vh;
    }

    .gantt-elastic-header {
        padding: 12px 16px;
    }

    .gantt-elastic-controls {
        padding: 8px 12px;
    }

    .gantt-elastic-task-list {
        width: 120px;
        min-width: 100px;
    }

    .gantt-task-list-column {
        padding: 4px 2px;
        font-size: 10px;
    }

    .gantt-task-cell {
        padding: 4px 2px;
        font-size: 10px;
        min-height: 25px;
    }

    .gantt-chart-header-cell {
        min-width: 25px;
        padding: 4px 1px;
        font-size: 9px;
    }

    .gantt-task-bar {
        height: 18px;
        font-size: 9px;
        padding: 0 2px;
        min-width: 15px;
    }

    .gantt-elastic-chart-content {
        overflow-x: auto;
        overflow-y: auto;
    }
}

@media (max-width: 360px) {
    .gantt-elastic-container {
        min-height: 200px;
        max-height: 50vh;
    }

    .gantt-elastic-task-list {
        width: 100px;
        min-width: 80px;
    }

    .gantt-task-list-column {
        padding: 2px 1px;
        font-size: 9px;
    }

    .gantt-task-cell {
        padding: 2px 1px;
        font-size: 9px;
        min-height: 20px;
    }

    .gantt-chart-header-cell {
        min-width: 20px;
        padding: 2px 1px;
        font-size: 8px;
    }

    .gantt-task-bar {
        height: 15px;
        font-size: 8px;
        padding: 0 1px;
        min-width: 10px;
    }

    .gantt-elastic-chart-content {
        overflow-x: auto;
        overflow-y: auto;
    }
}

/* ===== UTILITAIRES ===== */
.gantt-elastic-container.compact .gantt-task-bar {
    height: 20px;
    font-size: 10px;
}

.gantt-elastic-container.compact .gantt-row {
    min-height: 35px;
}

.gantt-elastic-container.compact .gantt-task-cell {
    padding: 8px 6px;
    font-size: 12px;
}

/* ===== ACCESSIBILITÉ ===== */
.gantt-task-bar:focus,
.gantt-nav-btn:focus,
.gantt-view-btn:focus,
.gantt-action-btn:focus {
    outline: 2px solid #2196f3;
    outline-offset: 2px;
}

/* Overlay de loading */
.gantt-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.gantt-loading-spinner {
    text-align: center;
}

.gantt-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: gantt-spin 1s linear infinite;
    margin: 0 auto 10px;
}

.gantt-loading-text {
    color: #666;
    font-size: 14px;
    font-weight: 500;
}

@keyframes gantt-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== IMPRESSION ===== */
@media print {
    .gantt-elastic-container {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .gantt-elastic-header {
        background: #f0f0f0 !important;
        color: #000 !important;
    }
    
    .gantt-task-bar {
        border: 1px solid #000;
        box-shadow: none;
    }
} 