/* ===========================
   CATALOG FILTERS - SIDEBAR LAYOUT
   =========================== */

/* Overall Page Layout */
.catalog-page {
    padding-bottom: var(--section-margin-bottom, 40px);
}

.catalog-header {
    display: none; /* Hidden on desktop, shown on mobile/tablet */
    justify-content: flex-end;
    align-items: center;
    padding: 16px 20px;
    background: var(--ub-white);
    max-width: 1280px;
    margin: 0 auto;
}

.catalog-header__title {
    margin: 0;
    font-size: 1.75rem;
    color: var(--ub-navy);
}

/* Filter Toggle Button (Mobile/Tablet) */
.filter-toggle {
    display: none; /* Hidden on desktop */
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--ub-filter-toggle-bg);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.filter-toggle:hover {
    background: var(--ub-filter-toggle-hover-bg);
}

.filter-toggle i {
    font-size: 16px;
}

/* Catalog Layout - Sidebar + Main */
.catalog-layout {
    display: flex;
    gap: 24px;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0;
}

/* Sidebar Filters */
.catalog-sidebar {
    width: 280px;
    flex-shrink: 0;
    background: var(--ub-white);
    position: sticky;
    top: 195px;
    align-self: flex-start;
    max-height: calc(100vh - 195px);
    overflow-y: auto;
    overflow-x: hidden;
}

.catalog-sidebar__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    position: sticky;
    top: 0;
    background: var(--ub-white);
    z-index: 10;
}

.catalog-sidebar__header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--ub-navy);
}

.catalog-sidebar__close {
    display: none; /* Hidden on desktop */
    background: none;
    border: none;
    font-size: 20px;
    color: var(--ub-grey-dark);
    cursor: pointer;
    padding: 4px;
}

.catalog-sidebar__close:hover {
    color: var(--ub-navy);
}

/* Filter Form */
.catalog-filters {
    padding: 20px;
}

.filter-group {
    margin-bottom: 24px;
}

.filter-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--ub-navy);
    margin-bottom: 8px;
}

.filter-input,
.filter-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--ub-grey-light);
    border-radius: 6px;
    font-size: 14px;
    color: var(--ub-navy);
    background: var(--ub-white);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.filter-input:focus,
.filter-select:focus {
    outline: none;
    border-color: var(--ub-navy);
    box-shadow: 0 0 0 3px rgba(0, 41, 61, 0.1);
}

.filter-input::placeholder {
    color: var(--ub-grey-medium);
}

/* Filter Actions */
.filter-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 20px;
}

.filter-apply {
    width: 100%;
    padding: 12px;
    background: var(--ub-filter-apply-bg);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.filter-apply:hover {
    background: var(--ub-filter-apply-hover-bg);
}

.filter-reset {
    display: block;
    text-align: center;
    padding: 10px;
    color: var(--ub-filter-reset-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
}

.filter-reset:hover {
    color: var(--ub-navy);
    text-decoration: none;
}

/* Main Content Area */
.catalog-main {
    flex: 1;
    min-width: 0; /* Prevent flex item from overflowing */
    padding: 20px 20px 0 20px;
}

.products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.products-header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--ub-navy);
}

/* Tablet Styles (768px - 1024px) */
@media (max-width: 1024px) {
    .catalog-header {
        display: flex;
    }

    .filter-toggle {
        display: flex;
    }

    .catalog-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 320px;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease;
        box-shadow: none;
    }

    .catalog-sidebar.is-open {
        left: 0;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    .catalog-sidebar__close {
        display: block;
    }

    .catalog-layout {
        padding: 0;
    }

    .catalog-main {
        width: 100%;
    }
}

/* Mobile Styles (max-width: 767px) */
@media (max-width: 767px) {
    .catalog-header {
        padding: 16px;
    }

    .catalog-header__title {
        font-size: 1.5rem;
    }

    .catalog-sidebar {
        width: 100%;
        left: -100%;
    }

    .catalog-sidebar.is-open {
        left: 0;
    }

    .catalog-main {
        padding: 0 16px;
    }

    .products-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .products-header h2 {
        font-size: 1.125rem;
    }
}

/* Sidebar Overlay (for mobile/tablet) */
.catalog-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.catalog-overlay.is-active {
    display: block;
    opacity: 1;
}

/* Smooth scrolling for sidebar */
.catalog-sidebar::-webkit-scrollbar {
    width: 6px;
}

.catalog-sidebar::-webkit-scrollbar-track {
    background: var(--ub-grey-ultralight);
}

.catalog-sidebar::-webkit-scrollbar-thumb {
    background: var(--ub-grey-light);
    border-radius: 3px;
}

.catalog-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--ub-grey-medium);
}

/* ─── Taxonomy filter ─────────────────────────────────────────────────────── */
.filter-group--taxonomy {
    padding-top: 0;
}

.taxonomy-section {
    border-bottom: 1px solid var(--ub-grey-ultralight);
}

.taxonomy-section:last-child {
    border-bottom: none;
}

.taxonomy-section__toggle {
    display: flex;
    align-items: center;
    width: 100%;
    background: none;
    border: none;
    padding: 9px 0;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--ub-navy);
    text-align: left;
    gap: 6px;
}

.taxonomy-section__toggle span:first-child {
    flex: 1;
}

.taxonomy-section__toggle:hover {
    color: var(--ub-blue);
}

.taxonomy-chevron {
    font-size: 10px;
    transition: transform 0.2s;
    color: var(--ub-grey-medium);
}

.taxonomy-section__toggle[aria-expanded="true"] .taxonomy-chevron {
    transform: rotate(180deg);
}

.taxonomy-section__body {
    padding: 2px 0 8px 4px;
}

.taxonomy-item {
    margin-bottom: 2px;
}

.taxonomy-item__label {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 4px 2px;
    font-size: 13px;
    color: var(--ub-grey-dark);
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s;
}

.taxonomy-item__label:hover {
    background: var(--ub-grey-ultralight);
    color: var(--ub-navy);
}

.taxonomy-item__label input[type="checkbox"] {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    accent-color: var(--ub-blue);
    cursor: pointer;
}

.taxonomy-item__label span:nth-child(2) {
    flex: 1;
}

.taxonomy-count {
    font-size: 11px;
    color: var(--ub-grey-medium);
    font-weight: 400;
}

.taxonomy-children {
    padding-left: 20px;
    margin-top: 2px;
}

.taxonomy-item__label--child {
    font-size: 12.5px;
}

/* ── Color filter swatch grid (replaces the dropdown) ─────────────── */
.filter-color-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.filter-color-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 2px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease;
}
.filter-color-cell:hover { background: #F4F6FB; }
.filter-color-cell.is-active {
    background: #EAF2FB;
    border-color: var(--ub-blue, #185fa5);
}
.filter-color-cell__dot {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.12);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}
.filter-color-cell.is-active .filter-color-cell__dot {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ub-blue, #185fa5);
}
.filter-color-cell__name {
    font-size: 11px;
    color: var(--ub-text, #00293D);
    font-weight: 500;
}
