/* ============================================================
   PRODUCTS LAYOUT & FILTER SIDEBAR
   ============================================================ */

/* Main layout — sidebar + grid side by side */
.products-layout {
    display: flex;
    gap: var(--space-6);
    position: relative;
    align-items: flex-start;
}

/* Filter toggle button — vertical tab on left edge (mobile/tablet only) */
.filter-toggle-btn {
    display: none;
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: calc(var(--z-sticky) - 1);
    background: var(--color-primary);
    color: white;
    border: none;
    width: 36px;
    height: 80px;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    cursor: pointer;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-family: var(--font-body);
    font-weight: var(--font-weight-semibold);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
}
.filter-toggle-btn:hover {
    background: var(--color-secondary);
    width: 42px;
}
.filter-toggle-btn i {
    writing-mode: horizontal-tb;
    font-size: 0.8rem;
}

/* Filter sidebar — sticky on desktop, drawer on mobile */
.filter-sidebar {
    width: 250px;
    flex-shrink: 0;
    position: sticky;
    top: 80px;
    background: var(--color-bg-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    max-height: calc(100vh - 100px);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: calc(var(--z-sticky) - 1);
}

/* Scrollable area for filter groups (below the sticky heading) */
.filter-scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4);
    padding-top: 0;
}

/* Filter heading — sticky, always visible above scrollable filters */
.filter-heading {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    color: var(--color-primary);
    padding: var(--space-4) var(--space-4) var(--space-3);
    border-bottom: 2px solid var(--color-secondary);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
    background: var(--color-bg-surface);
    margin-bottom: var(--space-4);
}
.filter-heading i {
    font-size: 1rem;
    color: var(--color-secondary);
}

/* Close button — sits inside the filter heading, top-right */
.filter-close-btn {
    background: var(--color-bg-surface-2);
    border: 1px solid var(--color-border);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    flex-shrink: 0;
}
.filter-close-btn:hover {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    transform: rotate(90deg);
}

/* Filter overlay — dark backdrop when drawer is open */
.filter-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: calc(var(--z-sticky) - 2);
    pointer-events: none;
}
.filter-overlay.active {
    display: block;
    pointer-events: auto;
}

/* Individual filter group */
.filter-group {
    margin-bottom: var(--space-4);
    border-bottom: 1px solid var(--color-border);
    padding-bottom: var(--space-3);
}
.filter-group:last-child { border-bottom: none; }

/* Filter group title — click to expand/collapse */
.filter-title {
    font-family: var(--font-alt);
    font-weight: 300;
    font-size: 0.85rem;
    padding: var(--space-3) var(--space-4);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--color-bg-surface-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
}
.filter-title:hover {
    border-color: var(--color-text-muted);
    transform: translateY(-1px);
}
.filter-group.active .filter-title {
    background-color: var(--color-bg-body);
    border-color: var(--color-secondary);
    box-shadow: 0 8px 25px rgba(74, 111, 165, 0.15);
}
.filter-title::after {
    content: '\f078';
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 0.7rem;
    color: var(--color-secondary);
    transition: transform 0.3s ease;
}
.filter-group.active .filter-title::after { transform: rotate(180deg); }

/* Filter options — hidden by default, expands when group is active */
.filter-options {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-height: 0;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    padding: 0 0.5rem;
}
.filter-group.active .filter-options {
    max-height: 600px;
    opacity: 1;
    padding: var(--space-3) 0.5rem;
}

/* Each filter option label */
.filter-options label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--color-text-main);
    transition: all 0.2s ease;
}
.filter-options label:hover {
    color: var(--color-secondary);
    transform: translateX(3px);
}

/* Custom checkbox */
.filter-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 1px solid var(--color-border);
    border-radius: 3px;
    background: var(--color-bg-surface-2);
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
}
.filter-checkbox:checked {
    background: var(--color-secondary);
    border-color: var(--color-secondary);
}
.filter-checkbox:checked::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 0.6rem;
}

/* Product grid */
.products-grid {
    flex-grow: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--space-4);
    align-items: start;
    width: 100%;
}
