/* ═══════════════════════════════════════════════════════
   Resource Flow Timeline — Global Styles
   Adapted for MudBlazor Light & Dark themes
   ═══════════════════════════════════════════════════════ */

/* ── Wrapper ── */
.gantt-wrapper {
    background: var(--mud-palette-surface);
    border-radius: 12px;
    box-shadow: var(--mud-elevation-4);
    border: 1px solid var(--mud-palette-lines-default);
    margin-bottom: 24px;
    overflow: hidden;
}

.gantt-container {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 75vh;
    position: relative;
}

/* ── Premium Multi-line Tooltip (always dark, regardless of theme) ── */
.mud-tooltip {
    background-color: rgba(15, 23, 42, 0.98) !important;
    color: #f1f5f9 !important;
    border: 1px solid #475569 !important;
    border-radius: 8px !important;
    padding: 12px !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.7) !important;
    backdrop-filter: blur(8px) !important;
    pointer-events: none !important;
    z-index: 2000 !important;
}

.tooltip-title {
    font-weight: 700;
    color: #38bdf8;
    border-bottom: 1px solid #334155;
    margin-bottom: 8px;
    padding-bottom: 4px;
    display: block;
}

.tooltip-row {
    display: block;
    font-size: 0.78rem;
    color: #cbd5e1;
    line-height: 1.5;
}

/* ── Header ── */
.gantt-header {
    display: flex;
    flex-wrap: nowrap;
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--mud-palette-appbar-background);
    border-bottom: 2px solid var(--mud-palette-lines-default);
    min-width: max-content;
}

.gantt-header-corner {
    width: 240px;
    min-width: 240px;
    display: flex;
    align-items: center;
    padding: 12px 20px;
    background: var(--mud-palette-appbar-background);
    color: var(--mud-palette-appbar-text);
    border-right: 1px solid var(--mud-palette-lines-default);
    position: sticky;
    left: 0;
    z-index: 101;
}

.gantt-timeline-header {
    display: flex;
    flex-wrap: nowrap;
    flex-shrink: 0;
    flex-grow: 0;
    flex: 0 0 auto;
    width: max-content;
    min-width: min-content;
}

.gantt-time-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 0;
    border-right: 1px solid rgba(255,255,255,0.15);
    font-size: 0.78rem;
    color: var(--mud-palette-appbar-text);
    flex-grow: 0;
    flex-shrink: 0;
    box-sizing: border-box;
    overflow: hidden;
}

.gantt-time-col .gantt-time-day,
.gantt-time-col .gantt-time-date {
    max-width: 100%;
    text-align: center;
    overflow-wrap: anywhere;
}

.gantt-time-day {
    font-weight: 700;
    font-size: 0.76rem;
    text-transform: uppercase;
}

.gantt-time-date {
    font-weight: 400;
    font-size: 0.7rem;
    opacity: 0.85;
}

.gantt-today-col {
    background: rgba(var(--mud-palette-error-rgb), 0.1);
}

.gantt-weekend-col {
    background: rgba(0, 0, 0, 0.08);
}

/* ── Body ── */
.gantt-body {
    display: flex;
    flex-direction: column;
}

.gantt-row {
    display: flex;
    flex-wrap: nowrap;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    background: var(--mud-palette-surface);
    transition: background 0.2s;
    min-width: max-content;
}

.gantt-row:hover {
    background: rgba(var(--mud-palette-primary-rgb), 0.04);
}

/* ── Label Column ── */
.gantt-label-cell {
    width: 240px;
    min-width: 240px;
    padding: 12px 20px;
    position: sticky;
    left: 0;
    z-index: 50;
    background: var(--mud-palette-surface);
    border-right: 1px solid var(--mud-palette-lines-default);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.resource-cell {
    border-left: 4px solid var(--mud-palette-primary);
}

/* ── Timeline Row ── */
.gantt-timeline-row {
    display: flex;
    flex-wrap: nowrap;
    flex-shrink: 0;
    flex-grow: 0;
    flex: 0 0 auto;
    width: max-content;
    position: relative;
    background-image: linear-gradient(to right, var(--mud-palette-lines-default) 1px, transparent 1px);
    background-size: 48px 100%;
}

.gantt-cell {
    flex-grow: 0;
    flex-shrink: 0;
    box-sizing: border-box;
}

.gantt-weekend-cell {
    background: rgba(0, 0, 0, 0.04);
}

/* ── Phase Bars ── */
.gantt-bar {
    position: absolute;
    height: 26px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    padding: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid rgba(255,255,255,0.1);
    z-index: 5;
}

.resource-bar {
    border-left: 4px solid rgba(255,255,255,0.3);
}

.gantt-bar:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25);
    z-index: 10;
}

.gantt-bar-label {
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Today Line ── */
.gantt-today-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--mud-palette-error);
    z-index: 60;
    pointer-events: none;
    box-shadow: 0 0 6px rgba(211, 47, 47, 0.4);
}

/* ── Legend ── */
.gantt-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 0;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-text {
    font-size: 0.75rem;
    color: var(--mud-palette-text-secondary);
}
