/* ─── Wochenkalender Graphical Grid Overlay ─── */

/* Overlay container — covers terminal display area */
.wk-overlay {
    position: absolute;
    inset: 0;
    z-index: 40;
    background: rgba(10, 15, 25, 0.92);
    backdrop-filter: blur(4px);
    pointer-events: none;
    display: flex;
    flex-direction: column;
    padding: 12px 16px;
    font-family: 'Segoe UI', system-ui, sans-serif;
    color: #e0e0e0;
    overflow: hidden;
    border-radius: 4px;
}

.wk-overlay.wk-hidden {
    display: none;
}

/* ─── Header ─── */
.wk-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.wk-title {
    font-size: 15px;
    font-weight: 600;
    color: #f0b429;
    letter-spacing: 0.3px;
}

.wk-info {
    font-size: 12px;
    color: #8899aa;
    margin-left: 16px;
    white-space: nowrap;
}

.wk-close-btn {
    pointer-events: auto;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #8899aa;
    font-size: 16px;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
    margin-left: 12px;
}

.wk-close-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #e0e0e0;
    border-color: rgba(255, 255, 255, 0.25);
}


/* ─── Time Axis ─── */
.wk-time-axis {
    position: relative;
    height: 20px;
    margin-left: 36px;
    margin-right: 4px;
    margin-bottom: 4px;
    flex-shrink: 0;
}

.wk-time-label {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    font-size: 11px;
    color: #8899aa;
    font-variant-numeric: tabular-nums;
}

/* ─── Day Grid ─── */
.wk-grid {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-height: 0;
}

.wk-row {
    display: flex;
    align-items: center;
    height: 24px;
    flex-shrink: 0;
}

.wk-row-today {
    composes: wk-row;
}

.wk-row-today .wk-day-label {
    color: #f0b429;
    font-weight: 700;
}

.wk-row-today .wk-bar-track {
    box-shadow: 0 0 0 1px rgba(240, 180, 41, 0.35);
}

.wk-day-label {
    width: 32px;
    font-size: 12px;
    font-weight: 600;
    color: #bcc8d4;
    text-align: right;
    margin-right: 4px;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.wk-bar-track {
    position: relative;
    flex: 1;
    height: 100%;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 3px;
    overflow: hidden;
}

/* Gridlines at 6h intervals */
.wk-gridline {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(255, 255, 255, 0.06);
    pointer-events: none;
}

/* Bar segment base */
.wk-bar-segment {
    position: absolute;
    border-radius: 2px;
    min-width: 1px;
    pointer-events: auto;
    transition: opacity 0.15s ease;
}

.wk-bar-segment:hover {
    opacity: 0.85;
}

/* ON segment (Tagbetrieb) — full height amber */
.wk-bar-on {
    top: 2px;
    bottom: 2px;
    background: linear-gradient(180deg, #f0b429 0%, #d4972a 100%);
}

/* OFF segment (Nachtbetrieb) — thin low bar, muted */
.wk-bar-off {
    top: 65%;
    bottom: 2px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 1px;
}

/* Tooltip on hover */
.wk-bar-segment::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    background: #1a2233;
    color: #e0e0e0;
    font-size: 11px;
    padding: 3px 7px;
    border-radius: 3px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 50;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.wk-bar-segment:hover::after {
    opacity: 1;
}

/* ─── Cursor Marker (edit modes) ─── */
.wk-cursor {
    position: absolute;
    top: 0;
    bottom: 0;
    background: rgba(240, 180, 41, 0.35);
    border-left: 2px solid #f0b429;
    border-right: 2px solid #f0b429;
    z-index: 5;
    pointer-events: none;
    animation: wk-cursor-blink 1s step-end infinite;
}

.wk-cursor-night {
    background: rgba(100, 180, 255, 0.3);
    border-left-color: #64b4ff;
    border-right-color: #64b4ff;
}

.wk-cursor-scan {
    background: rgba(100, 220, 100, 0.3);
    border-left-color: #66dd66;
    border-right-color: #66dd66;
    animation: none;
    opacity: 0.8;
}

@keyframes wk-cursor-blink {
    0%, 60% { opacity: 1; }
    61%, 100% { opacity: 0.3; }
}

/* ─── Aktion Line (below grid) ─── */
.wk-aktion {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    margin-left: 36px;
    flex-shrink: 0;
}

.wk-aktion-label {
    font-size: 14px;
    font-weight: 600;
    color: #8899aa;
    white-space: nowrap;
}

.wk-aktion-item {
    font-size: 14px;
    color: #556677;
    padding: 2px 10px;
    border-radius: 3px;
    white-space: nowrap;
}

.wk-aktion-active {
    font-weight: 700;
}

.wk-aktion-active.wk-aktion-view {
    background: rgba(255, 255, 255, 0.08);
    color: #e0e0e0;
}

.wk-aktion-active.wk-aktion-setday {
    background: rgba(240, 180, 41, 0.2);
    color: #f0b429;
}

.wk-aktion-active.wk-aktion-setnight {
    background: rgba(100, 180, 255, 0.2);
    color: #64b4ff;
}

/* ─── Cursor Info (edit modes, below Aktion) ─── */
.wk-cursorinfo {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 4px;
    margin-left: 36px;
    flex-shrink: 0;
}

.wk-cursorinfo-pos {
    font-size: 15px;
    font-weight: 700;
    color: #e0e0e0;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.wk-cursorinfo-value {
    font-size: 14px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 3px;
    white-space: nowrap;
}

.wk-status-tag {
    background: rgba(240, 180, 41, 0.2);
    color: #f0b429;
}

.wk-status-nacht {
    background: rgba(100, 180, 255, 0.2);
    color: #64b4ff;
}

/* Verification message */
.wk-verify-msg {
    font-size: 14px;
    font-weight: 600;
    color: #66dd66;
    white-space: nowrap;
}

.wk-verify-dots::after {
    content: '';
    animation: wk-dots 1.5s steps(4, end) infinite;
}

@keyframes wk-dots {
    0%  { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
}

/* ─── Toggle Button (visible when overlay is hidden) ─── */
.wk-toggle-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 41;
    pointer-events: auto;
    background: rgba(10, 15, 25, 0.85);
    border: 1px solid rgba(240, 180, 41, 0.4);
    color: #f0b429;
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Segoe UI', system-ui, sans-serif;
    transition: all 0.15s ease;
    backdrop-filter: blur(4px);
}

.wk-toggle-btn:hover {
    background: rgba(240, 180, 41, 0.15);
    border-color: #f0b429;
}

.wk-toggle-btn.wk-hidden {
    display: none;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .wk-overlay {
        padding: 8px 10px;
    }

    .wk-title {
        font-size: 13px;
    }

    .wk-info {
        font-size: 11px;
    }

    .wk-day-label {
        width: 24px;
        font-size: 11px;
    }

    .wk-time-axis {
        margin-left: 28px;
    }

    .wk-aktion, .wk-cursorinfo {
        margin-left: 28px;
    }

    .wk-row {
        height: 20px;
    }

    .wk-time-label {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .wk-overlay {
        padding: 6px 8px;
    }

    .wk-title {
        font-size: 12px;
    }

    .wk-info {
        display: none;
    }

    .wk-day-label {
        width: 20px;
        font-size: 10px;
    }

    .wk-time-axis {
        margin-left: 24px;
    }

    .wk-aktion, .wk-cursorinfo {
        margin-left: 24px;
        gap: 8px;
    }

    .wk-aktion-label, .wk-aktion-item {
        font-size: 12px;
    }

    .wk-row {
        height: 18px;
    }
}
