/* ============================================================
   DTB Product Options — Filter Panel Styles
   Designed to sit inside a "filter card" on the shop page.
   ============================================================ */

.dtbpo-filter-wrap {
    position: relative;
}

/* ── Trigger bar (always visible) ─────────────────────────────────────────── */
.dtbpo-filter-trigger-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Search inline */
.dtbpo-filter-search-inline {
    position: relative;
    flex: 1;
    min-width: 120px;
}
.dtbpo-search-input {
    width: 100%;
    padding: 8px 34px 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 13px;
    color: #374151;
    background: #fff;
    box-sizing: border-box;
    transition: border-color .15s;
}
.dtbpo-search-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,.08);
}
.dtbpo-search-icon {
    position: absolute;
    right: 9px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
    font-size: 16px !important;
    width: 16px !important;
    height: 16px !important;
}

/* Filter toggle button */
.dtbpo-filter-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    white-space: nowrap;
}
.dtbpo-filter-toggle-btn:hover {
    border-color: #2563eb;
    color: #2563eb;
    background: #f0f7ff;
}
.dtbpo-filter-toggle-btn[aria-expanded="true"] {
    border-color: #2563eb;
    background: #eff6ff;
    color: #1d4ed8;
}
.dtbpo-filter-icon {
    font-size: 16px !important;
    width: 16px !important;
    height: 16px !important;
}
.dtbpo-filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #2563eb;
    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;
}
.dtbpo-filter-toggle-btn[aria-expanded="true"] .dtbpo-filter-chevron {
    transform: rotate(180deg);
}

/* Sort dropdown */
.dtbpo-sort-wrap { flex-shrink: 0; }
.dtbpo-sort-select {
    padding: 8px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 13px;
    color: #374151;
    background: #fff;
    cursor: pointer;
    transition: border-color .15s;
}
.dtbpo-sort-select:focus {
    outline: none;
    border-color: #2563eb;
}

/* ── Filter panel (slides open) ────────────────────────────────────────────── */
.dtbpo-filter-panel {
    overflow: hidden;
    max-height: 0;
    transition: max-height .3s cubic-bezier(.4,0,.2,1);
    /* Note: JS sets max-height to scrollHeight when open */
}
.dtbpo-filter-panel.is-open {
    max-height: 2000px; /* fallback — JS overrides */
}
.dtbpo-filter-panel[aria-hidden="false"] {
    /* exposed via JS */
}

/* Inside the panel */
.dtbpo-filter-section {
    border-top: 1px solid #f1f5f9;
    padding: 12px 0;
}
.dtbpo-filter-section:first-child {
    margin-top: 12px;
}
.dtbpo-filter-section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #64748b;
    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: #2563eb; }
.dtbpo-section-chevron {
    font-size: 14px !important;
    width: 14px !important;
    height: 14px !important;
    transition: transform .2s;
}
.dtbpo-filter-section.is-collapsed .dtbpo-section-chevron {
    transform: rotate(-90deg);
}
.dtbpo-filter-section-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.dtbpo-filter-section.is-collapsed .dtbpo-filter-section-body {
    display: none;
}

/* Price range */
.dtbpo-price-range {}
.dtbpo-price-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}
.dtbpo-price-input {
    width: 80px;
    padding: 6px 8px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 13px;
    color: #374151;
    text-align: center;
}
.dtbpo-price-input:focus {
    outline: none;
    border-color: #2563eb;
}

/* Filter checkboxes */
.dtbpo-filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 3px 4px;
    border-radius: 4px;
    transition: background .1s;
}
.dtbpo-filter-option:hover { background: #f8fafc; }
.dtbpo-filter-check {
    width: 15px;
    height: 15px;
    accent-color: #2563eb;
    cursor: pointer;
    flex-shrink: 0;
}
.dtbpo-filter-option-label {
    font-size: 13px;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 6px;
}
.dtbpo-count {
    font-size: 11px;
    color: #94a3b8;
}

/* ── Footer ─────────────────────────────────────────────────────────────────── */
.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);
}
.dtbpo-filter-loading.is-visible { display: flex; }
.dtbpo-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: dtbpo-spin .7s linear infinite;
}
@keyframes dtbpo-spin { to { transform: rotate(360deg); } }
