﻿/* --- Controls --- */
.scale-controls {
    position: sticky;
    top: 10px;
    z-index: 1050;
    background-color: rgba(255, 255, 255, 0.98);
    padding: 8px;
    border-radius: 5px;
    border: 1px solid #ddd;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 15px;
    width: fit-content;
    display: flex;
    gap: 6px;
    align-items: center;
}

    .scale-controls button {
        padding: 5px 10px;
        border: 1px solid #ccc;
        background-color: #f0f0f0;
        cursor: pointer;
        border-radius: 3px;
    }

        .scale-controls button.selected {
            background-color: #007bff;
            color: white;
            border-color: #007bff;
        }

button.btn-dark-grey {
    background-color: #23272b;
    border-color: #23272b;
    color: #fff;
}

/* FIX: Forces the danger button to be red and removes hover effect */
.scale-controls .btn-danger,
.scale-controls .btn-danger:hover {
    color: #fff !important;
    background-color: #dc3545 !important;
    border-color: #dc3545 !important;
}


.filter-group {
    display: flex;
    flex-direction: column;
}

    .filter-group label {
        font-size: 0.8em;
        font-weight: bold;
        margin-bottom: 2px;
    }

.control-separator {
    border-left: 1px solid #ccc;
    height: 24px;
    margin: 0 4px;
}

.dropdown {
    position: relative;
    display: inline-block;
}

/* --- Main Grid Layout --- */
.gantt-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    border: 2px solid #888;
    height: 70vh;
    min-height: 500px;
    display: grid;
    grid-template-rows: auto 1fr;
    grid-template-columns: auto 1fr;
}

.gantt-no-data {
    grid-column: 1 / -1;
    padding: 2rem;
    text-align: center;
    color: #666;
}

/* --- Quadrant Styling --- */
.gantt-header-fixed, .gantt-header-timeline, .gantt-body-fixed, .gantt-body-timeline {
    overflow: auto;
    min-width: 0;
    min-height: 0;
}

.gantt-header-timeline, .gantt-body-timeline {
    position: relative;
}


.gantt-header-fixed, .gantt-header-timeline {
    overflow: hidden;
    background-color: #f7f7f7;
    border-bottom: 2px solid #ccc;
}

.gantt-header-fixed {
    grid-area: 1 / 1 / 2 / 2;
    border-right: 2px solid #ccc;
    z-index: 3;
}

.gantt-header-timeline {
    grid-area: 1 / 2 / 2 / 3;
}

.gantt-body-fixed {
    grid-area: 2 / 1 / 3 / 2;
    border-right: 2px solid #ccc;
    z-index: 1;
    background-color: #fff;
}

.gantt-body-timeline {
    grid-area: 2 / 2 / 3 / 3;
}

/* --- Content Wrappers --- */
.gantt-header-fixed-content, .gantt-body-fixed-content {
    display: flex;
    flex-shrink: 0;
}

.gantt-body-fixed-content {
    flex-direction: column;
}

.gantt-timeline-header-content, .gantt-timeline-body-content {
    display: flex;
    flex-direction: column;
    position: relative;
}

.gantt-timeline-header-content {
    flex-direction: row;
}

/* --- Left Pane Header Column Styling --- */
.gantt-header-fixed .gantt-column {
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    border-right: 1px solid #ccc;
    position: relative;
    padding: 6px 8px;
}

    .gantt-header-fixed .gantt-column:hover {
        background-color: #e9ecef;
    }

    .gantt-header-fixed .gantt-column::after {
        content: '';
        display: inline-block;
        width: 1em;
        text-align: center;
        margin-left: auto;
        color: #a0a0a0;
        font-size: 0.8em;
    }

    .gantt-header-fixed .gantt-column.sort-asc::after {
        content: '▲';
        color: #333;
    }

    .gantt-header-fixed .gantt-column.sort-desc::after {
        content: '▼';
        color: #333;
    }

/* --- Rows and Cells --- */
.gantt-row-fixed, .gantt-row-scrollable {
    height: 32px;
    box-sizing: border-box;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
}

.gantt-row-scrollable {
    position: relative;
}

.gantt-column {
    padding: 6px 8px;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    height: 100%;
    display: flex;
    align-items: center;
    border-right: 1px solid #f0f0f0;
    flex-shrink: 0;
    justify-content: flex-start;
}

.gantt-header-fixed-content .gantt-column:last-child, .gantt-row-fixed .gantt-column:last-child {
    border-right: none;
}

.gantt-expander {
    cursor: pointer;
    margin-right: 8px;
    font-family: monospace;
    user-select: none;
}

.column-resizer {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 8px;
    cursor: col-resize;
    z-index: 10;
}

/* --- Timeline Header Cells & Bars --- */
.major-scale-group {
    display: flex;
    flex-direction: column;
    border-right: 1px solid #ddd;
    text-align: center;
    flex-shrink: 0;
}

.major-scale-header {
    font-weight: 600;
    height: 30px;
    line-height: 30px;
    border-bottom: 1px solid #ddd;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 5px;
}

.minor-scale-row {
    display: flex;
    height: 30px;
}

.minor-scale-header {
    font-size: 0.8em;
    color: #555;
    border-right: 1px solid #eee;
    line-height: 30px;
    text-align: center;
    flex-shrink: 0;
    box-sizing: border-box;
}

.gantt-bar {
    position: absolute;
    height: 75%;
    top: 12.5%;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    cursor: grab;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    padding: 0 8px;
    overflow: hidden;
}

    .gantt-bar:hover {
        box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    }

.gantt-bar-text {
    color: white;
    font-size: 0.8em;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.gantt-tooltip {
    position: fixed;
    display: none;
    background-color: lightyellow;
    color: black;
    border: 1px solid #888;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.9em;
    z-index: 1070;
    pointer-events: none;
    white-space: pre-wrap;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.fe-count-tooltip {
    position: fixed;
    background-color: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8em;
    z-index: 1080;
    pointer-events: none;
}

/* --- Column Widths via CSS Variables --- */
.header-task-name-field, .task-name-field {
    width: var(--gantt-name-column-width, 250px);
}

.header-start-date-field, .task-start-date-field {
    width: var(--gantt-start-date-column-width, 95px);
}

.header-end-date-field, .task-end-date-field {
    width: var(--gantt-end-date-column-width, 95px);
}

.header-spt-type-field, .task-spt-type-field {
    width: var(--gantt-spt-type-column-width, 110px);
}

.header-fe-type-field, .task-fe-type-field {
    width: var(--gantt-fe-type-column-width, 110px);
}

.header-fe-name-field, .task-fe-name-field {
    width: var(--gantt-fe-name-column-width, 110px);
}

.header-size-field, .task-size-field {
    width: var(--gantt-size-column-width, 60px);
}

/* --- Bar Chart --- */
.bar-chart-container {
    /* REMOVED: height: 130px; */
    min-height: 130px; /* Allows the container to grow when expanded */
    display: grid;
    grid-template-columns: auto 1fr;
    border-top: 2px solid #ccc;
    background-color: #f8f9fa;
    transition: min-height 0.3s ease; /* Adds a smooth growing animation */
}

    /* Add this new rule right below it */
    .bar-chart-container.expanded-loe {
        min-height: 650px; /* Gives the expanded 600px bars room to breathe */
    }

.bar-chart-left-pane {
    display: flex;
    border-right: 2px solid #ccc;
    flex-shrink: 0;
}

.y-axis-title {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-weight: bold;
    color: #555;
    text-align: center;
    padding: 0 5px;
    border-right: 1px solid #ccc;
}

.y-axis-labels-wrapper {
    position: relative;
    width: 40px;
}

.y-axis-labels {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    top: 20px;
}

.y-axis-label-item {
    position: absolute;
    right: 5px;
    transform: translateY(50%);
    font-size: 10px;
    color: #555;
}

.bar-chart-scrollable {
    overflow-x: auto;
    overflow-y: hidden;
    grid-column: 2;
}

.bar-chart-content {
    position: relative;
}

.bar-chart-bar {
    background-color: #6c757d;
    flex-shrink: 0;
    box-sizing: border-box;
    border-left: 1px solid #f8f9fa;
    position: absolute;
    bottom: 0;
}

.search-highlight {
    background-color: #fffde7 !important;
}

.timeline-marker {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: red;
    z-index: 10;
}

.selectable-task-name {
    user-select: all;
    -webkit-user-select: all; /* For Safari compatibility */
    cursor: text;
}