/* Gantt View Styles */

/* Gantt view wrapper with floating controls */
.gantt-view-wrapper {
    position: relative;
    background: #fff;
}

/* Floating scroll arrows */
.gantt-scroll-arrow {
    position: absolute;
    top: 8px;
    z-index: 100;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    color: #495057;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gantt-scroll-arrow:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    color: #007bff;
}

.gantt-scroll-arrow:active {
    transform: scale(0.95);
}

/* Two-panel layout */
.gantt-layout {
    display: flex;
    height: 70vh;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
}

/* Left panel: Fixed columns */
.gantt-fixed-panel {
    width: 380px;
    min-width: 380px;
    max-width: 380px;
    background: #f8f9fa;
    border-right: 2px solid #dee2e6;
    display: flex;
    flex-direction: column;
}

.gantt-fixed-header {
    display: flex;
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 20;
}

.gantt-fixed-rows {
    flex: 1;
    overflow-y: scroll; /* Allow scrolling for sync */
    background: #ffffff;
    scrollbar-width: none; /* Hide scrollbar */
    -ms-overflow-style: none; /* Hide scrollbar */
    padding-bottom: 20px; /* Prevent last task from being hidden by scrollbar */
}

.gantt-fixed-rows::-webkit-scrollbar {
    display: none; /* Hide scrollbar */
}

.gantt-fixed-row {
    display: flex;
    height: 40px;
    border-bottom: 1px solid #e9ecef;
    align-items: center;
}

.gantt-fixed-row:hover {
    background: rgba(0, 123, 255, 0.05);
}

/* Right panel: Timeline */
.gantt-timeline-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.gantt-col {
    padding: 8px 12px;
    border-right: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    font-weight: 600;
    color: #495057;
}

.gantt-col-wbs {
    width: 80px;
    justify-content: center;
}

.gantt-col-task {
    width: 300px;
    min-width: 300px;
    max-width: 300px;
    overflow: hidden;
}

.gantt-col-combined {
    width: 380px;
    min-width: 380px;
    max-width: 380px;
    overflow: hidden;
}

/* Timeline header */
.gantt-timeline-header {
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    height: 60px;
    overflow-x: scroll;
    overflow-y: hidden;
    display: flex;
    padding-right: 20px; /* Extra padding to match content width */
    scrollbar-width: none; /* Hide scrollbar */
    -ms-overflow-style: none; /* Hide scrollbar */
    position: sticky;
    top: 0;
    z-index: 20;
}

.gantt-timeline-header::-webkit-scrollbar {
    display: none; /* Hide scrollbar */
}

.gantt-timeline-content {
    flex: 1;
    overflow-x: auto;
    overflow-y: auto; /* Primary vertical scroll controller */
    position: relative;
    padding-bottom: 20px; /* Prevent last task from being hidden by scrollbar */
}

.gantt-date-col {
    width: 40px;
    min-width: 40px;
    padding: 4px 2px;
    border-right: 1px solid #e9ecef;
    text-align: center;
    font-size: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.gantt-date-col.working-day {
    background: #ffffff;
}

.gantt-date-col.non-working-day {
    background: #f1f3f4;
    color: #6c757d;
}

.date-day {
    font-weight: 600;
    line-height: 1.2;
}

.date-month {
    font-size: 0.7rem;
    color: #007bff;
    font-weight: 600;
    margin-top: 1px;
}

/* Week start indicator */
.gantt-date-col.week-start {
    border-left: 3px solid #dee2e6;
    position: relative;
}

.gantt-date-col.week-start::before {
    content: '';
    position: absolute;
    left: -3px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #dee2e6;
    z-index: 10;
}

/* Week start lines in task rows */
.week-start-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #dee2e6;
    opacity: 0.8;
    pointer-events: none;
    z-index: 5;
}

/* Today's date highlighting */
.gantt-date-col.today {
    background: #CCEEFF !important;
    font-weight: 700;
}

.today-shade {
    position: absolute;
    top: 0;
    bottom: 0;
    background: #CCEEFF;
    opacity: 0.6;
    pointer-events: none;
    z-index: 3;
}

/* Remove old styles - now using two-panel layout */

/* Timeline area for each row */
.gantt-timeline-row {
    position: relative;
    height: 40px;
    min-width: fit-content;
    width: max-content;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
}

/* Gantt bars */
.gantt-bar {
    position: absolute;
    height: 20px;
    background: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
    min-width: 20px;
}

.gantt-bar:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 20;
}

/* Gantt bar fill (background) */
.gantt-bar-fill {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: inherit;
}

/* Progress indicator line */
.gantt-bar-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: #ff6b35;
    opacity: 0.9;
    z-index: 2;
    border-radius: 0 0 3px 3px;
}

/* Task label on bar */
.gantt-bar-label {
    position: absolute;
    top: 50%;
    left: 6px;
    transform: translateY(-50%);
    font-size: 0.75rem;
    font-weight: 500;
    color: #000000;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 12px);
    z-index: 3;
}

/* Status-based bar colors (matching WBS text colors) */
.gantt-bar-completed {
    background: #339933 !important;
    border-color: #2d8228 !important;
}

.gantt-bar-completed .gantt-bar-label {
    color: #ffffff !important;
}

.gantt-bar-overdue-not-started {
    background: #ff9900 !important;
    border-color: #e88a00 !important;
}

.gantt-bar-overdue-not-started .gantt-bar-label {
    color: #ffffff !important;
}

.gantt-bar-overdue-incomplete {
    background: #cc0000 !important;
    border-color: #b30000 !important;
}

.gantt-bar-overdue-incomplete .gantt-bar-label {
    color: #ffffff !important;
}

/* Selected bar highlighting */
.gantt-bar-selected {
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.5) !important;
    z-index: 25 !important;
}


/* Date column background pattern */
.gantt-timeline-row::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: repeating-linear-gradient(
        to right,
        transparent 0,
        transparent 39px,
        #e9ecef 39px,
        #e9ecef 40px
    );
    pointer-events: none;
}

/* Non-working day shading in timeline */
.gantt-timeline-row .non-working-day-shade {
    position: absolute;
    top: 0;
    bottom: 0;
    background: rgba(241, 243, 244, 0.8);
    pointer-events: none;
    z-index: 1;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .gantt-col-task {
        min-width: 200px;
    }

    .gantt-fixed-columns {
        min-width: 330px;
    }

    .gantt-date-col {
        width: 35px;
        min-width: 35px;
    }
}