/* ===== Timeline Layout ===== */
.timeline-wrapper {
    position: relative;
    overflow-x: hidden;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

.timeline-container {
    position: relative;
    width: 100%;
}

/* Header row */
.timeline-header {
    display: flex;
    align-items: stretch;
    border-bottom: 2px solid #dee2e6;
    background: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* User row */
.timeline-row {
    display: flex;
    align-items: center;
    min-height: 36px;
    border-bottom: 1px solid #f0f0f0;
}
.timeline-row:hover {
    background: #f8f9fa;
}

/* Label column (user names) */
.timeline-label-col {
    width: 130px;
    min-width: 130px;
    padding: 4px 8px;
    font-size: 13px;
    font-weight: 500;
    color: #495057;
    border-right: 2px solid #dee2e6;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.user-name {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Grid area */
.timeline-grid {
    flex: 1;
    position: relative;
    min-height: 36px;
}

/* Date ticks in header */
.timeline-tick {
    position: absolute;
    top: 0;
    bottom: 0;
    border-left: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    pointer-events: none;
}

.timeline-month-label {
    font-size: 10px;
    font-weight: 600;
    color: #495057;
    padding: 2px 3px 0;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.timeline-day-label {
    font-size: 10px;
    color: #6c757d;
    padding: 0 3px;
    line-height: 1.2;
}

/* Today line */
.timeline-today-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #dc3545;
    z-index: 5;
    pointer-events: none;
    opacity: 0.8;
}

/* Vacation bars */
.vacation-bar {
    position: absolute;
    top: 4px;
    bottom: 4px;
    background: #2563eb;
    border-radius: 4px;
    cursor: pointer;
    overflow: hidden;
    transition: opacity 0.15s, filter 0.15s;
    min-width: 2px;
}
.vacation-bar:hover {
    opacity: 0.85;
    filter: brightness(1.1);
    z-index: 2;
}

/* Editable vacation bar (anchor element) */
a.vacation-bar {
    text-decoration: none;
}
a.vacation-bar-editable:hover {
    opacity: 0.8;
    filter: brightness(1.15);
    outline: 2px solid rgba(255,255,255,0.6);
    outline-offset: -2px;
}

/* Row center guide line */
.row-centerline {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 3px;
    transform: translateY(-50%);
    border-radius: 2px;
    pointer-events: none;
    z-index: 0;
}

/* Day highlight strips (weekends, holidays) */
.day-highlight {
    position: absolute;
    top: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 0;
}
.day-weekend { background: rgba(0, 0, 0, 0.04); }
.day-holiday { background: rgba(220, 53, 69, 0.10); }

.timeline-dark .day-weekend { background: rgba(255, 255, 255, 0.06); }
.timeline-dark .day-holiday { background: rgba(220, 53, 69, 0.22); }

/* Vacation bars above highlights */
.vacation-bar { z-index: 1; }

/* Cycle through colors per row – applied via CSS :nth-child */
.timeline-row:nth-child(3n+1) .vacation-bar { background: #2563eb; }
.timeline-row:nth-child(3n+2) .vacation-bar { background: #16a34a; }
.timeline-row:nth-child(3n+3) .vacation-bar { background: #9333ea; }
.timeline-row:nth-child(4n)   .vacation-bar { background: #ea580c; }
.timeline-row:nth-child(5n)   .vacation-bar { background: #0891b2; }

.vacation-label {
    display: block;
    font-size: 10px;
    color: #fff;
    padding: 0 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 28px;
}

/* ===== Dark mode (public/Zabbix view) ===== */
.timeline-dark .timeline-wrapper,
body.bg-dark .timeline-wrapper {
    background: #1a1d23;
    border-color: #2d3038;
}

.timeline-dark .timeline-header,
body.bg-dark .timeline-header {
    background: #12151a;
    border-color: #2d3038;
}

.timeline-dark .timeline-row,
body.bg-dark .timeline-row {
    border-color: #2d3038;
}
.timeline-dark .timeline-row:hover,
body.bg-dark .timeline-row:hover {
    background: #1e2128;
}

.timeline-dark .timeline-label-col,
body.bg-dark .timeline-label-col {
    color: #c9d1d9;
    border-color: #2d3038;
}

.timeline-dark .timeline-tick,
body.bg-dark .timeline-tick {
    border-color: #2d3038;
}

.timeline-dark .timeline-month-label,
body.bg-dark .timeline-month-label {
    color: #8b949e;
}

.timeline-dark .timeline-day-label,
body.bg-dark .timeline-day-label {
    color: #6e7681;
}

/* ===== General ===== */
body {
    font-size: 14px;
}

.font-monospace {
    font-family: 'Consolas', 'Monaco', monospace;
}
