/* ── DCM Filter Sidebar ───────────────────────────────────────────────── */

/* ── Body scroll lock (applied by JS via class) ──────────────────────── */
body.dcm-body-locked {
    overflow: hidden;
}

/* ── Archive layout: flex row wrapping sidebar + product grid ─────────── */
.dcm-archive-layout {
    display: flex;
    align-items: flex-start;
    gap: 28px;
    width: 100%;
    position: relative;
}

/* Products wrapper takes all remaining space */
.dcm-products-wrap {
    flex: 1;
    min-width: 0; /* prevent flex blowout */
}

/* ── Desktop Sidebar ─────────────────────────────────────────────────── */
.dcm-filter-sidebar {
    width: 260px;
    min-width: 240px;
    flex-shrink: 0;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    position: sticky;
    top: 24px;
    /* No max-height or overflow — sidebar shows all filters in full */
}

/* ── Sidebar Header (visible on mobile only) ─────────────────────────── */
.dcm-sidebar-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 2;
}

.dcm-sidebar-title {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a2e;
}

.dcm-sidebar-close {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #555;
    display: flex;
    align-items: center;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}

.dcm-sidebar-close:hover {
    background: #f5f3ff;
    color: #7b68ee;
}

/* ── Filter Body ─────────────────────────────────────────────────────── */
.dcm-filter-body {
    padding: 0 0 8px;
}

/* ── Filter Section ──────────────────────────────────────────────────── */
.dcm-filter-section {
    border-bottom: 1px solid #f0f0f0;
}

.dcm-filter-section:last-of-type {
    border-bottom: none;
}

.dcm-filter-section__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    color: #1a1a2e;
    user-select: none;
    transition: background 0.12s;
}

.dcm-filter-section__header:hover {
    background: #fafafa;
}

.dcm-chevron {
    flex-shrink: 0;
    transition: transform 0.2s ease;
    color: #888;
}

.dcm-filter-section__header--open .dcm-chevron {
    transform: rotate(180deg);
}

.dcm-filter-section__content {
    padding: 4px 18px 14px;
    overflow: hidden;
}

/* Sections with more than 9 options get an inner scroll */
.dcm-filter-section__content--scrollable {
    /* ~9 items × 34px each + bottom padding */
    max-height: 310px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #d0d0d0 transparent;
    /* Slight inset shadow so user knows it scrolls */
    box-shadow: inset 0 -12px 10px -10px rgba(0,0,0,0.06);
    padding-bottom: 8px;
}

.dcm-filter-section__content--scrollable::-webkit-scrollbar {
    width: 4px;
}
.dcm-filter-section__content--scrollable::-webkit-scrollbar-track {
    background: transparent;
}
.dcm-filter-section__content--scrollable::-webkit-scrollbar-thumb {
    background: #d0d0d0;
    border-radius: 4px;
}

.dcm-filter-section__content.is-hidden {
    display: none;
}

/* ── Price Range ─────────────────────────────────────────────────────── */
.dcm-price-slider {
    margin: 8px 6px 4px;
}

.dcm-price-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
}

.dcm-price-input-wrap {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    flex: 1;
    background: #fff;
}

.dcm-price-currency {
    padding: 0 7px;
    font-size: 12px;
    color: #888;
    background: #f7f7f7;
    border-right: 1px solid #ddd;
    height: 34px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.dcm-price-input {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    padding: 0 8px;
    font-size: 13px;
    width: 100%;
    height: 34px;
    -moz-appearance: textfield;
    background: transparent;
}

.dcm-price-input::-webkit-outer-spin-button,
.dcm-price-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.dcm-price-sep {
    color: #aaa;
    font-size: 14px;
    flex-shrink: 0;
}

/* ── Custom Checkboxes ───────────────────────────────────────────────── */
.dcm-filter-check {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    cursor: pointer;
    user-select: none;
}

.dcm-filter-check input[type="checkbox"] {
    /* hide native, replaced by .dcm-check-box */
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.dcm-check-box {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    border: 2px solid #d0d0d0;
    border-radius: 4px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s, background 0.15s;
}

.dcm-filter-check input:checked + .dcm-check-box {
    border-color: #7b68ee;
    background: #7b68ee;
}

.dcm-filter-check input:checked + .dcm-check-box::after {
    content: '';
    width: 9px;
    height: 5px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg) translateY(-1px);
    display: block;
}

.dcm-filter-check:hover .dcm-check-box {
    border-color: #7b68ee;
}

.dcm-check-label {
    font-size: 13px;
    color: #333;
    line-height: 1.4;
}

/* ── Clear All ───────────────────────────────────────────────────────── */
.dcm-filter-footer {
    padding: 12px 18px 8px;
}

.dcm-clear-all {
    background: none;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 7px 16px;
    font-size: 13px;
    color: #666;
    cursor: pointer;
    width: 100%;
    text-align: center;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.dcm-clear-all:hover {
    border-color: #cf222e;
    color: #cf222e;
    background: #fff5f5;
}

/* ── Mobile Bar ──────────────────────────────────────────────────────── */
.dcm-mobile-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0 14px;
    border-bottom: 1px solid #eee;
    margin-bottom: 4px;
}

.dcm-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #fff;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

.dcm-filter-btn:hover,
.dcm-filter-btn.has-active {
    border-color: #7b68ee;
    color: #7b68ee;
}

.dcm-active-count {
    background: #7b68ee;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
}

.dcm-sort-wrap {
    display: flex;
    align-items: center;
}

.dcm-mobile-orderby {
    padding: 7px 10px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    cursor: pointer;
    max-width: 200px;
}

/* ── Overlay ──────────────────────────────────────────────────────────── */
.dcm-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.25s ease;
    cursor: pointer;
}

.dcm-overlay.is-visible {
    opacity: 1;
}

/* ── AJAX loading state ───────────────────────────────────────────────── */
.dcm-products-loading {
    opacity: 0.4;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

/* ── Responsive: Tablet & Mobile (≤ 991px) ───────────────────────────── */
@media ( max-width: 991px ) {

    /* Layout becomes single column */
    .dcm-archive-layout {
        display: block;
    }

    /* Sidebar becomes fixed offcanvas */
    .dcm-filter-sidebar {
        position: fixed;
        top: 0;
        width: 320px;
        max-width: 88vw;
        height: 100dvh; /* dvh for mobile browser chrome */
        max-height: 100%;
        border-radius: 0;
        border: none;
        box-shadow: 0 0 30px rgba(0, 0, 0, 0.18);
        z-index: 9999;
        /* restore scroll for mobile drawer — content taller than screen */
        overflow-y: auto;
        scrollbar-width: thin;
        scrollbar-color: #d0d0d0 transparent;
        /* base: off-screen right */
        right: 0;
        left: auto;
        transform: translateX(110%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .dcm-filter-sidebar.dcm-filter-side-right {
        right: 0;
        left: auto;
        transform: translateX(110%);
    }

    .dcm-filter-sidebar.dcm-filter-side-right.is-open {
        transform: translateX(0);
    }

    .dcm-filter-sidebar.dcm-filter-side-left {
        left: 0;
        right: auto;
        transform: translateX(-110%);
    }

    .dcm-filter-sidebar.dcm-filter-side-left.is-open {
        transform: translateX(0);
    }

    /* Reveal mobile-only elements */
    .dcm-sidebar-header { display: flex; }
    .dcm-mobile-bar     { display: flex; }
    .dcm-overlay        { display: block; }
}

@media ( max-width: 480px ) {
    .dcm-filter-sidebar {
        width: 100%;
        max-width: 100vw;
    }
}

/* ── AJAX Spinner ────────────────────────────────────────────────────── */
.dcm-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 0;
    width: 100%;
}

.dcm-spinner__ring {
    display: inline-block;
    width: 36px;
    height: 36px;
    border: 3px solid #e8e8e8;
    border-top-color: #7b68ee;
    border-radius: 50%;
    animation: dcm-spin 0.7s linear infinite;
}

@keyframes dcm-spin {
    to { transform: rotate(360deg); }
}

/* ── No products / error messages ────────────────────────────────────── */
.dcm-no-products,
.dcm-ajax-error {
    padding: 32px 16px;
    text-align: center;
    color: #646970;
    font-size: 14px;
    width: 100%;
}

.dcm-ajax-error {
    color: #cf222e;
}

/* ── Pagination ──────────────────────────────────────────────────────── */
.dcm-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    padding: 24px 0 8px;
}

.dcm-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #333;
    text-decoration: none;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.dcm-pagination .page-numbers:hover {
    border-color: #7b68ee;
    color: #7b68ee;
}

.dcm-pagination .page-numbers.current {
    background: #7b68ee;
    border-color: #7b68ee;
    color: #fff;
    cursor: default;
}

/* ── Elementor editor widget states ──────────────────────────────────── */

/* In Elementor canvas, sidebar should not be fixed/sticky */
.elementor-editor-active .dcm-filter-sidebar,
.elementor-preview .dcm-filter-sidebar {
    position: relative !important;
    top: auto !important;
    transform: none !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    box-shadow: none;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
}

/* Always show sidebar header inside editor */
.elementor-editor-active .dcm-sidebar-header,
.elementor-preview .dcm-sidebar-header {
    display: flex !important;
}
