/* ============================================================================
   62-views.css - the board's view switcher (Components/Board/ViewSwitcher) and the
   empty board's "hidden by the filter" line.

   THE BUTTON lives in the progress row (.aggregate-top) beside the report door. At rest it
   names the view ("All tasks"); with a filter on it turns violet, reads "Name - 3" and grows
   an x that takes everything off in one tap.

   THE PANEL is a fixed-size box that scrolls inside (search and footer pinned): opening it,
   adding a chip or saving a view never changes the height of the page, and the compose bar
   stays where it is. On a desktop it is a popover under the button, at most 360px wide. On a
   phone (720px and below) it is a bottom sheet over the foot of the tasks card. It is
   positioned inside .tasks (position: relative) and NOT fixed to the window: the card's
   reveal motion keeps will-change: transform on it, which makes it the containing block of
   anything fixed.

   Logical properties only, so Hebrew mirrors without a line in 95-rtl.css. Colours are the
   base tokens, so the dark theme needs no twin. Before 95-rtl and the dark theme in
   ChronosHead, like every component sheet.
   ============================================================================ */

/* ---- the button ---------------------------------------------------------------------------- */
.vs {
    position: relative;
    flex: none;
    min-width: 0;
}

.vs-pill {
    display: inline-flex;
    align-items: center;
    height: 34px;
    max-width: 230px;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    background: var(--chronos-chip-bg);
    color: var(--chronos-fg-muted);
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.vs-pill:hover {
    border-color: color-mix(in srgb, var(--hover-ink) var(--hover-lift), transparent);
}
.vs-pill.is-active {
    background: color-mix(in srgb, var(--chronos-violet) 12%, var(--chronos-card-bg));
    border-color: color-mix(in srgb, var(--chronos-violet) 38%, transparent);
    color: var(--chronos-violet);
}

.vs-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    height: 100%;
    padding-inline: 10px 8px;
    border: 0;
    border-radius: inherit;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    cursor: pointer;
}
.vs-pill.is-active .vs-trigger { padding-inline-end: 2px; }
.vs-ico, .vs-caret { flex: none; font-size: 18px; }
.vs-name {
    min-width: 0;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vs-clear {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    margin-inline-end: 4px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    cursor: pointer;
}
.vs-clear .material-icons { font-size: 16px; }
.vs-clear:hover { background: color-mix(in srgb, var(--chronos-violet) 16%, transparent); }

/* ---- the panel ----------------------------------------------------------------------------- */
.vs-scrim { display: none; }
.vs-grab { display: none; }

.vs-panel {
    position: absolute;
    z-index: 40;
    inset-block-start: calc(100% + 6px);
    inset-inline-end: 0;
    display: flex;
    flex-direction: column;
    width: min(360px, calc(100vw - 24px));
    /* 500, not 440: six quick views plus the saved list and its hint. At 440 the sixth view
       ("В работе") pushed the hint under the foot. */
    height: min(500px, calc(100vh - 220px));
    height: min(500px, calc(100dvh - 220px));
    min-height: 260px;
    overflow: hidden;
    border: 1px solid var(--chronos-outline);
    border-radius: 14px;
    background: var(--chronos-card-bg);
    color: var(--chronos-fg-primary);
    box-shadow: 0 14px 36px rgba(15, 17, 22, 0.2);
    animation: vs-pop 0.14s ease-out;
}
@keyframes vs-pop {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: none; }
}

.vs-search {
    flex: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-block-end: 1px solid var(--chronos-outline);
    color: var(--chronos-fg-muted);
}
.vs-search .material-icons { font-size: 20px; }
.vs-search-input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--chronos-fg-primary);
    font: inherit;
    font-size: var(--text-md);
}

.vs-scroll {
    flex: 1 1 0;
    min-height: 0;
    padding: 4px 8px 8px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
}

.vs-foot {
    flex: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 8px;
    border-block-start: 1px solid var(--chronos-outline);
}

/* ---- chips: what is filtering the board ---------------------------------------------------- */
.vs-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 4px 2px;
}
.vs-chip {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    max-width: 100%;
    padding-block: 2px;
    padding-inline: 10px 3px;
    border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--chronos-violet) 12%, var(--chronos-card-bg));
    color: var(--chronos-violet);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
}
.vs-chip-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.vs-chip-x {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    cursor: pointer;
}
.vs-chip-x .material-icons { font-size: 14px; }
.vs-chip-x:hover { background: color-mix(in srgb, var(--chronos-violet) 20%, transparent); }

/* ---- sections and rows --------------------------------------------------------------------- */
.vs-section {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 12px 8px 4px;
    color: var(--chronos-fg-muted);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.vs-count {
    font-weight: var(--weight-medium);
    letter-spacing: 0;
    text-transform: none;
}
.vs-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.vs-empty {
    margin: 4px 8px 8px;
    color: var(--chronos-fg-muted);
    font-size: var(--text-sm);
    line-height: 1.4;
}
.vs-full { margin: 4px 10px; }

.vs-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 36px;
    padding: 6px 8px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--chronos-fg-primary);
    font: inherit;
    font-size: var(--text-md);
    text-align: start;
    cursor: pointer;
}
.vs-row:hover { background: var(--chronos-hover-bg); }
.vs-row.is-current {
    background: color-mix(in srgb, var(--chronos-violet) 10%, var(--chronos-card-bg));
    color: var(--chronos-violet);
    font-weight: var(--weight-semibold);
}
.vs-row-ico { flex: none; font-size: 20px; color: var(--chronos-fg-muted); }
.vs-row.is-current .vs-row-ico { color: inherit; }
.vs-row-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.vs-tick { flex: none; font-size: 18px; }

.vs-saved {
    display: flex;
    align-items: center;
    gap: 2px;
}
.vs-saved .vs-row { flex: 1; min-width: 0; }

.vs-icon-btn {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--chronos-fg-muted);
    cursor: pointer;
}
.vs-icon-btn .material-icons { font-size: 18px; }
.vs-icon-btn:hover:not(:disabled) { background: var(--chronos-hover-bg); color: var(--chronos-fg-primary); }
.vs-icon-btn:disabled { opacity: 0.5; cursor: default; }

/* ---- rename, delete, save ------------------------------------------------------------------ */
.vs-edit, .vs-naming {
    display: flex;
    align-items: center;
    gap: 6px;
}
.vs-edit { padding: 2px 4px; }
.vs-naming { padding: 2px 2px 4px; }

.vs-name-input {
    flex: 1;
    min-width: 0;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--chronos-outline);
    border-radius: 8px;
    outline: none;
    background: var(--chronos-card-bg);
    color: var(--chronos-fg-primary);
    font: inherit;
    font-size: var(--text-md);
}
.vs-name-input:focus {
    border-color: var(--chronos-violet);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--chronos-violet) 18%, transparent);
}

.vs-delete {
    flex: none;
    height: 32px;
    padding: 0 10px;
    border: 1px solid color-mix(in srgb, var(--chronos-red) 45%, transparent);
    border-radius: 8px;
    background: transparent;
    color: var(--chronos-red);
    font: inherit;
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    cursor: pointer;
}
.vs-delete.is-armed {
    background: var(--chronos-red);
    border-color: var(--chronos-red);
    color: #fff;
}
.vs-delete:disabled { opacity: 0.5; cursor: default; }

.vs-save { flex: none; height: 34px; padding: 0 14px; }

.vs-foot-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 36px;
    padding: 6px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--chronos-fg-primary);
    font: inherit;
    font-size: var(--text-md);
    text-align: start;
    cursor: pointer;
}
.vs-foot-btn .material-icons { font-size: 20px; color: var(--chronos-fg-muted); }
.vs-foot-btn:hover { background: var(--chronos-hover-bg); }

/* The cap is reached and Plus would raise it: the Save row becomes this strip to /upgrade, the
   same pattern as a friend beyond the Free cap (.friend-locked-strip). */
.vs-upsell {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    min-height: 36px;
    padding: 6px 10px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--chronos-violet) 10%, var(--chronos-card-bg));
    color: var(--chronos-violet);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    text-decoration: none;
}
.vs-upsell .material-icons { font-size: 18px; }
.vs-upsell .tier-badge { margin-inline-start: 0; }
.vs-upsell-line { flex: 1 1 140px; min-width: 0; }
.vs-upsell:hover { background: color-mix(in srgb, var(--chronos-violet) 16%, var(--chronos-card-bg)); }

/* Off-screen, not display:none: popover-dismiss.js clicks it, and a synthetic click needs a
   rendered element. */
.vs-dismiss {
    position: absolute;
    inset-inline-start: -9999px;
    width: 1px;
    height: 1px;
    padding: 0;
    border: 0;
    opacity: 0;
}

/* ---- /studio: the panel drawn open, in the flow of the page --------------------------------- */
.vs.is-static { display: block; }
.vs.is-static .vs-pill { display: flex; width: max-content; }
.vs.is-static .vs-panel {
    position: relative;
    inset: auto;
    margin-block-start: 8px;
    animation: none;
}
.vs.is-static .vs-scrim, .vs.is-static .vs-grab { display: none; }

/* ---- the empty board: hidden by the filter -------------------------------------------------- */
.board-empty-reset { margin-block-start: 6px; }

/* ---- phones: the panel is a bottom sheet over the foot of the tasks card --------------------- */
@media (max-width: 720px) {
    /* No positioned box of its own: the sheet and the scrim resolve against .tasks. */
    .vs { position: static; }
    .vs.is-static { position: relative; }

    .vs-pill { height: 40px; max-width: 118px; }
    .vs-name { max-width: 58px; }
    .vs-caret { display: none; }
    .vs-trigger { gap: 4px; padding-inline: 8px 6px; }
    .vs-clear { width: 30px; height: 30px; }

    /* A 375px phone: the name took ~94px and left the day's progress bar a 30px stub. The
       button keeps only its icon (filter_list at rest, filter_alt with a filter on, plus the
       reset x); screen readers still get the button's aria-label. */
    @media (max-width: 480px) {
        .vs-pill { max-width: none; }
        .vs-name { display: none; }
        .vs-trigger { padding-inline: 9px; }
    }

    .vs-scrim {
        display: block;
        position: absolute;
        z-index: 39;
        inset: 0;
        border-radius: var(--radius-card);
        background: rgba(15, 17, 22, 0.38);
    }
    .vs-panel {
        inset-block: auto 0;
        inset-inline: 0;
        width: auto;
        height: min(72%, 470px);
        min-height: 300px;
        border-radius: 18px 18px var(--radius-card) var(--radius-card);
        border-block-end: 0;
        animation: vs-sheet 0.18s ease-out;
    }
    @keyframes vs-sheet {
        from { transform: translateY(24px); opacity: 0; }
        to { transform: none; opacity: 1; }
    }
    .vs-grab {
        display: block;
        flex: none;
        width: 38px;
        height: 4px;
        margin: 8px auto 0;
        border-radius: var(--radius-pill);
        background: var(--chronos-outline);
    }
    .vs-search { padding-block: 8px; }

    .vs-row { min-height: 44px; }
    .vs-icon-btn { width: 40px; height: 40px; }
    .vs-foot-btn, .vs-upsell { min-height: 44px; }
    .vs-name-input { height: 40px; }
    .vs-delete { height: 40px; }
    .vs-save { height: 40px; }
    .vs-chip-x { width: 28px; height: 28px; }

    .vs.is-static .vs-panel {
        inset: auto;
        width: 100%;
        height: 440px;
        border-radius: 18px;
        border-block-end: 1px solid var(--chronos-outline);
        animation: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .vs-panel { animation: none; }
    .vs-pill { transition: none; }
}
