/* ===========================
   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: #fff;
    max-width: 1280px;
    margin: 0 auto;
}

.catalog-header__title {
    margin: 0;
    font-size: 1.75rem;
    color: #111827;
}

/* Filter Toggle Button (Mobile/Tablet) */
.filter-toggle {
    display: none; /* Hidden on desktop */
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--ub-navy, #00293D);
    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-navy-light, #00446a);
}

.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: #fff;
    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: #fff;
    z-index: 10;
}

.catalog-sidebar__header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: #111827;
}

.catalog-sidebar__close {
    display: none; /* Hidden on desktop */
    background: none;
    border: none;
    font-size: 20px;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
}

.catalog-sidebar__close:hover {
    color: #111827;
}

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

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

.filter-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.filter-input,
.filter-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    color: #111827;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

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

.filter-input::placeholder {
    color: #9ca3af;
}

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

.filter-apply {
    width: 100%;
    padding: 12px;
    background: var(--ub-magenta, #CE2984);
    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-magenta-dark, #a82070);
}

.filter-reset {
    display: block;
    text-align: center;
    padding: 10px;
    color: #6b7280;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
}

.filter-reset:hover {
    color: #111827;
    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: #111827;
}

/* 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: #f3f4f6;
}

.catalog-sidebar::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.catalog-sidebar::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

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

.taxonomy-section {
    border-bottom: 1px solid #f0f0f0;
}

.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: #374151;
    text-align: left;
    gap: 6px;
}

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

.taxonomy-section__toggle:hover {
    color: #185FA5;
}

.taxonomy-chevron {
    font-size: 10px;
    transition: transform 0.2s;
    color: #9ca3af;
}

.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: #4b5563;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s;
}

.taxonomy-item__label:hover {
    background: #f3f4f6;
    color: #111;
}

.taxonomy-item__label input[type="checkbox"] {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    accent-color: #185FA5;
    cursor: pointer;
}

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

.taxonomy-count {
    font-size: 11px;
    color: #9ca3af;
    font-weight: 400;
}

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

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