/* GANTT CHART STYLES */

.gantt-view {
    padding: 20px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
}

.gantt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.gantt-header h2 {
    margin: 0;
    color: #333;
}

.gantt-controls {
    display: flex;
    gap: 10px;
}

.gantt-controls .btn-sm {
    padding: 6px 12px;
    font-size: 14px;
}

.gantt-container {
    flex: 1;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: auto;
}

.gantt-chart {
    position: relative;
}

/* Header row + task rows share the same grid */
.gantt-header-row {
    display: flex;
    border-bottom: 2px solid #dee2e6;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.gantt-name-col {
    flex-shrink: 0;
    padding: 10px;
    font-size: 13px;
    color: #333;
    border-right: 2px solid #dee2e6;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
}

.gantt-header-row .gantt-name-col {
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    color: #6c757d;
}

.gantt-timeline-col {
    flex-shrink: 0;
    display: flex;
}

/* Day cells in timeline header */
.gantt-day-cell {
    flex-shrink: 0;
    padding: 6px 0;
    text-align: center;
    border-right: 1px solid #e9ecef;
    font-size: 11px;
    box-sizing: border-box;
}

.gantt-day-cell.weekend {
    background: #f5f5f5;
}

.gantt-day-cell.today {
    background: #e8f0fe;
    border-bottom: 2px solid #0d6efd;
}

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

.month-label,
.week-label {
    font-size: 10px;
    color: #6c757d;
    margin-top: 1px;
}

.year-label {
    font-size: 10px;
    color: #adb5bd;
}

.date-range {
    font-size: 10px;
    color: #6c757d;
}

/* Tasks */
.gantt-tasks {
    position: relative;
}

.gantt-task-row {
    display: flex;
    align-items: center;
    height: 50px;
    border-bottom: 1px solid #f0f0f0;
}

.gantt-task-row:hover {
    background: #fafbfc;
}

.task-wbs {
    color: #6c757d;
    font-size: 11px;
    font-weight: 600;
}

.gantt-macro-row {
    background: #f0f4f8;
}

.gantt-macro-row .gantt-name-col {
    font-weight: 600;
}

.gantt-task-link {
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gantt-task-link:hover {
    color: #0d6efd;
    text-decoration: underline;
}

.gantt-responsible {
    font-size: 11px;
    color: #6c757d;
    font-weight: 400;
}

.gantt-toggle {
    cursor: pointer;
    font-size: 11px;
    color: #495057;
    user-select: none;
    display: inline-block;
    width: 16px;
    text-align: center;
}

.gantt-toggle:hover {
    color: #0d6efd;
}

/* Task Bars */
.task-bar {
    position: absolute;
    height: 24px;
    top: 13px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    padding: 0 6px;
    cursor: pointer;
    transition: transform 0.15s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    overflow: hidden;
}

.task-bar:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.2);
}

.task-bar.planned {
    background: #0d6efd;
    color: white;
}

.task-bar.in-progress {
    background: #ffc107;
    color: #333;
}

.task-bar.completed {
    background: #198754;
    color: white;
}

.task-bar.delayed {
    background: #dc3545;
    color: white;
}

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

.task-label {
    position: relative;
    z-index: 1;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

/* Macro and Marco bars */
.task-bar-macro {
    height: 8px !important;
    top: 21px !important;
    border-radius: 0 !important;
    background: #adb5bd !important;
    box-shadow: none !important;
    overflow: visible !important;
}

.task-bar-macro .task-progress {
    background: #495057 !important;
    border-radius: 0 !important;
    height: 100%;
}

.task-bar-macro .task-label {
    position: absolute;
    top: -16px;
    left: 0;
    font-size: 10px;
    font-weight: 700;
    color: #495057;
    white-space: nowrap;
}

.task-bar-marco {
    width: 12px !important;
    height: 12px !important;
    top: 19px !important;
    border-radius: 0 !important;
    transform: rotate(45deg);
    background: #6f42c1 !important;
    padding: 0 !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2) !important;
}

.task-bar-marco .task-label,
.task-bar-marco .task-progress {
    display: none;
}

/* Today Line */
.gantt-today-line {
    position: absolute;
    top: 0;
    width: 2px;
    background: #dc3545;
    z-index: 6;
    pointer-events: none;
}

.gantt-today-label {
    position: absolute;
    top: -18px;
    left: -14px;
    font-size: 10px;
    font-weight: 700;
    color: #dc3545;
    white-space: nowrap;
}

/* Dependency Arrows */
.gantt-dependency-svg {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 5;
}

.gantt-dependency-line {
    stroke: #6c757d;
    stroke-width: 1.5;
    fill: none;
}

/* Legend */
.gantt-legend {
    display: flex;
    gap: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    margin-top: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #6c757d;
}

.color-box {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    display: inline-block;
}

/* Resize handle */
.gantt-resize-handle {
    position: absolute;
    right: -3px;
    top: 0;
    bottom: 0;
    width: 6px;
    cursor: col-resize;
    z-index: 20;
    background: transparent;
    transition: background 0.15s;
}

.gantt-resize-handle:hover {
    background: rgba(13, 110, 253, 0.25);
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

/* Responsive */
@media (max-width: 768px) {
    .gantt-name-col {
        width: 150px !important;
        font-size: 11px;
    }

    .gantt-legend {
        flex-wrap: wrap;
        gap: 10px;
    }
}

/* Print */
@media print {
    .gantt-header,
    .gantt-controls {
        display: none;
    }

    .gantt-container {
        box-shadow: none;
        overflow: visible;
    }
}
