:root {
    /* Kolory kategorii: biały tekst ma co najmniej 4,5:1 (UX9). Dawne: #2196F3 3,12; #f44336 3,68; #9E9E9E 2,68; #4CAF50 2,78. */
    --tl-accomodation: #1976D2;
    --tl-attraction: #d32f2f;
    --tl-transit: #757575;
    --tl-food: #2E7D32;
    --tl-generic: #9C27B0;
    --tl-label-width: 140px;
    --tl-track-min-width: 1440px;
}

.timeline {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 16px;
    overflow-x: auto;
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.timeline-date-section {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.timeline-date-header {
    font-weight: 700;
    font-size: 16px;
    padding: 12px 16px;
    background: #1565C0;
    color: #fff;
    letter-spacing: 0.3px;
}

/* ====== Time scale row ====== */
.timeline-scale-row {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid #e0e0e0;
    background: #fafafa;
}

.timeline-scale-label {
    width: var(--tl-label-width);
    min-width: var(--tl-label-width);
    flex-shrink: 0;
    font-weight: 600;
    font-size: 11px;
    color: #5c636a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    border-right: 1px solid #e0e0e0;
}

.timeline-scale-track {
    flex: 1;
    position: relative;
    min-width: var(--tl-track-min-width);
    height: 32px;
}

.timeline-hour-marker {
    position: absolute;
    top: 0;
    bottom: 0;
    border-right: 1px solid #eee;
}

.timeline-hour-label {
    position: absolute;
    bottom: 2px;
    transform: translateX(-50%);
    font-size: 10px;
    color: #5c636a;
    font-weight: 500;
    white-space: nowrap;
}

/* ====== Event row (one per category) ====== */
.timeline-event-row {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid #f0f0f0;
}

.timeline-event-row:last-child {
    border-bottom: none;
}

.timeline-event-label {
    width: var(--tl-label-width);
    min-width: var(--tl-label-width);
    flex-shrink: 0;
    font-weight: 700;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-right: 1px solid #e0e0e0;
}

.timeline-event-label__icon {
    font-size: 14px;
    font-style: normal;
}

.timeline-event-track {
    flex: 1;
    position: relative;
    min-width: var(--tl-track-min-width);
    height: 48px;
}

/* ====== Block item ====== */
.timeline-block {
    position: absolute;
    top: 4px;
    height: 40px;
    border-radius: 4px;
    color: #fff;
    padding: 4px 10px;
    overflow: hidden;
    cursor: grab;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    text-overflow: ellipsis;
    z-index: 1;
}

.timeline-block:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    z-index: 10;
}

.timeline-block--dragging {
    opacity: 0.85;
    cursor: grabbing !important;
    z-index: 100;
    transition: none;
    box-shadow: 0 6px 20px rgba(0,0,0,0.35);
}

.timeline-block__content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    padding: 0 4px;
}

.timeline-block__title {
    font-weight: 700;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timeline-block__time {
    font-size: 10px;
    font-weight: 500;
}

.timeline-block__icon {
    display: none;
}

/* ====== Drag handles ====== */
.timeline-block__handle {
    width: 6px;
    min-width: 6px;
    height: 100%;
    cursor: col-resize;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    flex-shrink: 0;
    transition: background 0.15s;
    position: relative;
}

.timeline-block__handle:hover {
    background: rgba(255,255,255,0.5);
}

.timeline-block__handle--start {
    margin-left: -10px;
    margin-right: 2px;
}

.timeline-block__handle--end {
    margin-right: -10px;
    margin-left: 2px;
}

.timeline-block__handle::after {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 16px;
    background: rgba(255,255,255,0.6);
    border-radius: 1px;
}

.timeline-block__handle--start::after {
    left: 2px;
}

.timeline-block__handle--end::after {
    right: 2px;
}

/* ====== Point in time ====== */
.timeline-block--point {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    top: 16px !important;
    border: 3px solid rgba(255,255,255,0.9) !important;
    box-shadow: 0 0 0 2px rgba(0,0,0,0.15), 0 2px 4px rgba(0,0,0,0.2) !important;
}

/* ====== Category colors ====== */
.timeline-block--accomodation {
    background: var(--tl-accomodation);
}

.timeline-block--attraction {
    background: var(--tl-attraction);
}

.timeline-block--transit {
    background: var(--tl-transit);
    color: #fff;
}

.timeline-block--transit .timeline-block__time {
    color: #fff;
}

.timeline-block--food {
    background: var(--tl-food);
    color: #fff;
}

.timeline-block--food .timeline-block__time {
    color: #fff;
}

.timeline-block--generic {
    background: var(--tl-generic);
}

/* ====== Locked / obligatory blocks ====== */
.timeline-block--locked {
    cursor: default;
    outline: 2px dashed rgba(255,255,255,0.65);
    outline-offset: -2px;
}

.timeline-block--obligatory {
    box-shadow: 0 0 0 2px #ffb300 inset, 0 1px 3px rgba(0,0,0,0.2);
    border: 1px solid rgba(255,179,0,0.7);
}

.timeline-block__mark {
    font-size: 10px;
    margin-right: 2px;
}

.timeline-block--editable {
    height: 52px;
    align-items: flex-start;
    padding-top: 5px;
}

.timeline-block--editable .timeline-block__handle {
    height: 100%;
    top: 0;
}

.timeline-block__toggle {
    position: absolute;
    top: 2px;
    right: 2px;
    border: 0;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    min-height: 24px;
    background: rgba(0,0,0,0.4);
    color: #fff;
    cursor: pointer;
    z-index: 5;
    white-space: nowrap;
}

.timeline-block__toggle:hover {
    background: rgba(0,0,0,0.7);
}

.timeline-block__toggle--on {
    background: #ffb300;
    color: #000;
}

.timeline-block__toggle--on:hover {
    background: #ffa000;
}

.timeline-block--multi-day {
    border-top: 2px dashed rgba(255,255,255,0.5);
}

/* ====== Drop zone (empty days) ====== */
/* Pusty dzień: bez opacity (obniżało kontrast całej zawartości do 1,3:1); odróżnia go przerywana ramka (3:1) i jasne tło. */
.timeline-date-section--drop-zone {
    border: 2px dashed #8c9298;
    transition: border-color 0.2s, background 0.2s;
}

.timeline-date-section--drop-zone .timeline-event-track {
    background: #fafafa;
}

/* ====== Drag-over highlight ====== */
.timeline-date-section--drag-over {
    border: 2px solid #1565C0 !important;
    background: #e3f2fd !important;
    opacity: 1 !important;
}

.timeline-date-section--drag-over .timeline-date-header {
    background: #0d47a1;
}

/* ====== Timeline toolbar ====== */
.timeline-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding: 8px 16px;
    background: #f5f5f5;
    border-radius: 8px;
}

/* ====== Responsive ====== */
@media (max-width: 768px) {
    :root {
        --tl-label-width: 100px;
    }

    .timeline-block {
        font-size: 10px;
        padding: 2px 6px;
        height: 36px;
        top: 6px;
    }

    .timeline-block__title {
        font-size: 10px;
    }

    .timeline-block--point {
        width: 12px !important;
        height: 12px !important;
        min-width: 12px !important;
        top: 18px !important;
    }
}

/* Klawiatura (UX1): widoczny fokus na zdarzeniu osi czasu w trybie edycji */
.timeline-block[tabindex]:focus-visible {
    outline: 3px solid #258cfb;
    outline-offset: 2px;
}

/* Ograniczenie ruchu (propozycja UX6): bez animacji i przejść osi czasu,
   gdy system prosi o zmniejszenie ruchu. Zmiana koloru i fokus zostają. */
@media (prefers-reduced-motion: reduce) {
    .timeline-block,
    .timeline-block__handle,
    .timeline-date-section--drop-zone {
        transition: none !important;
        animation: none !important;
    }
}
