/* ============================================================
   Catalog page (#/catalog) — layout, filter sidebar, chips,
   dual-thumb price range, mobile filter sheet. Prefix: cat-
   (`.cat-nav*` in base.css is the header nav — not used here.)
   ============================================================ */

/* ---------------- layout ---------------- */

.cat-layout {
    display: grid;
    grid-template-columns: 268px minmax(0, 1fr);
    gap: 36px;
    align-items: start;
}

.cat-side {
    position: sticky;
    top: calc(var(--header-h) + 20px);
    max-height: calc(100vh - var(--header-h) - 40px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 2px 10px 24px 2px;
    scrollbar-width: thin;
}

/* ---------------- filter panel ---------------- */

.cat-panel { display: flex; flex-direction: column; }

.cat-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 10px;
}
.cat-panel__title {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
}
.cat-panel__clear {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--gold-deep);
    transition: color 0.2s ease;
}
.cat-panel__clear:hover { text-decoration: underline; }
[data-theme="dark"] .cat-panel__clear { color: var(--gold-soft); }

.cat-panel__skel { display: flex; flex-direction: column; gap: 14px; padding-top: 8px; }

.cat-group { border-top: 1px solid var(--hairline); }
.cat-group__head {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-block: 14px;
    font-size: 12.5px;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    text-align: left;
    color: var(--text);
    transition: color 0.2s ease;
}
.cat-group__head:hover { color: var(--gold-deep); }
[data-theme="dark"] .cat-group__head:hover { color: var(--gold-soft); }
.cat-group__chev svg {
    width: 15px;
    height: 15px;
    color: var(--text-3);
    transition: transform 0.3s var(--ease-out);
}
.cat-group.is-open .cat-group__chev svg { transform: rotate(90deg); }
.cat-group__body { display: none; padding-bottom: 18px; }
.cat-group.is-open > .cat-group__body { display: block; animation: cat-fade 0.35s var(--ease-out); }

@keyframes cat-fade {
    from { opacity: 0; transform: translateY(-4px); }
}

/* ---------------- category list ---------------- */

.cat-cats { display: flex; flex-direction: column; gap: 2px; }
.cat-catrow {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 10px;
    border-radius: var(--r-sm);
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    color: var(--text-2);
    transition: color 0.2s ease, background 0.2s ease;
}
.cat-catrow:hover { color: var(--text); background: var(--surface); }
.cat-catrow.is-active {
    color: var(--text);
    font-weight: 800;
    background: rgba(241, 164, 36, 0.12);
}
.cat-catrow__chev svg {
    width: 14px;
    height: 14px;
    color: var(--text-3);
    transition: transform 0.25s var(--ease-out), color 0.2s ease;
}
.cat-catrow.is-active .cat-catrow__chev svg { transform: rotate(90deg); color: var(--gold); }

.cat-subs {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin: 3px 0 8px;
    padding-left: 10px;
    animation: cat-fade 0.3s var(--ease-out);
}

/* ---------------- checkbox rows ---------------- */

.cat-checks { display: flex; flex-direction: column; gap: 1px; }
.cat-check {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: var(--r-sm);
    font-size: 14px;
    color: var(--text-2);
    cursor: pointer;
    user-select: none;
    transition: color 0.2s ease, background 0.2s ease;
}
.cat-check:hover { color: var(--text); background: var(--surface); }
.cat-check__input { position: absolute; opacity: 0; pointer-events: none; }
.cat-check__box {
    width: 19px;
    height: 19px;
    flex: 0 0 19px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: 1.5px solid var(--hairline-strong);
    background: var(--surface);
    transition: background 0.22s var(--ease-spring), border-color 0.22s ease, box-shadow 0.22s ease;
}
.cat-check__box .icon svg {
    width: 12px;
    height: 12px;
    color: #221803;
    opacity: 0;
    transform: scale(0.4);
    transition: opacity 0.2s ease, transform 0.22s var(--ease-spring);
}
.cat-check__input:checked + .cat-check__box {
    background: var(--gold-grad);
    border-color: transparent;
    box-shadow: var(--shadow-gold);
}
.cat-check__input:checked + .cat-check__box .icon svg { opacity: 1; transform: none; }
.cat-check__input:checked ~ .cat-check__label { color: var(--text); font-weight: 700; }
.cat-check__thumb {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border-radius: 6px;
    object-fit: cover;
    background: var(--surface-2);
}
.cat-check__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------- size chips / colour swatches ---------------- */

.cat-sizechips { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 2px; }

.cat-swatches { display: flex; flex-wrap: wrap; gap: 10px; padding: 4px 2px 2px; }
.cat-swatch {
    position: relative;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--cat-sw, var(--surface-2));
    border: 1px solid var(--hairline-strong);
    box-shadow: inset 0 0 0 2px var(--surface);
    transition: transform 0.22s var(--ease-spring), box-shadow 0.22s ease;
}
.cat-swatch:hover { transform: scale(1.12); }
.cat-swatch.is-active {
    transform: scale(1.08);
    box-shadow: inset 0 0 0 2px var(--surface), 0 0 0 2px var(--gold);
}
.cat-swatch .icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.18s ease;
}
.cat-swatch .icon svg {
    width: 14px;
    height: 14px;
    color: #fff;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.75));
}
.cat-swatch.is-active .icon { opacity: 1; }

/* ---------------- price ---------------- */

.cat-price { display: flex; flex-direction: column; gap: 20px; padding-top: 6px; }
.cat-price__inputs { display: flex; align-items: center; gap: 8px; }
.cat-price__field { flex: 1; min-width: 0; height: 44px; padding: 0 12px; }
.cat-price__field .field__input { font-size: 13.5px; }
.cat-price__field .field__input::-webkit-outer-spin-button,
.cat-price__field .field__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cat-price__field .field__input { -moz-appearance: textfield; appearance: textfield; }
.cat-price__dash { color: var(--text-3); flex: 0 0 auto; }

.cat-range { position: relative; height: 24px; margin-inline: 4px 6px; }
.cat-range__rail {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 4px;
    transform: translateY(-50%);
    border-radius: 2px;
    background: var(--hairline-strong);
}
.cat-range__fill {
    position: absolute;
    top: 50%;
    height: 4px;
    transform: translateY(-50%);
    border-radius: 2px;
    background: var(--gold-grad);
    box-shadow: 0 0 8px rgba(241, 164, 36, 0.4);
}
.cat-range input[type="range"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 24px;
    margin: 0;
    background: none;
    -webkit-appearance: none;
    appearance: none;
    pointer-events: none; /* only the thumbs are interactive */
    outline: none;
}
.cat-range input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    pointer-events: auto;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--surface);
    border: 2.5px solid var(--gold);
    box-shadow: var(--shadow-card);
    cursor: grab;
    transition: transform 0.2s var(--ease-spring), box-shadow 0.2s ease;
}
.cat-range input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.18); }
.cat-range input[type="range"]:active::-webkit-slider-thumb {
    cursor: grabbing;
    transform: scale(1.22);
    box-shadow: var(--shadow-gold);
}
.cat-range input[type="range"]::-moz-range-thumb {
    pointer-events: auto;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: var(--surface);
    border: 2.5px solid var(--gold);
    box-shadow: var(--shadow-card);
    cursor: grab;
}
.cat-range input[type="range"]::-moz-range-track { background: none; }

/* ---------------- discount switch ---------------- */

.cat-switch {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 2px;
    border-top: 1px solid var(--hairline);
    cursor: pointer;
    user-select: none;
}
.cat-switch__label { font-size: 13px; font-weight: 800; letter-spacing: 0.02em; }
.cat-switch__input { position: absolute; opacity: 0; pointer-events: none; }
.cat-switch__track {
    position: relative;
    width: 42px;
    height: 24px;
    flex: 0 0 42px;
    border-radius: var(--r-pill);
    background: var(--hairline-strong);
    transition: background 0.25s ease, box-shadow 0.25s ease;
}
.cat-switch__knob {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: transform 0.28s var(--ease-spring);
}
.cat-switch__input:checked + .cat-switch__track {
    background: var(--gold-grad);
    box-shadow: var(--shadow-gold);
}
.cat-switch__input:checked + .cat-switch__track .cat-switch__knob { transform: translateX(18px); }

/* ---------------- toolbar ---------------- */

.cat-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.cat-count {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-2);
    transition: opacity 0.25s ease;
    min-height: 20px;
}
.cat-count--busy { opacity: 0.35; }
.cat-toolbar__actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.cat-sort {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 32px 0 14px;
    border: 1.5px solid var(--hairline-strong);
    border-radius: var(--r-pill);
    background: var(--surface);
    cursor: pointer;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.cat-sort:focus-within {
    border-color: var(--gold);
    box-shadow: 0 0 0 4px rgba(241, 164, 36, 0.14);
}
.cat-sort__label {
    font-size: 11.5px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-3);
    white-space: nowrap;
}
.cat-sort__select {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    background: none;
    outline: none;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    max-width: 190px;
    padding: 0;
}
.cat-sort__chev { position: absolute; right: 12px; pointer-events: none; }
.cat-sort__chev svg { width: 14px; height: 14px; transform: rotate(90deg); color: var(--text-3); }

.cat-fbtn {
    display: none;
    position: relative;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding-inline: 16px;
    border: 1.5px solid var(--hairline-strong);
    border-radius: var(--r-pill);
    background: var(--surface);
    font-size: 13.5px;
    font-weight: 700;
    transition: border-color 0.25s ease, transform 0.2s var(--ease-spring);
}
.cat-fbtn:hover { border-color: var(--gold); }
.cat-fbtn:active { transform: scale(0.96); }
.cat-fbtn .icon svg { width: 16px; height: 16px; }
.cat-fbtn__badge {
    display: none;
    min-width: 18px;
    height: 18px;
    padding-inline: 5px;
    border-radius: 9px;
    align-items: center;
    justify-content: center;
    background: var(--gold-grad);
    color: #221803;
    font-size: 11px;
    font-weight: 800;
    animation: cat-chip-in 0.3s var(--ease-spring);
}
.cat-fbtn__badge.is-on { display: inline-flex; }

/* ---------------- active-filter chips ---------------- */

.cat-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
}
.cat-chips.is-empty { display: none; }
.cat-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 32px;
    padding-inline: 12px;
    border-radius: var(--r-pill);
    background: var(--surface);
    border: 1.5px solid var(--hairline-strong);
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    animation: cat-chip-in 0.32s var(--ease-spring);
    transition: border-color 0.2s ease, color 0.2s ease;
}
.cat-chip:hover { border-color: var(--danger); color: var(--danger); }
.cat-chip .icon svg { width: 12px; height: 12px; color: var(--text-3); transition: color 0.2s ease; }
.cat-chip:hover .icon svg { color: var(--danger); }
.cat-chip--out { transform: scale(0.6); opacity: 0; transition: transform 0.16s ease-in, opacity 0.16s ease-in; }
.cat-chip__label { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-chip__dot {
    width: 12px;
    height: 12px;
    flex: 0 0 12px;
    border-radius: 50%;
    border: 1px solid var(--hairline-strong);
}
.cat-chips__clear {
    margin-left: 4px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-2);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.2s ease;
}
.cat-chips__clear:hover { color: var(--danger); }

@keyframes cat-chip-in {
    from { transform: scale(0.6); opacity: 0; }
}

/* ---------------- grid / show more ---------------- */

.cat-gridwrap { min-height: 320px; }

.cat-more {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-block: 32px 8px;
}
.cat-more:empty { display: none; }
.cat-more__meta { font-size: 13px; font-weight: 600; color: var(--text-3); }
.cat-more__btn { min-width: 230px; }

/* ---------------- mobile filter sheet ---------------- */

.cat-sheet {
    position: fixed;
    inset: 0;
    z-index: 130;
    background: var(--overlay);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s;
}
.cat-sheet.is-open { opacity: 1; visibility: visible; }
.cat-sheet__panel {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(360px, 92vw);
    display: flex;
    flex-direction: column;
    background: var(--bg);
    box-shadow: var(--shadow-pop);
    transform: translateX(-102%);
    transition: transform 0.42s var(--ease-out);
}
.cat-sheet.is-open .cat-sheet__panel { transform: none; }
.cat-sheet__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 16px 18px 10px;
}
.cat-sheet__title { font-family: var(--font-display); font-size: 22px; font-weight: 700; }
.cat-sheet__close {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--hairline);
    transition: transform 0.2s var(--ease-spring);
}
.cat-sheet__close:active { transform: scale(0.9); }
.cat-sheet__close svg { width: 16px; height: 16px; }
.cat-sheet__body {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 4px 18px 20px;
}
/* the shared panel hides its desktop head inside the sheet (the sheet has its own) */
.cat-sheet__body .cat-panel__head { display: none; }
.cat-sheet__foot {
    display: flex;
    gap: 10px;
    padding: 12px 18px calc(14px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--hairline);
    background: var(--surface);
}
.cat-sheet__foot .btn { flex: 1; }

/* ---------------- responsive ---------------- */

@media (max-width: 960px) {
    .cat-layout { grid-template-columns: 1fr; gap: 0; }
    .cat-side { display: none; }
    .cat-fbtn { display: inline-flex; }
    .cat-toolbar__actions { margin-left: 0; width: 100%; justify-content: space-between; }
    .cat-count { width: 100%; }
}

@media (max-width: 480px) {
    .cat-sort__label { display: none; }
    .cat-sort__select { max-width: 150px; }
    .cat-chip__label { max-width: 140px; }
}
