/* =====================================================
   Custom WooCommerce Filters — cqf-filters.css
   ===================================================== */

/* ── Mobile Filter Trigger Button (hidden on desktop) ── */
.cqf-filter-btn {
    display: none;
}

/* ── Overlay (hidden on desktop) ── */
.cqf-overlay {
    display: none;
}

/* ── Drawer header / footer (hidden on desktop) ── */
.cqf-drawer-header,
.cqf-drawer-footer {
    display: none;
}

/* Sidebar wrapper */
.cqf-sidebar {
    font-size: 14px;
    line-height: 1.5;
    color: #333;
}

.cqf-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 8px;
    padding: 0;
}

/* ── Sections ── */
.cqf-section {
    border-top: 1px solid #e5e5e5;
}

.cqf-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: none;
    border: none;
    padding: 14px 0;
    font-size: 14px;
    font-weight: 600;
    color: #222;
    cursor: pointer;
    text-align: left;
    gap: 8px;
}

.cqf-section-header:focus-visible {
    outline: 2px solid #2c2c2c;
    outline-offset: 2px;
}

/* Chevron arrow — drawn with CSS, no icon font needed */
.cqf-chevron {
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    border-right: 2px solid #555;
    border-top: 2px solid #555;
    transform: rotate(-45deg);
    transition: transform 0.2s ease;
    margin-top: 2px;
}

.cqf-section-header[aria-expanded="false"] .cqf-chevron {
    transform: rotate(135deg);
    margin-top: -4px;
}

.cqf-section-body {
    padding-bottom: 14px;
    overflow: hidden;
}

.cqf-section-body.cqf-collapsed {
    display: none;
}

/* ── Checkboxes ── */
.cqf-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    cursor: pointer;
    color: #444;
    transition: color 0.15s;
}

.cqf-option:hover {
    color: #000;
}

.cqf-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: #2c2c2c;
    border-radius: 3px;
}

.cqf-option-name {
    flex: 1;
}

.cqf-count {
    color: #999;
    font-size: 13px;
    white-space: nowrap;
}

/* ── Loading state ── */
.cqf-loading .products,
.cqf-loading ul.products {
    opacity: 0.45;
    pointer-events: none;
    transition: opacity 0.2s;
}

/* ── No results ── */
.cqf-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 32px 0;
    color: #666;
}

/* =====================================================
   MOBILE DRAWER  (≤ 767px only)
   ===================================================== */
@media (max-width: 767px) {

    /* Filter trigger button */
    .cqf-filter-btn {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 10px 18px;
        font-size: 14px;
        font-weight: 600;
        color: #222;
        background: #fff;
        border: 2px solid #222;
        border-radius: 4px;
        cursor: pointer;
        margin-bottom: 16px;
        transition: background 0.15s, color 0.15s;
    }

    .cqf-filter-btn:hover {
        background: #222;
        color: #fff;
    }

    .cqf-filter-icon {
        width: 16px;
        height: 16px;
        flex-shrink: 0;
    }

    /* Dimming overlay */
    .cqf-overlay {
        display: block !important;
        position: fixed !important;
        inset: 0;
        background: rgba(0, 0, 0, 0.45) !important;
        z-index: 2147483646 !important;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    .cqf-overlay.cqf-open {
        opacity: 1;
        pointer-events: auto;
    }

    /* Sidebar becomes a slide-in drawer */
    .cqf-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        width: 85% !important;
        max-width: 320px !important;
        z-index: 2147483647 !important; /* max possible z-index */
        background: #fff !important;
        overflow-y: auto;
        padding: 0 20px 20px;
        transform: translateX(-105%);
        transition: transform 0.3s ease;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
        display: flex;
        flex-direction: column;
    }

    .cqf-sidebar.cqf-open {
        transform: translateX(0);
    }

    /* Lock page scroll when drawer is open */
    body.cqf-drawer-open {
        overflow: hidden;
    }

    /* Drawer header */
    .cqf-drawer-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 18px 0 14px;
        border-bottom: 2px solid #e5e5e5;
        margin-bottom: 4px;
        flex-shrink: 0;
    }

    .cqf-drawer-title {
        font-size: 13px;
        font-weight: 700;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: #222;
    }

    .cqf-drawer-close {
        background: none;
        border: none;
        padding: 4px;
        cursor: pointer;
        color: #444;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .cqf-drawer-close svg {
        width: 20px;
        height: 20px;
    }

    .cqf-drawer-close:hover {
        color: #000;
    }

    /* Hide the "Filters" h3 title — drawer header replaces it */
    .cqf-sidebar .cqf-title {
        display: none;
    }

    /* Drawer footer with View Results button */
    .cqf-drawer-footer {
        display: block;
        padding: 16px 0 0;
        margin-top: auto;
        flex-shrink: 0;
    }

    .cqf-view-results {
        display: block;
        width: 100%;
        padding: 14px;
        background: #222;
        color: #fff;
        border: none;
        border-radius: 4px;
        font-size: 15px;
        font-weight: 600;
        cursor: pointer;
        text-align: center;
        transition: background 0.15s;
    }

    .cqf-view-results:hover {
        background: #000;
    }
}
