
.casablanca-shop-page {
    padding-top: 40px;
    padding-bottom: 60px;
}
.shop-layout {
    display: flex;
    gap: 24px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.shop-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: #fff;
    border: 1px solid var(--casablanca-border);
    border-radius: var(--casablanca-radius);
    padding: 20px;
    align-self: flex-start;
    position: sticky;
    top: calc(80px + var(--casablanca-admin-bar, 0px));
}
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--casablanca-border);
}
.sidebar-title {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--casablanca-text-primary);
}
.sidebar-close {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--casablanca-text-secondary);
    padding: 4px;
}

.sidebar-section {
    border-bottom: 1px solid var(--casablanca-border);
    padding-bottom: 12px;
    margin-bottom: 12px;
}
.sidebar-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}
.sidebar-section-toggle {
    all: unset;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 0;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--casablanca-text-primary);
}
.sidebar-section-toggle:focus-visible {
    outline: 2px solid var(--casablanca-brand);
    outline-offset: 2px;
}
.sidebar-section-name {
    flex: 1;
    text-align: start;
}
.sidebar-section-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-inline-end: 6px;
    /* Round counter, not a rectangle — intentionally exempt from --casablanca-radius. */
    border-radius: 9px;
    background: var(--casablanca-brand);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
/* The author display rule above outranks the UA [hidden] rule, so restate it. */
.sidebar-section-badge[hidden] {
    display: none;
}
.sidebar-chevron {
    transition: transform 0.2s ease;
    flex-shrink: 0;
}
.sidebar-section-toggle[aria-expanded="false"] .sidebar-chevron {
    transform: rotate(-90deg);
}
.sidebar-section-content {
    overflow: hidden;
    transition: max-height 0.25s ease;
}
.sidebar-section-toggle[aria-expanded="false"] + .sidebar-section-content {
    max-height: 0 !important;
}

.sidebar-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.sidebar-option {
    margin-bottom: 2px;
    position: relative;
}
.sidebar-option[data-depth="1"] { padding-inline-start: 18px; }
.sidebar-option[data-depth="2"] { padding-inline-start: 36px; }
.sidebar-option[data-depth="3"] { padding-inline-start: 54px; }

/* The native input stays focusable but invisible; the label is the control. */
.sidebar-checkbox-input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    pointer-events: none;
}
.sidebar-option-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    color: var(--casablanca-text-secondary);
    font-size: 0.8rem;
    line-height: 1.3;
    border-radius: var(--casablanca-radius);
    cursor: pointer;
}
.sidebar-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    border: 1.5px solid var(--casablanca-border);
    border-radius: var(--casablanca-radius);
    background: #fff;
}

.sidebar-checkbox svg {
    width: 10px;
    height: 10px;
    color: #fff;
    opacity: 0;
    transform: scale(0.6);
}

.sidebar-checkbox-input:checked + .sidebar-option-label .sidebar-checkbox {
    background: var(--casablanca-brand);
    border-color: var(--casablanca-brand);
}
.sidebar-checkbox-input:checked + .sidebar-option-label .sidebar-checkbox svg {
    opacity: 1;
    transform: scale(1);
}
.sidebar-checkbox-input:checked + .sidebar-option-label {
    color: var(--casablanca-brand);
    font-weight: 600;
}
.sidebar-checkbox-input:focus-visible + .sidebar-option-label .sidebar-checkbox {
    outline: 2px solid var(--casablanca-brand);
    outline-offset: 2px;
}
.sidebar-option-name {
    flex: 1;
    min-width: 0;
}
.sidebar-option-count {
    font-size: 0.7rem;
    opacity: 0.5;
    font-variant-numeric: tabular-nums;
}
.sidebar-option-count::before { content: '('; }
.sidebar-option-count::after  { content: ')'; }

/* Nothing matches this option under the current selection. */
.sidebar-option.is-empty > .sidebar-option-label {
    opacity: 0.4;
}

.sidebar-color-swatch-badge {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.15);
}

.sidebar-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 8px 0;
}
.sidebar-color-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.sidebar-color-item label {
    cursor: pointer;
    display: block;
    line-height: 0;
}
.sidebar-color-swatch {
    display: block;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.sidebar-checkbox-input:checked + label .sidebar-color-swatch {
    border-color: var(--casablanca-brand);
    box-shadow: 0 0 0 2px rgba(var(--casablanca-brand-rgb), 0.3);
}
.sidebar-checkbox-input:focus-visible + label .sidebar-color-swatch {
    outline: 2px solid var(--casablanca-brand);
    outline-offset: 2px;
}
.sidebar-color-text {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    font-size: 0.6rem;
    font-weight: 700;
    line-height: 1;
    color: var(--casablanca-text-secondary);
}
.sidebar-color-count {
    font-size: 0.65rem;
    opacity: 0.5;
    font-variant-numeric: tabular-nums;
}
.sidebar-color-item.is-empty {
    opacity: 0.4;
}

/* ── Toolbar: count, sort, page size ──────────────────────────────────── */
.shop-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--casablanca-border);
}
.shop-results-count {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--casablanca-text-secondary);
    font-variant-numeric: tabular-nums;
}
.shop-toolbar-controls {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-inline-start: auto;
}
.shop-control {
    display: flex;
    align-items: center;
    gap: 6px;
}
.shop-control-label {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--casablanca-text-secondary);
    white-space: nowrap;
}
.shop-control-select {
    /* Our own chevron instead of the browser's arrow, and side padding that
       grows with Site Identity → Corner Radius: at a large radius the ends
       become half-circles, and a fixed 8px left the text and the native arrow
       sitting inside the curve. --sel-pad is the text's inset; the chevron
       sits the same distance from the other end. */
    --sel-pad: clamp(10px, calc(var(--casablanca-radius, 5px) * 0.6 + 4px), 18px);
    appearance: none;
    -webkit-appearance: none;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--casablanca-text-primary);
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M19 9L12 15L5 9' stroke='%23111827' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: 11px 11px;
    background-position: right var(--sel-pad) center;
    border: 1px solid var(--casablanca-border);
    border-radius: var(--casablanca-radius);
    padding-block: 7px;
    padding-inline: var(--sel-pad) calc(var(--sel-pad) + 17px);
    max-width: 100%;
    cursor: pointer;
}
/* background-position has no logical keyword: mirror the chevron in RTL. */
[dir="rtl"] .shop-control-select {
    background-position: left var(--sel-pad) center;
}
.shop-control-select:focus-visible {
    outline: 2px solid var(--casablanca-brand);
    outline-offset: 1px;
}

/* ── Active filters, above the grid ───────────────────────────────────── */
.shop-active-filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}
.shop-active-filters[hidden] {
    display: none;
}
.shop-active-label {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--casablanca-text-secondary);
}
.shop-active-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.shop-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border: 1px solid var(--casablanca-border);
    border-radius: var(--casablanca-radius);
    background: rgba(var(--casablanca-brand-rgb), 0.06);
    color: var(--casablanca-brand);
    font-size: 0.7rem;
    font-weight: 600;
    font-family: inherit;
    line-height: 1.2;
    cursor: pointer;
}
.shop-chip svg {
    flex-shrink: 0;
    opacity: 0.7;
}
.shop-clear-filters {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--casablanca-brand);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
    white-space: nowrap;
}

/* Desktop: the sidebar is a sidebar, so the drawer's own slots collapse. */
.sidebar-sort-slot:empty,
.sidebar-footer {
    display: none;
}

.shop-products-area {
    flex: 1;
    min-width: 0;
}
.shop-products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    /* gap comes from product-card.css — one rhythm for every product grid */
}
.shop-products-area.is-filtering .shop-products-grid {
    opacity: 0.4;
    pointer-events: none;
}
.shop-products-area.is-filtering .shop-pagination {
    opacity: 0.4;
    pointer-events: none;
}
.shop-pagination {
    display: flex;
    justify-content: center;
    padding: 30px 0;
}
.shop-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--casablanca-border);
    border-radius: var(--casablanca-radius);
    text-decoration: none;
    color: var(--casablanca-text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    margin: 0 4px;
}
.shop-pagination .page-numbers.dots {
    border-color: transparent;
    cursor: default;
}
.shop-pagination .page-numbers.current {
    background: var(--casablanca-brand);
    border-color: var(--casablanca-brand);
    color: #fff;
}
.no-products-found {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--casablanca-text-secondary);
    font-size: 0.95rem;
}

.sidebar-mobile-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    /* Round counter, not a rectangle — intentionally exempt from --casablanca-radius. */
    border-radius: 9px;
    background: var(--casablanca-brand);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
}
.sidebar-mobile-count[hidden] {
    display: none;
}
.shop-filter-trigger {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: #fff;
    border: 1px solid var(--casablanca-border);
    border-radius: var(--casablanca-radius);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--casablanca-text-primary);
    cursor: pointer;
}
.shop-filter-trigger:focus-visible {
    outline: 2px solid var(--casablanca-brand);
    outline-offset: 2px;
}

@media (max-width: 1200px) and (min-width: 1024px) {
    .shop-products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1023px) {
    .casablanca-shop-page {
        padding-top: 20px;
        padding-bottom: 40px;
    }
    .shop-layout {
        flex-direction: column;
        gap: 0;
        padding: 0 12px;
    }
    .shop-sidebar {
        display: none;
        position: fixed;
        top: 0;
        inset-inline-start: 0;
        width: 300px;
        height: 100vh;
        height: 100dvh;
        z-index: 2000;
        border-radius: 0;
        border: none;
        border-inline-end: 1px solid var(--casablanca-border);
        overflow-y: auto;
        padding-top: 16px;
        background: #fff;
    }
    .shop-sidebar.is-open {
        display: flex;
        flex-direction: column;
    }
    .sidebar-close {
        display: flex;
    }
    .shop-filter-trigger {
        display: inline-flex;
        flex: 1 1 auto;
    }
    .shop-toolbar {
        justify-content: space-between;
        margin-bottom: 12px;
    }
    /* The selects are moved into the drawer at this width (see placeControls
       in shop-filter.js), so nothing is left to push to the end. */
    .shop-toolbar-controls {
        margin-inline-start: 0;
    }
    .sidebar-sort-slot {
        padding-bottom: 14px;
        margin-bottom: 4px;
        border-bottom: 1px solid var(--casablanca-border);
    }
    .sidebar-sort-slot .shop-toolbar-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .sidebar-sort-slot .shop-control {
        flex-direction: column;
        align-items: stretch;
        gap: 5px;
    }
    .sidebar-sort-slot .shop-control-select {
        width: 100%;
    }
    .sidebar-footer {
        display: block;
        position: sticky;
        bottom: 0;
        margin-top: auto;
        padding: 12px 0 4px;
        background: #fff;
    }
    .sidebar-apply {
        display: block;
        width: 100%;
        padding: 12px 16px;
        border: 1px solid var(--casablanca-brand);
        border-radius: var(--casablanca-radius);
        background: var(--casablanca-brand);
        color: #fff;
        font-family: inherit;
        font-size: 0.85rem;
        font-weight: 700;
        cursor: pointer;
    }
    .sidebar-apply:focus-visible {
        outline: 2px solid var(--casablanca-brand);
        outline-offset: 2px;
    }
    .shop-products-area {
        width: 100%;
    }
    .shop-products-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        width: 100%;
    }
    .shop-sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        inset-inline: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 1999;
    }
    .shop-sidebar-overlay.is-open {
        display: block;
    }
}

@media (max-width: 480px) {
    .casablanca-shop-page {
        padding-top: 15px;
        padding-bottom: 35px;
    }
    .shop-layout {
        padding: 0 8px;
    }
    .shop-products-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        width: 100%;
    }
    .shop-sidebar {
        width: 85vw;
        max-width: 320px;
    }
    .shop-filter-trigger {
        padding: 9px 12px;
        font-size: 0.78rem;
    }
    .shop-results-count {
        font-size: 0.72rem;
    }
}

.shop-sidebar .screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

/* Archive heading — woocommerce/archive-product.php. */
.shop-page-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}
.shop-page-header .shop-page-title {
    margin: 0;
    font-size: clamp(1.25rem, 1vw + 1rem, 1.75rem);
    font-weight: 700;
    line-height: 1.2;
    color: var(--casablanca-text-primary);
}
.shop-page-description {
    max-width: 72ch;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--casablanca-text-secondary);
}
.shop-page-description > :last-child {
    margin-bottom: 0;
}

/* iOS zooms a form control whose text is under 16px the moment it is focused,
   which would rescale the whole shop page. Same rule the admin panel uses. */
@media (max-width: 782px) {
    .shop-control-select {
        font-size: 16px;
    }
}
