/**
 * SKI Decore - Catalog Left Sidebar Filters Stylesheet
 * File: /static/css/catalog-filters.css
 */

/* -------------------------------------------------------------
 * 1. Catalog Layout Grid (Sidebar + Main Content)
 * ------------------------------------------------------------- */
.catalog-layout-wrap {
    width: min(1480px, calc(100% - 48px));
    margin: 30px auto 60px;
    display: flex;
    gap: 32px;
    align-items: flex-start;
    box-sizing: border-box;
}

/* Backdrop for mobile drawer - hidden on desktop so it never takes up flex space or gap */
.catalog-sidebar-backdrop {
    display: none;
}

/* Sidebar flows naturally without internal scrollbar */
.catalog-sidebar-pane {
    width: 280px;
    flex-shrink: 0;
    height: auto;
    overflow: visible;
}

.catalog-main-pane {
    flex: 1;
    min-width: 0;
}

/* -------------------------------------------------------------
 * 2. Filter Card & Accordion Styling (Matching Reference Images)
 * ------------------------------------------------------------- */
.catalog-filter-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* Filter Group Items */
.filter-group-item {
    border-bottom: 1px solid #e5e7eb;
}

.filter-group-item:last-child {
    border-bottom: none;
}

.filter-group-header {
    width: 100%;
    background: transparent;
    border: none;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    text-align: left;
    transition: background-color 0.15s ease;
}

.filter-group-header:hover {
    background: #fafaf9;
}

.filter-header-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Orange active dot indicator (Matching Image 1) */
.filter-active-dot {
    display: none;
    width: 8px;
    height: 8px;
    background-color: #e57a28;
    border-radius: 50%;
    flex-shrink: 0;
}

.filter-active-dot.active {
    display: inline-block;
}

/* -------------------------------------------------------------
 * Top Filter Bar (Filters title + CLEAR ALL + Applied Chips) - Image 1 & 3
 * ------------------------------------------------------------- */
.filter-top-bar {
    border-bottom: 1px solid #e5e7eb;
}

.filter-top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px 12px;
}

.filter-title-group {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.filter-mobile-close-btn {
    display: none;
    background: transparent;
    border: none;
    padding: 0;
    font-size: 18px;
    color: #374151;
    cursor: pointer;
    line-height: 1;
}

.filter-main-title {
    font-size: 16px;
    font-weight: 700;
    color: #111827;
    margin: 0;
    letter-spacing: -0.2px;
}

.filter-clear-all-link {
    background: transparent;
    border: none;
    font-size: 12px;
    font-weight: 700;
    color: #e57a28;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    cursor: pointer;
    padding: 0;
    transition: color 0.15s ease;
}

.filter-clear-all-link:hover {
    color: #c46419;
    text-decoration: underline;
}

.filter-clear-all-link.is-hidden {
    display: none !important;
}

/* Active Applied Badges / Chips (Image 1 & 3) */
.filter-active-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 20px 14px;
}

.filter-active-chips.is-hidden {
    display: none !important;
}

.filter-applied-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    background: #f3f4f6;
    color: #374151;
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.3;
    transition: all 0.15s ease;
}

.filter-applied-chip:hover {
    background: #e5e7eb;
    color: #111827;
}

.chip-remove-btn {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    color: #6b7280;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease, transform 0.15s ease;
}

.chip-remove-btn:hover {
    color: #ef4444;
    transform: scale(1.15);
}

/* Quick Toggles (Fast Delivery & Clearance Sale) - Image 3 */
.filter-quick-toggles {
    padding: 10px 20px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-top: 1px solid #f3f4f6;
}

.filter-toggle-row {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    margin: 0;
    user-select: none;
}

.filter-toggle-switch {
    position: relative;
    width: 38px;
    height: 22px;
    display: inline-block;
    flex-shrink: 0;
}

.filter-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #d1d5db;
    border-radius: 22px;
    transition: background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: #ffffff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-toggle-switch input:checked + .toggle-slider {
    background-color: #e57a28;
}

.filter-toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(16px);
}

.toggle-label-text {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
}

.clearance-highlight {
    color: #dc2626 !important;
    font-weight: 600;
}

.filter-header-text {
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: 0.6px;
    color: #111827;
    text-transform: uppercase;
}

.filter-arrow {
    width: 15px;
    height: 15px;
    color: #222222;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    transform: rotate(0deg); /* Points DOWN (v) when OPEN */
    flex-shrink: 0;
}

.filter-group-header.collapsed .filter-arrow,
.filter-group-header[aria-expanded="false"] .filter-arrow {
    transform: rotate(180deg); /* Points UP (^) when COLLAPSED / CLOSED */
}

.filter-group-content {
    padding: 0 20px 20px;
    display: block;
}

.filter-group-content:not(.show),
.filter-group-content.collapse:not(.show) {
    display: none !important;
}

/* -------------------------------------------------------------
 * 3. Price Range Slider (Matching Image 1)
 * ------------------------------------------------------------- */
.filter-price-wrap {
    padding-top: 6px;
}

.filter-price-values {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 12px;
}

.range-slider-container {
    position: relative;
    height: 5px;
    margin: 16px 0 22px;
}

.slider-track {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: 4px;
    background: #e57a28;
}

.range-input {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    transform: translateY(-50%);
    background: transparent;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

.range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid #e57a28;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    pointer-events: auto;
    transition: transform 0.1s ease;
}

.range-input::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.range-input::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid #e57a28;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    pointer-events: auto;
}

.filter-price-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 14px;
}

.filter-apply-btn {
    background: #e57a28;
    color: #ffffff;
    border: none;
    padding: 7px 22px;
    border-radius: 4px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.filter-apply-btn:hover {
    background: #c46419;
}

.filter-reset-link {
    background: transparent;
    border: none;
    color: #4b5563;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    padding: 0;
    transition: color 0.15s ease;
}

.filter-reset-link:hover {
    color: #111827;
    text-decoration: underline;
}

/* -------------------------------------------------------------
 * 4. Checkbox & Radio Items (Matching Image 1)
 * ------------------------------------------------------------- */
.filter-options-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Checkbox (Multi-select) */
.filter-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    margin: 0;
    user-select: none;
}

.filter-checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.filter-checkbox-custom {
    width: 18px;
    height: 18px;
    border: 1.5px solid #d1d5db;
    border-radius: 3px;
    background: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.filter-checkbox-label:hover .filter-checkbox-custom {
    border-color: #9ca3af;
}

.filter-checkbox-label input[type="checkbox"]:checked + .filter-checkbox-custom {
    background: #e57a28;
    border-color: #e57a28;
}

.filter-checkbox-label input[type="checkbox"]:checked + .filter-checkbox-custom::after {
    content: "";
    width: 5px;
    height: 9px;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

/* Radio (Single Category Select) */
.filter-radio-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    margin: 0;
    user-select: none;
}

.filter-radio-label input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.filter-radio-custom {
    width: 18px;
    height: 18px;
    border: 1.5px solid #d1d5db;
    border-radius: 50%;
    background: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.filter-radio-label:hover .filter-radio-custom {
    border-color: #e57a28;
}

.filter-radio-label input[type="radio"]:checked + .filter-radio-custom {
    border-color: #e57a28;
    background: #ffffff;
}

.filter-radio-label input[type="radio"]:checked + .filter-radio-custom::after {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #e57a28;
}

.filter-item-name {
    font-size: 14px;
    color: #374151;
    line-height: 1.35;
    transition: color 0.15s ease;
}

.filter-checkbox-label:hover .filter-item-name,
.filter-radio-label:hover .filter-item-name {
    color: #111827;
}

.filter-checkbox-label input[type="checkbox"]:checked ~ .filter-item-name,
.filter-radio-label input[type="radio"]:checked ~ .filter-item-name {
    color: #111827;
    font-weight: 500;
}

/* -------------------------------------------------------------
 * 5. Swatch Circles (Color & Wood Finish - Matching Images 2 & 3)
 * ------------------------------------------------------------- */
/* Color Swatches */
.filter-color-swatch-circle {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.filter-checkbox-label:hover .filter-color-swatch-circle {
    transform: scale(1.12);
}

.filter-checkbox-label input[type="checkbox"]:checked ~ .filter-color-swatch-circle {
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #e57a28;
    transform: scale(1.08);
}

/* Wood Finish Swatches with Texture Image */
.filter-finish-thumb-wrap {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    overflow: hidden;
    display: inline-block;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.12);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.filter-finish-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.filter-finish-label:hover .filter-finish-thumb-wrap {
    transform: scale(1.12);
}

.filter-finish-label input[type="checkbox"]:checked ~ .filter-finish-thumb-wrap {
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #e57a28;
    transform: scale(1.08);
}

/* Show More / Show Less Button */
.filter-show-more-btn {
    background: transparent;
    border: none;
    color: #e57a28;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    margin-top: 8px;
    text-align: right;
    display: block;
    width: 100%;
    transition: color 0.15s ease;
}

.filter-show-more-btn:hover {
    color: #c46419;
    text-decoration: underline;
}

/* -------------------------------------------------------------
 * 6. Catalog Main Toolbar (Count on Left, Sort on Right)
 * ------------------------------------------------------------- */
.catalog-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 14px;
    border-bottom: 1px solid #ebe5dc;
    flex-wrap: wrap;
    gap: 14px;
}

.catalog-count-info {
    font-size: 14px;
    color: #4b5563;
    margin: 0;
}

.catalog-count-info strong {
    color: #111827;
    font-weight: 700;
}

.catalog-actions-group {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* Hide mobile filter trigger button completely on desktop */
.catalog-mobile-filter-trigger {
    display: none !important;
}

/* Sort By Select Pill (Image 4) */
.catalog-sort-select-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.catalog-sort-label {
    font-size: 13.5px;
    color: #374151;
    font-weight: 500;
    margin: 0;
    white-space: nowrap;
}

.catalog-sort-select {
    padding: 6px 32px 6px 14px;
    font-size: 13.5px;
    font-weight: 500;
    border: none;
    border-radius: 20px;
    background-color: #f3f4f6;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23374151' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 11px 9px;
    color: #1f2937;
    cursor: pointer;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.catalog-sort-select:focus {
    background-color: #ebebeb;
    box-shadow: 0 0 0 2px rgba(229, 122, 40, 0.2);
}

/* View As Capsule & Vertical Bars (Image 4) */
.catalog-view-as-wrap {
    display: inline-flex;
    align-items: center;
    gap: 9px;
}

.catalog-view-as-label {
    font-size: 13.5px;
    color: #374151;
    font-weight: 500;
    margin: 0;
    white-space: nowrap;
}

.view-as-capsule {
    display: inline-flex;
    align-items: center;
    background: #f3f4f6;
    border-radius: 20px;
    padding: 3px 5px;
    gap: 2px;
}

.grid-capsule-divider {
    width: 1px;
    height: 14px;
    background-color: #e5e7eb;
    margin: 0 1px;
}

.grid-view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2.5px;
    height: 28px;
    padding: 0 9px;
    border-radius: 16px;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.grid-view-btn:hover {
    background: rgba(0, 0, 0, 0.04);
}

.grid-view-btn.active {
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.grid-bar {
    width: 2.5px;
    height: 14px;
    border-radius: 2px;
    background-color: #9ca3af;
    transition: background-color 0.15s ease;
}

.grid-view-btn:hover .grid-bar {
    background-color: #4b5563;
}

.grid-view-btn.active .grid-bar {
    background-color: #111827;
}

/* Dynamic Grid Column Classes */
.products-grid.grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

.products-grid.grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

.category-grid.grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

.category-grid.grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

/* Category Grid alongside Left Sidebar */
.catalog-main-pane .category-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 22px;
    width: 100%;
}

.catalog-main-pane .category-section-heading {
    margin-bottom: 24px;
}

/* -------------------------------------------------------------
 * 7. Responsive Mobile Styles
 * ------------------------------------------------------------- */
@media (max-width: 991px) {
    .catalog-layout-wrap {
        width: calc(100% - 32px);
        margin: 20px auto 60px;
        flex-direction: column;
        gap: 0;
    }

    /* Show mobile filter trigger button only on screens <= 991px */
    .catalog-mobile-filter-trigger {
        display: inline-flex !important;
        align-items: center;
        gap: 6px;
        padding: 7px 14px;
        border-radius: 6px;
        background: #1f2937;
        color: #ffffff;
        font-size: 13px;
        font-weight: 600;
        border: none;
        cursor: pointer;
    }

    .filter-mobile-close-btn {
        display: inline-flex !important;
    }

    .catalog-sidebar-pane {
        position: fixed;
        top: 0;
        left: -320px;
        width: 300px;
        height: 100vh;
        max-height: 100vh;
        overflow-y: auto;
        z-index: 1050;
        background: #ffffff;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
        transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        padding: 20px;
    }

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

    .catalog-sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1040;
    }

    .catalog-sidebar-backdrop.is-open {
        display: block;
    }

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

    .catalog-actions-group {
        gap: 10px;
    }

    .category-grid.grid-cols-3,
    .category-grid.grid-cols-4,
    .catalog-main-pane .category-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 576px) {
    .products-grid.grid-cols-2,
    .products-grid.grid-cols-3,
    .products-grid {
        grid-template-columns: repeat(1, minmax(0, 1fr)) !important;
    }

    .category-grid.grid-cols-3,
    .category-grid.grid-cols-4,
    .catalog-main-pane .category-grid {
        grid-template-columns: repeat(1, minmax(0, 1fr)) !important;
    }

    .catalog-actions-group {
        width: 100%;
        justify-content: space-between;
    }

    .catalog-sort-select {
        padding-left: 10px;
        padding-right: 26px;
        font-size: 12.5px;
    }
}
