﻿/* =======================
   Gantt Root & Layout
   ======================= */
.gantt-root {
    border-bottom: 1px solid #cbd5e1;
    font-family: Tahoma, sans-serif;
    font-size: 13px;
    color: #111827;
}

.gantt-header {
    display: flex; /* 🔥 THIS aligns left & right */
    width: 100%;
}

.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; /* 🔥 takes remaining space */
    display: flex;
    overflow: hidden;
    background: #f9fafb;
    border-bottom: 1px solid #cbd5e1;
}
/*
.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 {
    width: 32px;
    text-align: center;
    font-size: 12px;
    border-left: 1px solid #e2e8f0;
    padding: 2px 0;
}

/* =======================
   Body Layout
   ======================= */
.gantt-body {
    display: flex;
    height: 500px;
    user-select: none; /* prevent text selection while dragging */
}

.gantt-left {
    width: 300px;
    overflow: auto;
    border-right: 1px solid #cbd5e1;
    background: #ffffff;
}

.gantt-right {
    flex: 1;
    overflow: 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;
}

    /* 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;
}
*/

/* Allow tooltip to escape scrolling containers */
.gantt-right {
    overflow: auto;
}

.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;
    }
}
