/* ── FEAT-599 Workshop Occupancy Timeline ── wt-* prefix ── */

/* ── Page shell ────────────────────────────────────────────────────────────── */
.wt-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 0;
}

/* ── Filter bar ─────────────────────────────────────────────────────────────── */
.wt-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}

body[data-theme="dark"] .wt-bar { border-bottom-color: #333; }

.wt-brand {
    font-size: 1.05rem;
    font-weight: 600;
    white-space: nowrap;
    margin-right: 8px;
}

.wt-dot { color: #4db6ac; }

.wt-note-pill {
    font-size: 0.78rem;
    padding: 3px 8px;
    border-radius: 12px;
    background: var(--chip-bg, #f0f4f8);
    color: var(--text-muted, #666);
    white-space: nowrap;
}

body[data-theme="dark"] .wt-note-pill { background: #2a2a2a; color: #aaa; }

.wt-board-link { color: inherit; text-decoration: underline dotted; }

.wt-ctl {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
}

.wt-dd { min-width: 140px; }

.wt-group-btn {
    padding: 4px 10px;
    border-radius: 14px;
    border: 1px solid var(--border-color, #ccc);
    background: var(--chip-bg, #f5f5f5);
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--text-color, #333);
    transition: background 0.15s, color 0.15s;
}

.wt-group-btn-on {
    background: #4db6ac;
    color: #fff;
    border-color: #4db6ac;
}

body[data-theme="dark"] .wt-group-btn { background: #2a2a2a; color: #ddd; border-color: #444; }
body[data-theme="dark"] .wt-group-btn-on { background: #4db6ac; color: #fff; border-color: #4db6ac; }

/* ── Summary strip ──────────────────────────────────────────────────────────── */
.wt-summary-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}

body[data-theme="dark"] .wt-summary-strip { border-bottom-color: #333; }

.wt-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 16px;
    border-radius: 8px;
    background: var(--card-bg, #f9f9f9);
    border: 1px solid var(--border-color, #e0e0e0);
    min-width: 100px;
}

body[data-theme="dark"] .wt-tile { background: #1e1e1e; border-color: #333; }

.wt-tile-val {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-color, #222);
}

body[data-theme="dark"] .wt-tile-val { color: #eee; }

.wt-tile-lbl {
    font-size: 0.72rem;
    color: var(--text-muted, #888);
    margin-top: 3px;
    text-align: center;
}

.wt-tile-warn .wt-tile-val { color: #f57c00; }
.wt-tile-crit .wt-tile-val { color: #c62828; }

body[data-theme="dark"] .wt-tile-warn .wt-tile-val { color: #ffa726; }
body[data-theme="dark"] .wt-tile-crit .wt-tile-val { color: #ef5350; }

.wt-tile-worst { background: #fff3e0; border-color: #ff9800; }
body[data-theme="dark"] .wt-tile-worst { background: #2a1a00; border-color: #f57c00; }

.wt-worst-link {
    font-size: 1.4rem;
    font-weight: 700;
    color: #c62828;
    text-decoration: none;
}

.wt-worst-link:hover { text-decoration: underline; }
body[data-theme="dark"] .wt-worst-link { color: #ef5350; }

/* ── Error card ─────────────────────────────────────────────────────────────── */
.wt-error-card {
    margin: 12px 16px;
    padding: 10px 16px;
    border-radius: 8px;
    background: #ffebee;
    border: 1px solid #ef9a9a;
    color: #b71c1c;
    font-size: 0.9rem;
}

body[data-theme="dark"] .wt-error-card { background: #2a0000; border-color: #7f1515; color: #ef9a9a; }

.wt-err-label { font-weight: 600; }

/* ── Empty / loading ────────────────────────────────────────────────────────── */
.wt-empty {
    margin: 24px 16px;
    color: var(--text-muted, #888);
    font-size: 0.95rem;
}

/* ── Timeline ───────────────────────────────────────────────────────────────── */
.wt-timeline {
    flex: 1;
    overflow-x: auto;
    padding: 0 16px 24px;
}

.wt-timeline-inner {
    min-width: 600px;
}

/* Scale header */
.wt-header-row {
    display: flex;
    margin-top: 12px;
    margin-bottom: 4px;
}

.wt-col-head {
    font-size: 0.8rem;
    color: var(--text-muted, #888);
    font-weight: 600;
}

.wt-scale-bar {
    position: relative;
    height: 18px;
    flex: 1;
}

.wt-scale-tick {
    position: absolute;
    font-size: 0.72rem;
    color: var(--text-muted, #888);
    transform: translateX(-50%);
    white-space: nowrap;
}

/* Group header */
.wt-group-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 8px 0 4px;
    border-bottom: 2px solid var(--border-color, #ccc);
    margin-top: 10px;
}

body[data-theme="dark"] .wt-group-header { border-bottom-color: #444; }

.wt-group-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-color, #222);
}

body[data-theme="dark"] .wt-group-name { color: #eee; }

.wt-group-count {
    font-size: 0.8rem;
    color: var(--text-muted, #888);
}

.wt-group-raw {
    font-size: 0.72rem;
    color: var(--text-muted, #aaa);
    font-style: italic;
    margin-left: auto;
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: help;
}

/* Row */
.wt-row {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color, #f0f0f0);
    min-height: 32px;
}

body[data-theme="dark"] .wt-row { border-bottom-color: #2a2a2a; }

.wt-row:hover { background: var(--hover-bg, #f5f5f5); }
body[data-theme="dark"] .wt-row:hover { background: #1a1a1a; }

.wt-row-label {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 280px;
    max-width: 280px;
    padding: 4px 8px 4px 0;
    flex-shrink: 0;
    font-size: 0.83rem;
    overflow: hidden;
}

.wt-plate-link {
    font-weight: 600;
    color: var(--link-color, #1976d2);
    text-decoration: none;
    white-space: nowrap;
}

.wt-plate-link:hover { text-decoration: underline; }

.wt-ro-no {
    color: var(--text-muted, #666);
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90px;
}

.wt-ro-type, .wt-ro-status {
    font-size: 0.75rem;
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--chip-bg, #eee);
    white-space: nowrap;
    flex-shrink: 0;
}

body[data-theme="dark"] .wt-ro-type, body[data-theme="dark"] .wt-ro-status { background: #333; color: #ddd; }

.wt-days {
    font-size: 0.78rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Bar track */
.wt-bar-track {
    position: relative;
    flex: 1;
    height: 22px;
    background: var(--track-bg, #f0f0f0);
    border-radius: 2px;
    overflow: hidden;
    margin: 5px 0;
}

body[data-theme="dark"] .wt-bar-track { background: #1e1e1e; }

/* Bars */
.wt-seg {
    position: absolute;
    top: 2px;
    height: 18px;
    border-radius: 3px;
    min-width: 3px;
    transition: opacity 0.1s;
}

.wt-seg:hover { opacity: 0.85; }

/* Age-bucket colours — light */
.wt-lt7   { background: #43a047; }
.wt-d7-30 { background: #fb8c00; }
.wt-d30-90 { background: #e53935; }
.wt-gt90  { background: #6d0000; }
.wt-grey  { background: #9e9e9e; }

/* Age-bucket colours — dark (slightly brighter) */
body[data-theme="dark"] .wt-lt7    { background: #66bb6a; }
body[data-theme="dark"] .wt-d7-30  { background: #ffa726; }
body[data-theme="dark"] .wt-d30-90 { background: #ef5350; }
body[data-theme="dark"] .wt-gt90   { background: #b71c1c; }
body[data-theme="dark"] .wt-grey   { background: #616161; }

/* Open bar: fade to right instead of hard edge */
.wt-seg-open {
    border-radius: 3px 0 0 3px;
    /* mask-image fades the rightmost 30% to transparent */
    -webkit-mask-image: linear-gradient(to right, black 70%, transparent 100%);
    mask-image: linear-gradient(to right, black 70%, transparent 100%);
}

/* No-date placeholder */
.wt-seg-nodate {
    position: relative;
    width: 40px;
    font-size: 0.72rem;
    color: #aaa;
    display: flex;
    align-items: center;
    padding-left: 4px;
}

/* Left-edge arrow for bars starting before window */
.wt-seg-arrow {
    position: absolute;
    left: -1px;
    font-size: 0.65rem;
    color: rgba(255,255,255,0.9);
    line-height: 18px;
}

/* Days badge colours (row label area) */
.wt-lt7.wt-days    { background: #e8f5e9; color: #2e7d32; }
.wt-d7-30.wt-days  { background: #fff3e0; color: #e65100; }
.wt-d30-90.wt-days { background: #ffebee; color: #b71c1c; }
.wt-gt90.wt-days   { background: #6d0000; color: #fff; }
.wt-grey.wt-days   { background: #f5f5f5; color: #777; }

body[data-theme="dark"] .wt-lt7.wt-days    { background: #1b3a1c; color: #81c784; }
body[data-theme="dark"] .wt-d7-30.wt-days  { background: #2a1a00; color: #ffa726; }
body[data-theme="dark"] .wt-d30-90.wt-days { background: #2a0000; color: #ef5350; }
body[data-theme="dark"] .wt-gt90.wt-days   { background: #4a0000; color: #ff8a80; }
body[data-theme="dark"] .wt-grey.wt-days   { background: #222; color: #999; }

/* ── 390px responsive — compact list, no horizontal bar ────────────────────── */
@media (max-width: 420px) {
    /* filter bar: clamp to viewport, no horizontal bleed */
    .wt-bar   { display: flex; box-sizing: border-box; width: 100%; max-width: 100%; }
    .wt-timeline-inner { min-width: unset; }
    .wt-timeline { overflow-x: hidden; }

    .wt-header-row { display: none; }

    /* note pill: shrink and truncate rather than force width */
    .wt-note-pill {
        min-width: 0;
        flex-shrink: 1;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* control row: wrap items so date picker stacks within side gutter */
    .wt-ctl { flex-wrap: wrap; width: 100%; }

    .wt-row {
        flex-direction: column;
        align-items: flex-start;
        padding: 6px 0;
        min-height: unset;
    }

    .wt-row-label {
        max-width: 100%;
        min-width: unset;
        flex-wrap: wrap;
    }

    /* Hide the bar track; show only the days badge */
    .wt-bar-track { display: none; }

    .wt-group-raw { display: none; }
}
