/* ============================================================
   Project Timeline — Gantt View
   ============================================================ */

/* --- Toolbar --- */
.tl-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #FFF;
    border: 1px solid #DEE2E6;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

/* --- Priority Legend --- */
.tl-legend {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.4rem 1rem;
    font-size: 0.8rem;
    color: #6C757D;
    font-family: var(--font-primary);
}

.tl-legend-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.tl-legend-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.tl-legend-line {
    display: inline-block;
    width: 16px;
    height: 2px;
    background: #CC3333;
    position: relative;
}

.tl-legend-line::before {
    content: '';
    position: absolute;
    top: -3px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid #CC3333;
}

/* --- Main Wrapper (two-panel layout) --- */
.tl-wrapper {
    display: flex;
    border: 1px solid #DEE2E6;
    border-radius: 6px;
    overflow: hidden;
    background: #FFF;
    min-height: 400px;
    max-height: 600px;
}

/* --- Left Sidebar --- */
.tl-sidebar {
    width: 260px;
    min-width: 260px;
    border-right: 2px solid #DEE2E6;
    display: flex;
    flex-direction: column;
    background: #FAFBFC;
}

.tl-sidebar-header {
    padding: 0.6rem 1rem;
    font-family: var(--font-headings);
    font-weight: 700;
    font-size: 0.85rem;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 2px solid #DEE2E6;
    background: #F8F9FA;
    min-height: 38px;
    display: flex;
    align-items: center;
}

.tl-sidebar-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* --- Sidebar Group --- */
.tl-sidebar-group-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.75rem;
    cursor: pointer;
    font-family: var(--font-primary);
    font-size: 0.82rem;
    color: #333;
    background: #F0F1F3;
    border-bottom: 1px solid #E9ECEF;
    user-select: none;
    transition: background 0.15s;
}

.tl-sidebar-group-header:hover {
    background: #E8E9EB;
}

.tl-group-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    background: #DEE2E6;
    font-size: 0.7rem;
    font-weight: 700;
    color: #495057;
    margin-left: auto;
}

/* --- Sidebar Row --- */
.tl-sidebar-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem 0.35rem 1.5rem;
    cursor: pointer;
    font-family: var(--font-primary);
    font-size: 0.8rem;
    border-bottom: 1px solid #F0F1F3;
    min-height: 32px;
    height: 32px;
    transition: background 0.15s;
    white-space: nowrap;
    overflow: hidden;
}

.tl-sidebar-row:hover {
    background: #E8F8FB;
}

.tl-sidebar-row.active {
    background: #D4F1F7;
}

.tl-sidebar-row-id {
    font-size: 0.72rem;
    font-weight: 600;
    color: #6C757D;
    min-width: 36px;
}

.tl-sidebar-row-title {
    color: #212529;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Right Grid Area --- */
.tl-grid-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.tl-grid-header {
    overflow: hidden;
    border-bottom: 2px solid #DEE2E6;
    background: #F8F9FA;
    min-height: 38px;
    flex-shrink: 0;
}

.tl-grid-header-inner {
    display: flex;
    height: 100%;
}

.tl-grid-header-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-primary);
    font-size: 0.72rem;
    font-weight: 600;
    color: #6C757D;
    border-right: 1px solid #E9ECEF;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    padding: 0 2px;
}

.tl-grid-header-cell.weekend {
    background: #F3F3F5;
}

.tl-grid-header-cell.today {
    background: #FFF3F3;
    color: #CC3333;
    font-weight: 700;
}

.tl-grid-body {
    flex: 1;
    overflow: auto;
    position: relative;
}

.tl-grid-body-inner {
    position: relative;
    min-height: 100%;
}

/* --- Grid Row backgrounds --- */
.tl-grid-row {
    position: absolute;
    height: 32px;
    border-bottom: 1px solid #F0F1F3;
}

.tl-grid-row:hover {
    background: #FAFBFC;
}

/* --- Column background lines --- */
.tl-grid-col-line {
    position: absolute;
    top: 0;
    bottom: 0;
    background: transparent;
    border-right: 1px solid #F0F1F3;
    pointer-events: none;
}

.tl-grid-col-line.weekend {
    background: rgba(0, 0, 0, 0.015);
}

/* --- Today Line --- */
.tl-today-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #CC3333;
    z-index: 10;
    pointer-events: none;
}

.tl-today-marker {
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 7px solid #CC3333;
}

/* --- Bar --- */
.tl-bar {
    position: absolute;
    height: 18px;
    border-radius: 3px;
    cursor: pointer;
    transition: opacity 0.15s, box-shadow 0.15s;
    min-width: 6px;
    z-index: 5;
    display: flex;
    align-items: center;
    padding: 0 4px;
    overflow: hidden;
}

.tl-bar:hover {
    opacity: 0.85;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.tl-bar-label {
    font-family: var(--font-primary);
    font-size: 0.65rem;
    font-weight: 600;
    color: #FFF;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
    line-height: 18px;
}

/* --- Milestone Diamond --- */
.tl-milestone {
    position: absolute;
    width: 14px;
    height: 14px;
    transform: rotate(45deg);
    cursor: pointer;
    z-index: 5;
    transition: opacity 0.15s, box-shadow 0.15s;
}

.tl-milestone:hover {
    opacity: 0.85;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

/* --- Group Separator Row --- */
.tl-grid-group-row {
    position: relative;
    height: 30px;
    background: #F0F1F3;
    border-bottom: 1px solid #E9ECEF;
}

/* --- Unscheduled Section --- */
.tl-unscheduled {
    border: 1px solid #DEE2E6;
    border-radius: 6px;
    background: #FFF;
    overflow: hidden;
}

.tl-unscheduled-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: #F8F9FA;
    border-bottom: 1px solid #DEE2E6;
    cursor: pointer;
    user-select: none;
    font-family: var(--font-primary);
    font-size: 0.9rem;
    color: #333;
    transition: background 0.15s;
}

.tl-unscheduled-header:hover {
    background: #EAEAEE;
}

.tl-unscheduled-body {
    max-height: 300px;
    overflow-y: auto;
}

.tl-unscheduled-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid #F0F1F3;
    cursor: pointer;
    font-family: var(--font-primary);
    transition: background 0.15s;
}

.tl-unscheduled-item:hover {
    background: #E8F8FB;
}

.tl-unscheduled-item.active {
    background: #D4F1F7;
}

.tl-unscheduled-item:last-child {
    border-bottom: none;
}

/* --- Preview Panel (shared styles from projectboard.css) --- */
/* These are duplicated here so timeline works standalone.
   If projectboard.css is already loaded, these are harmless overrides. */

/* --- Responsive --- */
@media (max-width: 1200px) {
    .tl-sidebar {
        width: 220px;
        min-width: 220px;
    }
}

@media (max-width: 768px) {
    .tl-wrapper {
        flex-direction: column;
        max-height: none;
    }

    .tl-sidebar {
        width: 100%;
        min-width: 100%;
        border-right: none;
        border-bottom: 2px solid #DEE2E6;
        max-height: 200px;
    }

    .tl-grid-wrapper {
        min-height: 300px;
    }

    .tl-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .tl-legend {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .tl-sidebar {
        max-height: 150px;
    }
}
