/* ===== Search + Shop catalog — modern filter sidebar ===== */
body.is-search-page,
body.is-shop-page {
    --sf-bg: #f8f6f3;
    --sf-surface: #ffffff;
    --sf-ink: #1a1816;
    --sf-muted: #6b6560;
    --sf-line: rgba(26, 24, 22, 0.08);
    --sf-brand: var(--brand, #901e50);
    --sf-brand-soft: var(--brand-surface, #faf5f8);
    --sf-brand-ring: rgba(144, 30, 80, 0.22);
    --sf-radius: 16px;
    --sf-shadow: 0 8px 32px rgba(26, 24, 22, 0.08);
    --sf-sans: 'DM Sans', 'Inter', system-ui, sans-serif;
    background: var(--sf-bg);
}

.search-section,
.shop-section {
    padding: 14px 0 28px;
}

.search-section .container,
.shop-section .container {
    max-width: 1320px;
}

.search-layout,
.shop-layout {
    display: flex;
    align-items: flex-start;
    gap: 28px;
}

.search-sidebar,
.shop-sidebar {
    flex: 0 0 300px;
    width: 300px;
    position: sticky;
    top: calc(var(--shop-header-offset, 72px) + 12px);
    z-index: 5;
}

.search-main,
.shop-main {
    flex: 1;
    min-width: 0;
}

/* ----- Shop hero ----- */
.shop-hero {
    background:
        linear-gradient(135deg, rgba(144, 30, 80, 0.08) 0%, rgba(255, 255, 255, 0) 55%),
        var(--sf-bg, #f8f6f3);
    border-bottom: 1px solid var(--sf-line, rgba(26, 24, 22, 0.08));
    padding: 20px 0 16px;
}

.shop-hero__inner {
    max-width: 1320px;
}

.shop-hero__title {
    margin: 0 0 6px;
    font-family: var(--sf-sans);
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 800;
    color: var(--sf-ink);
    line-height: 1.15;
}

.shop-hero__subtitle {
    margin: 0 0 6px;
    font-size: 14px;
    color: var(--sf-muted);
    font-weight: 500;
    line-height: 1.45;
}

.shop-hero__count {
    margin: 0;
    font-size: 13px;
    color: var(--sf-brand);
    font-weight: 700;
}

/* ----- Toolbar ----- */
.search-toolbar,
.shop-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.search-toolbar__heading h1,
.shop-toolbar__title {
    font-family: var(--sf-sans);
    font-size: clamp(1.25rem, 2.5vw, 1.65rem);
    font-weight: 800;
    color: var(--sf-ink);
    margin: 0 0 4px;
    line-height: 1.25;
}

.search-toolbar__subtitle {
    margin: 0 0 4px;
    font-size: 14px;
    color: var(--sf-muted);
    font-weight: 500;
    line-height: 1.4;
}

.search-toolbar__count,
.shop-toolbar__count {
    margin: 0;
    font-size: 14px;
    color: var(--sf-muted);
    font-weight: 500;
}

.search-filter-open-btn,
.shop-filter-open-btn {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid var(--sf-line);
    background: var(--sf-surface);
    color: var(--sf-brand);
    font-family: var(--sf-sans);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(26, 24, 22, 0.06);
    flex-shrink: 0;
}

.search-filter-open-btn__badge,
.shop-filter-open-btn__badge,
.sf-panel__badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--sf-brand);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.search-filter-open-btn__badge.is-hidden,
.shop-filter-open-btn__badge.is-hidden,
.sf-panel__badge.is-hidden {
    display: none;
}

/* Active filter tags above grid */
.search-active-tags,
.shop-active-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.search-active-tags.is-hidden {
    display: none;
}

.sf-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px 6px 12px;
    border-radius: 999px;
    background: var(--sf-brand-soft);
    color: var(--sf-brand);
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--sf-brand-ring);
}

.sf-tag button {
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.7;
}

.sf-tag button:hover {
    opacity: 1;
}

/* ----- Filter panel ----- */
.sf-panel {
    background: var(--sf-surface);
    border-radius: var(--sf-radius);
    box-shadow: var(--sf-shadow);
    border: 1px solid var(--sf-line);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - var(--shop-header-offset, 72px) - 32px);
}

.sf-panel__head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 18px;
    background: linear-gradient(135deg, var(--sf-brand) 0%, var(--brand-dark, #6d133c) 100%);
    color: #fff;
}

.sf-panel__head-main {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.sf-panel__icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}

.sf-panel__title {
    margin: 0;
    font-family: var(--sf-sans);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.sf-panel__badge {
    background: #fff;
    color: var(--sf-brand);
}

.sf-panel__close {
    display: none;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    cursor: pointer;
    font-size: 16px;
}

.sf-panel__body {
    padding: 16px 18px;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

.sf-panel__foot {
    padding: 14px 18px 18px;
    border-top: 1px solid var(--sf-line);
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #fafafa;
}

.sf-block {
    margin-bottom: 18px;
}

.sf-block:last-child {
    margin-bottom: 0;
}

.sf-block__label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--sf-sans);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--sf-muted);
    margin-bottom: 10px;
}

.sf-block__label i {
    color: var(--sf-brand);
    font-size: 12px;
}

.sf-input-wrap {
    border: 1px solid var(--sf-line);
    border-radius: 12px;
    background: var(--sf-bg);
    padding: 0 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.sf-input-wrap:focus-within {
    border-color: var(--sf-brand);
    box-shadow: 0 0 0 3px var(--sf-brand-ring);
}

.sf-input {
    width: 100%;
    border: none;
    background: transparent;
    padding: 12px 0;
    font-family: var(--sf-sans);
    font-size: 14px;
    color: var(--sf-ink);
    min-height: 44px;
}

.sf-input:focus {
    outline: none;
}

/* Chips */
.sf-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sf-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--sf-line);
    background: var(--sf-bg);
    color: var(--sf-ink);
    font-family: var(--sf-sans);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.15s;
}

.sf-chip:hover {
    border-color: var(--sf-brand-ring);
    background: var(--sf-brand-soft);
}

.sf-chip.is-active {
    background: var(--sf-brand);
    border-color: var(--sf-brand);
    color: #fff;
    box-shadow: 0 4px 14px var(--sf-brand-ring);
}

.sf-chip--size {
    min-width: 44px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.sf-chip--rating i {
    font-size: 11px;
    color: #e8b923;
}

.sf-chip.is-active.sf-chip--rating i {
    color: #fff;
}

.sf-chips--price .sf-chip {
    font-size: 12px;
    padding: 8px 12px;
}

/* Color swatches */
.sf-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.sf-swatch {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--sf-line);
    background: var(--sf-bg);
    cursor: pointer;
    padding: 0;
    position: relative;
    transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s;
}

.sf-swatch--hex {
    background: var(--sf-swatch, #ddd);
}

.sf-swatch__dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ccc 45%, #888 55%);
    display: block;
    margin: auto;
}

.sf-swatch:hover {
    transform: scale(1.08);
}

.sf-swatch.is-active {
    border-color: var(--sf-brand);
    box-shadow: 0 0 0 3px var(--sf-brand-ring);
}

.sf-swatch.is-active::after {
    content: '';
    position: absolute;
    inset: -4px;
    border: 2px solid var(--sf-brand);
    border-radius: 50%;
    pointer-events: none;
}

/* Quick toggles */
.sf-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sf-toggle {
    cursor: pointer;
}

.sf-toggle input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.sf-toggle__pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px dashed var(--sf-line);
    background: var(--sf-bg);
    font-family: var(--sf-sans);
    font-size: 12px;
    font-weight: 600;
    color: var(--sf-ink);
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.sf-toggle input:checked + .sf-toggle__pill {
    background: var(--sf-brand-soft);
    border-color: var(--sf-brand);
    border-style: solid;
    color: var(--sf-brand);
}

.sf-toggle__pill i {
    font-size: 11px;
    opacity: 0.85;
}

/* Sort select */
.sf-select-wrap {
    position: relative;
}

.sf-select {
    width: 100%;
    appearance: none;
    border: 1px solid var(--sf-line);
    border-radius: 12px;
    background: var(--sf-bg);
    padding: 12px 40px 12px 14px;
    font-family: var(--sf-sans);
    font-size: 14px;
    font-weight: 600;
    color: var(--sf-ink);
    cursor: pointer;
}

.sf-select:focus {
    outline: none;
    border-color: var(--sf-brand);
    box-shadow: 0 0 0 3px var(--sf-brand-ring);
}

.sf-select-wrap__chev {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: var(--sf-muted);
    pointer-events: none;
}

.sf-btn-clear,
.sf-btn-apply {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    font-family: var(--sf-sans);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    border: none;
}

.sf-btn-clear {
    background: transparent;
    color: var(--sf-muted);
    border: 1px solid var(--sf-line);
}

.sf-btn-clear:hover {
    background: var(--sf-bg);
    color: var(--sf-ink);
}

.sf-btn-apply {
    display: none;
    background: var(--sf-brand);
    color: #fff;
    box-shadow: 0 4px 16px var(--sf-brand-ring);
}

.sf-backdrop {
    display: none;
}

.search-products__empty,
.shop-products__empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--sf-muted);
    font-size: 15px;
}

.search-products__empty.is-hidden,
.shop-products__empty.is-hidden {
    display: none;
}

.search-products__empty i,
.shop-products__empty i {
    display: block;
    font-size: 36px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.search-main .archive-grid.is-empty,
.shop-main .archive-grid.is-empty {
    display: none;
}

/* Product grid */
body.is-search-page .archive-grid > .lux-product-card,
body.is-shop-page .archive-grid > .lux-product-card,
.archive-grid.cat-products__grid > .lux-product-card {
    grid-column: auto;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
    flex: none !important;
    margin: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
}

body.is-search-page .archive-grid > .lux-product-card .lux-product-card__shell,
body.is-shop-page .archive-grid > .lux-product-card .lux-product-card__shell,
.archive-grid.cat-products__grid > .lux-product-card .lux-product-card__shell {
    flex: 1;
    width: 100%;
    min-height: 0;
}

body.is-search-page .archive-grid .lux-product-card__footer,
body.is-shop-page .archive-grid .lux-product-card__footer,
.archive-grid.cat-products__grid .lux-product-card__footer {
    flex: 1;
    display: flex;
    flex-direction: column;
}

body.is-search-page .archive-grid .lux-product-card__copy,
body.is-shop-page .archive-grid .lux-product-card__copy,
.archive-grid.cat-products__grid .lux-product-card__copy {
    margin-top: auto;
}

body.is-search-page .archive-grid .lux-product-card.is-filtered-out,
body.is-shop-page .archive-grid .lux-product-card.is-filtered-out {
    display: none !important;
}

.home-product-grid,
.cat-products__grid,
.archive-grid {
    row-gap: 10px;
    column-gap: 6px;
}

@media (min-width: 600px) {
    body.is-search-page .archive-grid,
    body.is-shop-page .archive-grid,
    .archive-grid.cat-products__grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 992px) {
    body.is-search-page .archive-grid,
    body.is-shop-page .archive-grid,
    .archive-grid.cat-products__grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1200px) {
    body.is-search-page .archive-grid,
    body.is-shop-page .archive-grid,
    .archive-grid.cat-products__grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* ----- Mobile filter drawer ----- */
@media (max-width: 991px) {
    .search-filter-open-btn,
    .shop-filter-open-btn {
        display: inline-flex;
    }

    .shop-hero__count {
        display: none;
    }

    .search-sidebar,
    .shop-sidebar {
        position: fixed;
        inset: 0;
        z-index: 1200;
        width: auto;
        flex: none;
        pointer-events: none;
        top: auto;
    }

    .sf-panel {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        max-height: min(88vh, 640px);
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
        transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
        pointer-events: auto;
        z-index: 1201;
    }

    .search-sidebar.is-open .sf-panel,
    .shop-sidebar.is-open .sf-panel {
        transform: translateY(0);
    }

    .sf-panel__close {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .sf-btn-apply {
        display: flex;
    }

    .sf-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(26, 24, 22, 0.45);
        backdrop-filter: blur(4px);
        z-index: 1200;
        opacity: 0;
        transition: opacity 0.3s;
        pointer-events: none;
    }

    .sf-backdrop.is-visible {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }

    body.search-filters-open,
    body.shop-filters-open {
        overflow: hidden;
    }
}

@media (max-width: 599px) {
    body.is-search-page .archive-grid,
    body.is-shop-page .archive-grid,
    .archive-grid.cat-products__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ===== Category page — shared filter sidebar ===== */
body.is-category-page {
    --sf-bg: #f8f6f3;
    --sf-surface: #ffffff;
    --sf-ink: #1a1816;
    --sf-muted: #6b6560;
    --sf-line: rgba(26, 24, 22, 0.08);
    --sf-brand: var(--brand, #901e50);
    --sf-brand-soft: var(--brand-surface, #faf5f8);
    --sf-brand-ring: rgba(144, 30, 80, 0.22);
    --sf-radius: 16px;
    --sf-shadow: 0 8px 32px rgba(26, 24, 22, 0.08);
    --sf-sans: 'DM Sans', 'Inter', system-ui, sans-serif;
}

.cat-products-layout {
    display: flex;
    align-items: flex-start;
    gap: 28px;
}

.cat-filter-sidebar {
    flex: 0 0 300px;
    width: 300px;
    position: sticky;
    top: calc(var(--shop-header-offset, 72px) + 12px);
    z-index: 5;
}

.cat-products-main {
    flex: 1;
    min-width: 0;
}

.cat-products-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.cat-products-toolbar__heading .cat-section-title {
    margin: 0 0 4px;
}

.cat-products-toolbar__heading .cat-section-sub {
    margin: 0;
    font-size: 14px;
    color: var(--sf-muted);
    font-weight: 500;
}

.cat-filter-open-btn {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid var(--sf-line);
    background: var(--sf-surface);
    color: var(--sf-brand);
    font-family: var(--sf-sans);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(26, 24, 22, 0.06);
    flex-shrink: 0;
}

.cat-filter-open-btn__badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--sf-brand);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cat-filter-open-btn__badge.is-hidden {
    display: none;
}

.cat-active-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.cat-active-tags.is-hidden {
    display: none;
}

.cat-products__empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--sf-muted);
    font-size: 15px;
}

.cat-products__empty i {
    font-size: 2rem;
    color: var(--sf-brand);
    opacity: 0.5;
    display: block;
    margin-bottom: 12px;
}

@media (max-width: 991px) {
    .cat-products-layout {
        display: block;
    }

    .cat-filter-open-btn {
        display: inline-flex;
    }

    .cat-filter-sidebar {
        position: fixed;
        inset: 0;
        z-index: 1200;
        width: auto;
        flex: none;
        pointer-events: none;
        top: auto;
        visibility: hidden;
    }

    .cat-filter-sidebar.is-open {
        visibility: visible;
        pointer-events: none;
    }

    .cat-filter-sidebar .sf-panel {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        max-height: min(88vh, 640px);
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
        transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
        pointer-events: auto;
        z-index: 1202;
    }

    .cat-filter-sidebar.is-open .sf-panel,
    .cat-filter-sidebar .sf-panel.is-drawer-open {
        transform: translateY(0) !important;
    }

    .cat-filter-sidebar .sf-panel__close {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .cat-filter-sidebar .sf-btn-apply {
        display: flex;
    }

    .cat-filter-sidebar .sf-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(26, 24, 22, 0.45);
        backdrop-filter: blur(4px);
        z-index: 1201;
        opacity: 0;
        transition: opacity 0.3s;
        pointer-events: none;
    }

    .cat-filter-sidebar .sf-backdrop.is-visible {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }

    body.cat-filters-open {
        overflow: hidden;
    }

    .cat-products-main {
        position: relative;
        z-index: 1;
        width: 100%;
    }
}

/* ===== Wishlist page ===== */
body.is-wishlist-page {
    --sf-bg: #f8f6f3;
    --sf-surface: #ffffff;
    --sf-ink: #1a1816;
    --sf-muted: #6b6560;
    --sf-line: rgba(26, 24, 22, 0.08);
    --sf-brand: var(--brand, #901e50);
    --sf-brand-soft: var(--brand-surface, #faf5f8);
    --sf-brand-ring: rgba(144, 30, 80, 0.22);
    --sf-radius: 16px;
    --sf-shadow: 0 8px 32px rgba(26, 24, 22, 0.08);
    --sf-sans: 'DM Sans', 'Inter', system-ui, sans-serif;
    background: var(--sf-bg);
}

.wishlist-page .wishlist-main {
    max-width: 1320px;
    margin: 0 auto;
}

.wishlist-page .is-hidden,
#wishlistPage .is-hidden {
    display: none !important;
}

.wishlist-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 48px 16px;
    color: var(--sf-muted, #6b6560);
    font-size: 15px;
    font-weight: 600;
}

.wishlist-loading i {
    color: var(--sf-brand, #901e50);
}
