/* ============================================================
   DTB Product Options — Filter Panel Styles
   Desktop (≥768px): panel always visible, static layout.
   Mobile  (<768px):  toggle button + fixed full-width drawer.
   ============================================================ */

.dtbpo-filter-wrap {
    position: relative;
}

/* ── Desktop-only filter title: hidden on mobile ────────────────────────────── */
.dtbpo-filter-title {
    display: none;
}
@media (min-width: 768px) {
    .dtbpo-filter-title {
        display: block;
        font-size: 18px;
        font-weight: 400;
        text-transform: uppercase;
        letter-spacing: .5px;
        color: rgb(217, 194, 122);
        margin-bottom: 14px;
    }
}


.dtbpo-filter-modal-header {
    display: none;
}

/* ── Mobile-only trigger bar: hidden on desktop ─────────────────────────────── */
.dtbpo-filter-trigger-bar {
    display: none;
}

/* ── Filter toggle button ───────────────────────────────────────────────────── */
.dtbpo-filter-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 10px 16px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    white-space: nowrap;
    box-sizing: border-box;
}
.dtbpo-filter-toggle-btn:hover { border-color: #9ca3af; }
.dtbpo-filter-toggle-btn[aria-expanded="true"] {
    border-color: #374151;
    border-radius: 8px 8px 0 0;
}
.dtbpo-filter-icon {
    font-size: 16px !important;
    width: 16px !important;
    height: 16px !important;
}
.dtbpo-filter-toggle-label { flex: 1; text-align: left; }
.dtbpo-filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #374151;
    color: #fff;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}
.dtbpo-filter-chevron {
    font-size: 14px !important;
    width: 14px !important;
    height: 14px !important;
    transition: transform .2s;
    margin-left: auto;
}
.dtbpo-filter-toggle-btn[aria-expanded="true"] .dtbpo-filter-chevron {
    transform: rotate(180deg);
}

/* ── Filter panel — base (mobile-first, starts hidden) ─────────────────────── */
.dtbpo-filter-panel {
    display: block;
    box-sizing: border-box;
    overflow: hidden;
    max-height: 0;
    transition: max-height .34s cubic-bezier(.4,0,.2,1);
}

/* ── Filter panel — Desktop: always visible, static ────────────────────────── */
@media (min-width: 768px) {
    .dtbpo-filter-panel {
        position: static !important;
        max-height: none !important;
        overflow: visible !important;
        background: transparent;
        border: none;
        box-shadow: none;
        padding: 0;
        transition: none;
    }

    /* Desktop colour overrides — gold accent */
    .dtbpo-filter-section-title {
        color: rgb(217, 194, 122) !important;
    }
    .dtbpo-filter-section-toggle:hover {
        color: #fff !important;
    }
    .dtbpo-count {
        color: rgb(217, 194, 122) !important;
    }
}

/* ── Filter card: dark background overrides ─────────────────────────────────── */
/* Scoped to li.dtb-filter-card so only the card-mode dark bg card is affected. */

/* Base: reset any inherited link/theme colour for all descendants */
.dtb-filter-card .dtbpo-filter-wrap,
.dtb-filter-card .dtbpo-filter-wrap a,
.dtb-filter-card .dtbpo-filter-wrap span,
.dtb-filter-card .dtbpo-filter-wrap label {
    color: rgba(255, 255, 255, 0.92) !important;
}
.dtb-filter-card .dtbpo-filter-option-label {
    color: rgba(255, 255, 255, 0.92) !important;
}
.dtb-filter-card .dtbpo-filter-option:hover {
    background: rgba(255, 255, 255, 0.08) !important;
}
.dtb-filter-card .dtbpo-filter-section {
    border-top-color: rgba(255, 255, 255, 0.12) !important;
}
.dtb-filter-card .dtbpo-filter-footer {
    border-top-color: rgba(255, 255, 255, 0.12) !important;
}
.dtb-filter-card .dtbpo-price-values,
.dtb-filter-card .dtbpo-price-values span {
    color: rgba(255, 255, 255, 0.92) !important;
}
.dtb-filter-card .dtbpo-price-pill {
    background: rgba(255, 255, 255, 0.10) !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
    color: #fff !important;
}
.dtb-filter-card .dtbpo-price-slider-track {
    background: rgba(255, 255, 255, 0.18) !important;
}
.dtb-filter-card .dtbpo-price-slider-range {
    background: rgb(217, 194, 122) !important;
}
.dtb-filter-card .dtbpo-price-range-input::-webkit-slider-thumb {
    border-color: rgb(217, 194, 122) !important;
    background: #111827 !important;
}
.dtb-filter-card .dtbpo-price-range-input::-moz-range-thumb {
    border-color: rgb(217, 194, 122) !important;
    background: #111827 !important;
}
.dtb-filter-card .dtbpo-filter-check {
    background: rgba(255, 255, 255, 0.10) !important;
    border-color: rgba(255, 255, 255, 0.35) !important;
}
.dtb-filter-card .dtbpo-filter-check:checked {
    background: rgb(217, 194, 122) !important;
    border-color: rgb(217, 194, 122) !important;
}
.dtb-filter-card .dtbpo-filter-reset {
    background: rgba(255, 255, 255, 0.10) !important;
    border-color: rgba(255, 255, 255, 0.22) !important;
    color: rgba(255, 255, 255, 0.75) !important;
}
.dtb-filter-card .dtbpo-filter-reset:hover {
    background: rgba(255, 255, 255, 0.20) !important;
}

/* ── Filter sections ────────────────────────────────────────────────────────── */
.dtbpo-filter-section {
    border-top: 1px solid #f1f5f9;
    padding: 12px 0;
}
.dtbpo-filter-section:first-child {
    border-top: none;
    padding-top: 0;
}
.dtbpo-filter-section.dtbpo-filter-section-hidden {
    display: none;
}

.dtbpo-filter-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #9ca3af;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.dtbpo-filter-section-toggle {
    cursor: pointer;
    user-select: none;
}
.dtbpo-filter-section-toggle:hover { color: #374151; }
.dtbpo-section-chevron {
    position: relative;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 16px !important;
    height: 16px !important;
    min-width: 16px;
    font-size: 0 !important;
    color: transparent !important;
    transform: rotate(0deg);
    transition: transform .34s cubic-bezier(.22,1,.36,1), opacity .22s ease;
    opacity: .88;
}
.dtbpo-section-chevron::before {
    content: '';
    width: 7px;
    height: 7px;
    border-right: 1.8px solid currentColor;
    border-bottom: 1.8px solid currentColor;
    color: #9ca3af;
    transform: rotate(45deg) translateY(-1px);
    transform-origin: center;
    display: block;
}
.dtbpo-filter-section.is-collapsed .dtbpo-section-chevron {
    transform: rotate(-90deg);
}
.dtbpo-filter-section-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
    max-height: 600px;
    opacity: 1;
    transition: max-height .52s cubic-bezier(.22,1,.36,1), opacity .34s ease, transform .34s ease;
    margin-top: 0;
    will-change: max-height, opacity, transform;
    transform: translateY(0);
}
.dtbpo-filter-section.is-collapsed .dtbpo-filter-section-body {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
}


/* ── Price range ────────────────────────────────────────────────────────────── */
.dtbpo-price-range {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.dtbpo-price-values {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.dtbpo-price-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 86px;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    box-sizing: border-box;
}
.dtbpo-price-sep {
    color: #374151;
    font-size: 18px;
    line-height: 1;
    flex: 0 0 auto;
}
.dtbpo-price-slider-track-wrap {
    position: relative;
    height: 22px;
}
.dtbpo-price-slider-track,
.dtbpo-price-slider-range {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 4px;
    border-radius: 999px;
}
.dtbpo-price-slider-track {
    left: 0;
    right: 0;
    background: #e5e7eb;
}
.dtbpo-price-slider-range {
    background: #374151;
}
.dtbpo-price-range-input {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 22px;
    margin: 0;
    padding: 0;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
}
.dtbpo-price-range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #374151;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 8px rgba(17, 24, 39, 0.12);
    cursor: pointer;
    pointer-events: auto;
}
.dtbpo-price-range-input::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border: 2px solid #374151;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 8px rgba(17, 24, 39, 0.12);
    cursor: pointer;
    pointer-events: auto;
}
.dtbpo-price-range-input::-webkit-slider-runnable-track,
.dtbpo-price-range-input::-moz-range-track {
    background: transparent;
}

/* ── Custom checkboxes ──────────────────────────────────────────────────────── */
.dtbpo-filter-option {
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    padding: 4px 2px;
    border-radius: 4px;
    transition: background .1s;
}
.dtbpo-filter-option:hover { background: #f8fafc; }

.dtbpo-filter-check {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border: 1.5px solid #d1d5db;
    border-radius: 3px;
    background: #fff;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    transition: border-color .15s, background .15s;
}
.dtbpo-filter-check:hover { border-color: #9ca3af; }
.dtbpo-filter-check:checked {
    background: #374151;
    border-color: #374151;
}
.dtbpo-filter-check:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}

.dtbpo-filter-option-label {
    font-size: 13px;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 6px;
    line-height: 1.3;
}
.dtbpo-count {
    font-size: 11px;
    color: #9ca3af;
}

/* ── Head: title + sort order on one line when there is room ──────────────── */
.dtbpo-filter-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
    margin-bottom: 14px;
}
.dtbpo-filter-head .dtbpo-filter-title {
    flex: 1 1 auto;
    margin-bottom: 0 !important;
}
.dtbpo-filter-head .dtbpo-filter-sort {
    flex: 0 1 200px;
    min-width: 150px;
    margin-left: auto;
    padding: 0;
}
@media (max-width: 767px) {
    .dtbpo-filter-head .dtbpo-filter-sort { flex: 1 1 100%; }
}

/* ── "2 selected · Reset" ───────────────────────────────────────────────────── */
.dtbpo-filter-active {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: -4px 0 12px;
    font-size: 12px;
    opacity: .85;
}
.dtbpo-filter-active[hidden] { display: none !important; }
.dtbpo-filter-reset-link {
    padding: 0 !important;
    border: 0 !important;
    background: none !important;
    box-shadow: none !important;
    color: inherit;
    font: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}
.dtbpo-filter-reset-link:hover { opacity: .75; }
.dtbpo-filter-reset-link:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

/* The filter applies itself on every change: the buttons stay only in the mobile window
   (where "Apply" also closes it). */
@media (min-width: 768px) {
    .dtbpo-filter-footer { display: none !important; }
}

/* ── Sort dropdown ───────────────────────────────────────────────────────────── */
.dtbpo-filter-sort {
    padding: 0 0 14px;
}
.dtbpo-sort-select {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #374151;
    font-size: 13px;
    cursor: pointer;
    appearance: auto;
}
.dtbpo-sort-select:focus {
    outline: none;
    border-color: #9ca3af;
}
.dtbpo-sort-select option {
    background: #fff;
    color: #374151;
}
/* Dark card overrides */
.dtb-filter-card .dtbpo-sort-select {
    background: #2c2c2c !important;
    border-color: rgba(255,255,255,0.18) !important;
    color: rgba(255,255,255,0.82) !important;
    border-radius: 6px !important;
}
.dtb-filter-card .dtbpo-sort-select option {
    background: #2c2c2c !important;
    color: rgba(255,255,255,0.82) !important;
}

/* ── Footer (Apply / Reset) ─────────────────────────────────────────────────── */
.dtbpo-filter-footer {
    display: flex;
    gap: 8px;
    padding-top: 14px;
    border-top: 1px solid #f1f5f9;
    margin-top: 4px;
}
.dtbpo-filter-apply {
    flex: 1;
    background: #374151 !important;
    border-color: #1f2937 !important;
    color: #fff !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    padding: 8px !important;
    height: auto !important;
    cursor: pointer;
    transition: background .15s !important;
}
.dtbpo-filter-apply:hover { background: #1f2937 !important; }
.dtbpo-filter-reset {
    background: #f8fafc !important;
    border-color: #e5e7eb !important;
    color: #64748b !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    padding: 8px 14px !important;
    height: auto !important;
    cursor: pointer;
}

/* ── Loading overlay ────────────────────────────────────────────────────────── */
.dtbpo-filter-loading {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.6);
    backdrop-filter: blur(2px);
    pointer-events: none;
}

.dtbpo-filter-loading.is-visible { display: flex; }
.dtbpo-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e5e7eb;
    border-top-color: #374151;
    border-radius: 50%;
    animation: dtbpo-spin .7s linear infinite;
}
@keyframes dtbpo-spin { to { transform: rotate(360deg); } }

/* ── Mobile backdrop ────────────────────────────────────────────────────────── */
.dtbpo-filter-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 99998;
}
.dtbpo-filter-backdrop.is-visible { display: block; }

/* ============================================================
   MOBILE (<768px)
   ============================================================ */
@media (max-width: 767px) {

    /* Show trigger bar */
    .dtbpo-filter-trigger-bar { display: flex; }

    /* Mobile toggle button — dark with gold hover */
    .dtbpo-filter-toggle-btn {
        background: rgb(40, 40, 40);
        border: none;
        color: #fff;
        transition: background .2s, color .2s;
    }
    .dtbpo-filter-toggle-btn:hover {
        background: rgb(217, 194, 122);
        border: none;
        color: #000;
    }
    .dtbpo-filter-toggle-btn[aria-expanded="true"] {
        background: rgb(40, 40, 40);
        border: none;
        color: #fff;
    }
}

/* ── AJAX Pagination ────────────────────────────────────────────────────────── */
.dtbpo-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 24px 0 8px;
}
.dtbpo-pg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid #e5e7eb;
    background: transparent;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none !important;
    transition: background .15s, border-color .15s, color .15s;
}
.dtbpo-pg-btn:hover {
    background: rgb(217, 194, 122);
    border-color: rgb(217, 194, 122);
    color: #000;
}
.dtbpo-pg-btn.dtbpo-pg-active {
    background: rgb(217, 194, 122);
    border-color: rgb(217, 194, 122);
    color: #000;
    font-weight: 700;
    pointer-events: none;
}



/* ── Mobile modal filter improvements ───────────────────────────────────────── */
.dtbpo-filter-close {
    display: none;
}

@media (max-width: 767px) {
    html.dtbpo-filter-open,
    body.dtbpo-filter-open {
        overflow: hidden;
        touch-action: none;
        overscroll-behavior: none;
    }

    .dtbpo-filter-backdrop {
        position: fixed;
        inset: 0;
        display: block;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        background: rgba(10, 14, 24, 0.34);
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
        transition: opacity .18s ease, visibility .18s ease;
        z-index: 9998;
    }

    .dtbpo-filter-backdrop.is-visible {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }


    .dtbpo-filter-modal-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin: 0 0 14px;
        padding-bottom: 8px;
    }

    .dtbpo-filter-modal-title {
        font-size: 16px;
        line-height: 1.2;
        font-weight: 500;
        text-transform: uppercase;
        letter-spacing: .08em;
        color: #111827;
    }

    .dtbpo-filter-panel {
        position: fixed;
        top: 50%;
        left: 50%;
        right: auto;
        bottom: auto;
        width: calc(100vw - 32px);
        max-width: 760px;
        max-height: min(82vh, 760px);
        overflow-x: hidden;
        overflow-y: auto;
        margin: 0;
        padding: 22px 18px 18px;
        border: 1px solid rgba(255, 255, 255, 0.78);
        border-radius: 18px;
        background: rgba(255, 255, 255, 0.96);
        -webkit-backdrop-filter: blur(0);
        backdrop-filter: blur(0);
        box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
        transform: translate(-50%, calc(-50% + 24px)) scale(0.985);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: transform .22s cubic-bezier(.22,1,.36,1), opacity .18s ease, visibility .18s ease;
        z-index: 9999;
    }

    .dtbpo-filter-panel.is-open {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .dtbpo-filter-close {
        position: absolute;
        top: 14px;
        right: 14px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        padding: 0;
        border: 0;
        border-radius: 999px;
        background: transparent;
        color: #111827;
        font-size: 30px;
        line-height: 1;
        cursor: pointer;
        z-index: 2;
    }

    .dtbpo-filter-close:hover,
    .dtbpo-filter-close:focus {
        background: rgba(17, 24, 39, 0.06);
        outline: none;
    }

    .dtbpo-filter-section:first-of-type {
        border-top: none;
    }

    .dtbpo-price-pill {
        min-width: 94px;
    }

    .dtbpo-filter-section-title {
        margin-bottom: 0;
    }

    .dtbpo-filter-section-toggle {
        padding: 6px 0;
    }

    .dtbpo-section-chevron {
        opacity: 1;
    }

    .dtbpo-section-chevron::before {
        color: #6b7280;
        border-right-color: currentColor;
        border-bottom-color: currentColor;
    }

    .dtbpo-filter-section-body {
        padding-top: 12px;
        transition: max-height .56s cubic-bezier(.22,1,.36,1), opacity .34s ease, padding-top .34s ease, transform .34s ease;
    }

    .dtbpo-filter-section.is-collapsed .dtbpo-filter-section-body {
        padding-top: 0;
    }
}
