/* ═══════════════════════════════════════════════════════════════════════════════
   Review Hub Header Filters
   Filter toggle controls for the review hub header bar.
   Design language matches level-queue-selector.css (monospace, mode colors, glow).
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════════════════
   WK Filter — 3 clickable horizontal bars stacked vertically
   Perpendicular complement to level bars (which are vertical bars, horizontal).
   Top (widest) = ALL, Middle = SKIP WK, Bottom (narrowest) = ONLY WK.
   ═══════════════════════════════════════════════════════════════════════════════ */

.swk-container {
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
    -webkit-user-select: none;
}

.swk-container.hidden {
    display: none !important;
}

/* ── Bars wrapper — stacked vertically, center-aligned ────────────────────── */

.swk-bars {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 4px 0;
    cursor: pointer;
    position: relative;
}

/* ── Individual bars — clickable, tapering widths ─────────────────────────── */

.swk-bar {
    /* Reset button styles */
    appearance: none;
    border: none;
    padding: 0;
    margin: 0;
    font: inherit;
    cursor: pointer;
    /* Component styles */
    height: 5px;
    border-radius: 2.5px;
    background: var(--text-muted, rgba(255, 255, 255, 0.25));
    transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
    position: relative;
}

/* Bar widths — by position, widest (top) to narrowest (bottom).
   Keyed to DOM position, NOT data-filter, so swap logic can freely
   reassign filters without breaking the funnel shape. */
.swk-bar:nth-child(1) { width: 40px; }
.swk-bar:nth-child(2) { width: 27px; }
.swk-bar:nth-child(3) { width: 14px; }

/* ── Focus ────────────────────────────────────────────────────────────────── */

.swk-bar:focus {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
    z-index: 5;
}

.swk-bar:focus:not(:focus-visible) {
    outline: none;
}

.swk-bar:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
    z-index: 5;
}

/* Mode-specific focus colors */
[data-mode="kanji"] .swk-bar:focus-visible    { outline-color: #3B82F6; }
[data-mode="vocab"] .swk-bar:focus-visible    { outline-color: #10B981; }
[data-mode="radicals"] .swk-bar:focus-visible { outline-color: #C084FC; }
[data-mode="global"] .swk-bar:focus-visible   { outline-color: rgba(255, 255, 255, 0.8); }

/* ═══════════════════════════════════════════════════════════════════════════════
   Active state — the selected bar glows in mode color
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Default/Global — white */
.swk-bar.active {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.4);
}

/* Kanji — blue */
[data-mode="kanji"] .swk-bar.active {
    background: #3B82F6;
    box-shadow: 0 0 6px rgba(59, 130, 246, 0.5);
}

/* Vocab — green */
[data-mode="vocab"] .swk-bar.active {
    background: #10B981;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}

/* Radicals — purple */
[data-mode="radicals"] .swk-bar.active {
    background: #C084FC;
    box-shadow: 0 0 6px rgba(192, 132, 252, 0.5);
}

/* Global — bright white */
[data-mode="global"] .swk-bar.active {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.5);
}

/* Inactive bars — dimmed */
.swk-bar.inactive {
    background: var(--text-muted, rgba(255, 255, 255, 0.15));
    opacity: 0.35;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Hover
   ═══════════════════════════════════════════════════════════════════════════════ */

.swk-bar:hover {
    transform: scaleX(1.06);
}

.swk-bar.active:hover {
    filter: brightness(1.15);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Label — shows current state text (matches .lqs-label)
   ═══════════════════════════════════════════════════════════════════════════════ */

.swk-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted, rgba(255, 255, 255, 0.5));
    letter-spacing: 0.03em;
    white-space: nowrap;
    min-width: 36px;
    text-align: center;
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
}

/* Label highlights when filter is active — uses mode color */
.swk-label.filtered {
    color: rgba(255, 255, 255, 0.9);
}

[data-mode="kanji"] .swk-label.filtered    { color: #3B82F6; }
[data-mode="vocab"] .swk-label.filtered    { color: #10B981; }
[data-mode="radicals"] .swk-label.filtered { color: #C084FC; }
[data-mode="global"] .swk-label.filtered   { color: rgba(255, 255, 255, 0.9); }

/* ═══════════════════════════════════════════════════════════════════════════════
   Edge states
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Empty state — active bars go red when filter combo yields 0 items */
.swk-container.empty .swk-bar.active {
    background: rgba(239, 68, 68, 0.7) !important;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.4) !important;
}

.swk-container.empty .swk-label {
    color: rgba(239, 68, 68, 0.8) !important;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Tooltip — shows bar meaning on hover
   ═══════════════════════════════════════════════════════════════════════════════ */

.swk-tooltip {
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-secondary, #1a1a2e);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.15));
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 10px;
    color: var(--text-primary, #fff);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.swk-tooltip::after {
    content: '';
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 4px solid transparent;
    border-right-color: var(--border, rgba(255, 255, 255, 0.15));
}

.swk-bar:hover .swk-tooltip {
    opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════════════════════════════════════════ */

@media (max-width: 640px) {
    .swk-bars {
        gap: 2px;
    }

    .swk-bar {
        height: 4px;
    }

    .swk-bar:nth-child(1) { width: 32px; }
    .swk-bar:nth-child(2) { width: 22px; }
    .swk-bar:nth-child(3) { width: 12px; }

    .swk-label {
        font-size: 10px;
        min-width: 30px;
    }
}
