﻿/* =======================
   Gantt Root & Layout
   ======================= */
.gantt-root {
    border-bottom: 1px solid #cbd5e1;
    font-family: Tahoma, sans-serif;
    font-size: 13px;
    color: #111827;
}

.gantt-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    border-bottom: 1px solid #e0e0e0;
    background: #fafafa;
}

.gantt-toolbar-left,
.gantt-toolbar-right {
    display: flex;
    gap: 6px;
}


.gantt-header {
    display: flex;
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 20;
    background: #f9fafb;
}


.gantt-header-row {
    display: flex;
    width: max-content; /* 🔥 match timeline width */
    height: 32px;
}

.gantt-year,
.gantt-month,
.gantt-week,
.gantt-day,
.gantt-hour,
.gantt-date {
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    border-left: 1px solid #e2e8f0;
}

.gantt-year {
    font-weight: 700;
    background: #f1f5f9;
    border-left: 2px solid #cbd5e1;
}

.gantt-month {
    font-weight: 600;
    background: #f8fafc;
}

.gantt-week,
.gantt-day,
.gantt-hour {
    font-size: 11px;
}

.gantt-header div {
    overflow: auto;
    text-overflow: ellipsis;
}

.gantt-hour {
    background: red !important;
}



.gantt-left-header {
    width: 300px;
    flex-shrink: 0; /* 🔥 prevents shrinking */
    padding: 8px;
    font-weight: 600;
    background: #f9fafb;
    border-bottom: 1px solid #cbd5e1;
}

/*.gantt-right-header {
    flex: 1; 
    display: flex;
    overflow: hidden;
    background: #f9fafb;
    border-bottom: 1px solid #cbd5e1;
}*/

.gantt-right-header {
    flex: 1; /* takes remaining space */
    display: flex;
    flex-direction: column; /* 🔥🔥🔥 THIS */
    overflow-x: auto; /* ✅ allow horizontal scroll */
    overflow-y: hidden; /* keep vertical clean */
    background: #f9fafb;
    border-bottom: 1px solid #cbd5e1;
    white-space: nowrap; /* prevent wrapping */
    height: 64px; /* 🔥🔥 IMPORTANT */
}

    /* Prevent header cell shrinking */
    .gantt-right-header > * {
        flex-shrink: 0;
    }

.gantt-hour:nth-child(even),
.gantt-day:nth-child(even) {
    background: rgba(0,0,0,0.02);
}


    /* Optional: hide header scrollbar */
    .gantt-right-header::-webkit-scrollbar {
        display: none;
    }

/*
.gantt-left-header {
    width: 300px;
    padding: 8px;
    font-weight: 600;
    background: #f9fafb;
    border-bottom: 1px solid #cbd5e1;
}

.gantt-right-header {
    display: flex;
    overflow: hidden;
    background: #f9fafb;
    border-bottom: 1px solid #cbd5e1;
}
*/

.gantt-date {
    min-width: 32px;
    text-align: center;
    font-size: 12px;
    border-left: 1px solid #e2e8f0;
    padding: 2px 0;
    flex-shrink: 0;
    white-space: nowrap;
}


/* =======================
   Body Layout
   ======================= */
.gantt-body {
    display: flex;
    height: 500px;
    user-select: none; /* prevent text selection while dragging */
}



.gantt-left {
    width: 300px;
    overflow-y: auto;
    overflow-x: auto; /* ✅ allow horizontal scroll */
    border-right: 1px solid #cbd5e1;
    background: #ffffff;
    white-space: nowrap; /* prevent wrapping */
}


.gantt-right {
    flex: 1;
    overflow-x: auto;
    overflow-y: auto;
    position: relative;
    background: #ffffff;
    white-space: nowrap; /* keep timeline horizontal */
}


/* =======================
   Rows
   ======================= */
.task-row, .timeline-row {
    height: 32px;
    border-bottom: 1px solid #f1f5f9;
    position: relative; /* important for absolute bars */
    display: flex;
    align-items: center;
    padding-left: 4px;   
}

    /* Zebra striping */
    .task-row:nth-child(even),
    .timeline-row:nth-child(even) {
        background-color: #fafafa;
    }

    .task-row:hover,
    .timeline-row:hover {
        background-color: #e6f0ff !important;
    }


.timeline-row {
    min-width: 100%;
}


.task-row {
    white-space: nowrap;
}


    .task-row span {
        display: inline-block;
        min-width: max-content;
    }


    /* Row hover highlight */
    .task-row:hover, .timeline-row:hover {
        background-color: #f9fafb;
    }

    /* =======================
   Hierarchy / indentation
   ======================= */
    .task-row span {
        display: inline-block;
        position: relative;
    }

        .task-row span::before {
            content: "";
            position: absolute;
            left: 0;
            top: 0;
            bottom: 0;
            width: 1px;
            background: #e2e8f0; /* vertical hierarchy line */
        }

/* Expand / collapse toggle */
.toggle {
    cursor: pointer;
    margin-right: 6px;
    font-weight: 600;
    user-select: none;
}


/* =======================
   Bars
   ======================= */

.bar-wrapper {
    position: relative;
    height: 32px; /* same as timeline-row */
    width: 100%;
    overflow: visible; /* VERY IMPORTANT */
}

    .bar-wrapper.resizing {
        cursor: ew-resize;
        user-select: none;
    }


.bar {
    position: absolute;
    border-radius: 3px;
    transition: all 0.2s ease;
}

    /* Expected / Baseline */
    .bar.expected {
        background: #6366f1;
        top: 12px;
        height: 6px;
        z-index: 2;
    }

    /* Actual / Progress */
    .bar.actual {
        background: #16a34a;
        top: 6px;
        height: 18px;
        overflow: hidden;
        z-index: 3;
    }

/* Progress overlay */
.bar-progress {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 2px;
    transition: width 0.6s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 6px;
}

.progress-text {
    font-size: 11px;
    font-weight: 600;
    color: #ffffff;
    pointer-events: none;
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

.bar:hover {
    opacity: 0.85;
    cursor: pointer;
}


/* =======================
   Scrollbar Styling
   ======================= */
.gantt-left::-webkit-scrollbar,
.gantt-right::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.gantt-left::-webkit-scrollbar-thumb,
.gantt-right::-webkit-scrollbar-thumb {
    background-color: rgba(0,0,0,0.15);
    border-radius: 4px;
}

.gantt-left::-webkit-scrollbar-track,
.gantt-right::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.03);
}

.tooltip {
    position: fixed;
    background: #1f2937;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 99999;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.35);
    display: block !important;
    opacity: 1 !important;
}


.delay-text {
    color: #f87171;
    font-weight: 600;
}



.today-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: #dc2626; /* red */
    z-index: 3;
    pointer-events: none;
}

.gantt-legend {
    display: flex;
    gap: 16px;
    padding: 8px 12px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
    font-size: 13px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 3px;
}




/* Show tooltip on bar hover 
.bar:hover .tooltip {
    opacity: 1;
}
*/

.timeline-row {
    overflow: visible !important;
}

.resize-handle {
    position: absolute;
    width: 8px;
    height: 100%;
    cursor: ew-resize;
    background: transparent;
}

    .resize-handle.left {
        left: -6px; /* OUTSIDE bar */
    }

    .resize-handle.right {
        right: -6px; /* OUTSIDE bar */
    }

.resizing .bar.actual {
    pointer-events: none;
}


/*

.resize-handle {
    position: absolute;
    top: 0;
    width: 6px;
    height: 100%;
    background: rgba(0,0,0,0.45);
    cursor: ew-resize;
    z-index: 2;
}

    .resize-handle.left {
        left: -3px;
    }

    .resize-handle.right {
        right: -3px;
    }

*/

/* =======================
   Responsive tweaks
   ======================= */
@media (max-width: 768px) {
    .gantt-left {
        width: 200px;
    }
}
