/**
 * XC Product Filter Pro — Frontend Styles (v1.0.2)
 * Mode: Inherit Theme (default) — colors cascade from the active theme.
 * Layout: unified panel design inspired by FilterEverything Pro / modern Laravel
 *         e-commerce templates. No horizontal dividers between filter groups —
 *         visual separation comes from spacing, weighted headers, and an optional
 *         soft card wrapper.
 * Fully responsive: 320px → 2560px+
 */

/* ══ CSS Custom Properties — inherit from theme ══ */
:root {
    --xc-text: inherit;
    --xc-text-muted: rgba(0,0,0,0.55);
    --xc-bg: transparent;
    --xc-bg-soft: rgba(0,0,0,0.02);
    --xc-bg-hover: rgba(0,0,0,0.04);
    --xc-bg-selected: rgba(0,0,0,0.06);
    --xc-border: rgba(0,0,0,0.10);
    --xc-border-strong: rgba(0,0,0,0.18);
    --xc-accent: var(--theme-primary, var(--wp--preset--color--primary, var(--ast-global-color-0, var(--global-palette1, #2271b1))));
    --xc-accent-hover: color-mix(in srgb, var(--xc-accent) 85%, black);
    --xc-accent-soft: color-mix(in srgb, var(--xc-accent) 12%, transparent);
    --xc-radius: 8px;
    --xc-radius-sm: 6px;
    --xc-transition: 160ms ease;
    --xc-shadow: 0 1px 2px rgba(0,0,0,0.04);
    --xc-font: inherit;
    --xc-font-size: 14px;
    --xc-sidebar-width: 280px;
    --xc-gap: 32px;
}

/* ══ Shop Layout: Sidebar + Content ══ */
.xcfp-shop-layout {
    display: flex;
    gap: var(--xc-gap);
    align-items: flex-start;
    width: 100%;
}

.xcfp-filters-sidebar {
    width: var(--xc-sidebar-width);
    min-width: 220px;
    max-width: 320px;
    flex-shrink: 0;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--xc-border-strong) transparent;
}
.xcfp-filters-sidebar::-webkit-scrollbar { width: 4px; }
.xcfp-filters-sidebar::-webkit-scrollbar-thumb {
    background: var(--xc-border-strong);
    border-radius: 2px;
}

.xcfp-shop-content {
    flex: 1;
    min-width: 0;
}

/* ══ Filter Container — soft card panel ══ */
.xcfp-filters-wrap {
    font-family: var(--xc-font);
    font-size: var(--xc-font-size);
    color: var(--xc-text);
    line-height: 1.5;
}

/* When in the sidebar, render as a contained card */
.xcfp-filters-sidebar > .xcfp-filters-wrap,
.xcfp-filters-sidebar .xcfp-filters-wrap {
    background: var(--xc-bg);
    border: 1px solid var(--xc-border);
    border-radius: var(--xc-radius);
    padding: 6px 18px 14px;
    box-shadow: var(--xc-shadow);
}

/* ══ Filter Group — separated by spacing, NO border between groups ══ */
.xcfp-filter-group {
    padding: 14px 0 4px;
    /* No border-bottom — visual separation via spacing alone */
}
.xcfp-filter-group + .xcfp-filter-group {
    border-top: 1px solid var(--xc-border);
}
.xcfp-filter-group:first-of-type {
    padding-top: 8px;
}
.xcfp-filter-group:last-of-type {
    padding-bottom: 8px;
}

/* ══ Filter Header — uppercase, weighted, with count badge support ══ */
.xcfp-filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0 10px;
    cursor: pointer;
    user-select: none;
    gap: 10px;
    border-radius: var(--xc-radius-sm);
    transition: color var(--xc-transition);
}
.xcfp-filter-header:hover {
    color: var(--xc-accent);
}
.xcfp-filter-title {
    flex: 1;
    font-weight: 700;
    font-size: 0.78em;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: inherit;
    line-height: 1.3;
}

/* Optional active count badge — appended next to the title via JS or PHP */
.xcfp-filter-title-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    margin-left: 8px;
    background: var(--xc-accent);
    color: #fff;
    border-radius: 9px;
    font-size: 0.78em;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    line-height: 1;
    vertical-align: middle;
}

/* ══ Toggle Icon — chevron pointing down (open) / right (collapsed) ══ */
.xcfp-toggle-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    position: relative;
    color: var(--xc-text-muted);
    transition: transform var(--xc-transition), color var(--xc-transition);
}
.xcfp-toggle-icon::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform var(--xc-transition);
}
.xcfp-toggle-icon::after {
    /* Reset legacy plus icon: hide it */
    display: none;
}
.xcfp-collapsed .xcfp-toggle-icon::before {
    transform: rotate(-45deg);
    top: 4px;
    left: 6px;
}
.xcfp-filter-header:hover .xcfp-toggle-icon {
    color: var(--xc-accent);
}

.xcfp-tooltip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px; height: 14px;
    border-radius: 50%;
    border: 1px solid var(--xc-border-strong);
    color: var(--xc-text-muted);
    font-size: 9px;
    font-weight: 600;
    cursor: help;
    flex-shrink: 0;
    text-transform: none;
    letter-spacing: 0;
}

/* ══ Filter Body ══ */
.xcfp-filter-body {
    padding: 0 0 4px;
}

/* ══ UNIFIED LIST CONTAINER — applies to taxonomy, attribute, brand, etc. ══
   The intent: every list-style filter (checkboxes, radios, ratings) shares the
   same vertical rhythm and option styling. No more inconsistent spacing
   between "Categories" and "Color" or "Brand". */
.xcfp-options-list,
.xcfp-rating-wrap {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.xcfp-options-list.xcfp-scrollable {
    max-height: 260px;
    overflow-y: auto;
    padding-right: 6px;
    margin-right: -6px;
    scrollbar-width: thin;
    scrollbar-color: var(--xc-border-strong) transparent;
}
.xcfp-options-list.xcfp-scrollable::-webkit-scrollbar { width: 4px; }
.xcfp-options-list.xcfp-scrollable::-webkit-scrollbar-thumb {
    background: var(--xc-border-strong);
    border-radius: 2px;
}

/* ══ Single Option (label) — every list-style filter renders one of these per term ══ */
.xcfp-option,
.xcfp-rating-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    margin: 0;
    border-radius: var(--xc-radius-sm);
    cursor: pointer;
    transition: background var(--xc-transition), color var(--xc-transition);
    line-height: 1.4;
    color: inherit;
    font-weight: 400;
    position: relative;
    /* Faint baseline background so adjacent options never visually merge into a single block */
    background: transparent;
}
.xcfp-option:hover,
.xcfp-rating-option:hover {
    background: var(--xc-bg-hover);
}
.xcfp-option.xcfp-selected,
.xcfp-rating-option.xcfp-selected {
    background: var(--xc-bg-selected);
    color: var(--xc-accent);
    font-weight: 500;
}

/* Hierarchical taxonomy depth indent — each level adds 16px left padding.
   Caps at 5 levels (depth-5) so deep structures don't push content off-screen. */
.xcfp-option[data-depth="1"] { padding-left: 26px; }
.xcfp-option[data-depth="2"] { padding-left: 42px; }
.xcfp-option[data-depth="3"] { padding-left: 58px; }
.xcfp-option[data-depth="4"] { padding-left: 74px; }
.xcfp-option[data-depth="5"] { padding-left: 90px; }
/* Subtle vertical guide for nested children — only applies when depth > 0 */
.xcfp-option[data-depth="1"]::before,
.xcfp-option[data-depth="2"]::before,
.xcfp-option[data-depth="3"]::before,
.xcfp-option[data-depth="4"]::before,
.xcfp-option[data-depth="5"]::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 14px;
    width: 8px;
    height: 1px;
    background: var(--xc-border-strong);
}
.xcfp-option[data-depth="2"]::before { left: 30px; }
.xcfp-option[data-depth="3"]::before { left: 46px; }
.xcfp-option[data-depth="4"]::before { left: 62px; }
.xcfp-option[data-depth="5"]::before { left: 78px; }

.xcfp-option input[type="checkbox"],
.xcfp-option input[type="radio"] {
    margin: 0;
    flex-shrink: 0;
    accent-color: var(--xc-accent);
    width: 16px;
    height: 16px;
    cursor: pointer;
}
.xcfp-option-label {
    flex: 1;
    min-width: 0;
    word-break: break-word;
    font-size: 0.93em;
}
.xcfp-option-count {
    flex-shrink: 0;
    color: var(--xc-text-muted);
    font-size: 0.82em;
    font-variant-numeric: tabular-nums;
    margin-left: auto;
    opacity: 1;
}
.xcfp-option.xcfp-selected .xcfp-option-count {
    color: var(--xc-accent);
}

/* ══ Inline swatch indicator (visible on checkbox/radio view when term has color/image) ══ */
.xcfp-inline-swatch {
    flex-shrink: 0;
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.10);
}
.xcfp-inline-color {
    border-radius: 50%;
}
.xcfp-inline-image {
    width: 28px;
    height: 18px;
    overflow: hidden;
    background: var(--xc-bg-soft);
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);
}
.xcfp-inline-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* ══ Dropdown ══ */
.xcfp-filter-select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--xc-border-strong);
    border-radius: var(--xc-radius-sm);
    background: var(--xc-bg);
    color: inherit;
    font: inherit;
    font-size: 0.92em;
    transition: border-color var(--xc-transition), box-shadow var(--xc-transition);
}
.xcfp-filter-select:hover {
    border-color: var(--xc-accent);
}
.xcfp-filter-select:focus {
    outline: none;
    border-color: var(--xc-accent);
    box-shadow: 0 0 0 3px var(--xc-accent-soft);
}

/* ══ Label Buttons (chip-style filter values) ══ */
.xcfp-labels-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 0;
}
.xcfp-label-btn {
    padding: 6px 12px;
    border: 1px solid var(--xc-border-strong);
    border-radius: 999px;
    background: var(--xc-bg);
    color: inherit;
    font: inherit;
    font-size: 0.85em;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--xc-transition);
    line-height: 1.4;
}
.xcfp-label-btn:hover {
    border-color: var(--xc-accent);
    color: var(--xc-accent);
}
.xcfp-label-btn.xcfp-active {
    background: var(--xc-accent);
    color: #fff;
    border-color: var(--xc-accent);
}
.xcfp-label-btn .xcfp-option-count {
    margin-left: 4px;
    margin-right: -2px;
    color: inherit;
    opacity: 0.7;
}

/* ══ Color Swatches ══ */
.xcfp-swatches-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 0;
}
.xcfp-swatch-btn {
    width: 30px; height: 30px;
    border: 2px solid var(--xc-border);
    border-radius: 50%;
    padding: 2px;
    cursor: pointer;
    transition: transform var(--xc-transition), border-color var(--xc-transition), box-shadow var(--xc-transition);
    background: none;
    position: relative;
}
.xcfp-swatch-btn:hover {
    transform: scale(1.08);
    border-color: var(--xc-accent);
}
.xcfp-swatch-btn.xcfp-active {
    border-color: var(--xc-accent);
    box-shadow: 0 0 0 2px var(--xc-bg), 0 0 0 4px var(--xc-accent);
}
.xcfp-color-dot {
    display: block;
    width: 100%; height: 100%;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
}

/* ══ Image Swatches ══ */
.xcfp-image-swatches-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 0;
}
.xcfp-image-swatch-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border: 2px solid var(--xc-border);
    border-radius: var(--xc-radius-sm);
    padding: 2px;
    cursor: pointer;
    background: var(--xc-bg);
    transition: border-color var(--xc-transition), transform var(--xc-transition);
}
.xcfp-image-swatch-btn:hover {
    transform: scale(1.04);
    border-color: var(--xc-accent);
}
.xcfp-image-swatch-btn.xcfp-active {
    border-color: var(--xc-accent);
    box-shadow: 0 0 0 2px var(--xc-accent-soft);
}
.xcfp-image-swatch {
    max-width: 100%;
    max-height: 100%;
    border-radius: 4px;
    object-fit: contain;
}

/* ══ Range Slider (Price) ══ */
.xcfp-range-wrap {
    padding: 12px 4px 8px;
}
.xcfp-range-slider {
    position: relative;
    height: 22px;
    margin-bottom: 14px;
}
.xcfp-range-track {
    position: absolute;
    top: 9px;
    left: 0; right: 0;
    height: 4px;
    background: var(--xc-border-strong);
    border-radius: 2px;
}
.xcfp-range-selected {
    position: absolute;
    height: 100%;
    background: var(--xc-accent);
    border-radius: 2px;
}
.xcfp-range-slider input[type="range"] {
    position: absolute;
    width: 100%;
    top: 1px;
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
    height: 20px;
}
.xcfp-range-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--xc-accent);
    border: 3px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    pointer-events: auto;
    cursor: grab;
}
.xcfp-range-slider input[type="range"]::-moz-range-thumb {
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--xc-accent);
    border: 3px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    pointer-events: auto;
    cursor: grab;
}
.xcfp-range-values {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
}
.xcfp-range-currency {
    font-weight: 600;
    font-size: 0.85em;
    color: var(--xc-text-muted);
}
.xcfp-range-sep {
    color: var(--xc-text-muted);
}
.xcfp-input-min,
.xcfp-input-max {
    width: 78px;
    padding: 6px 8px;
    border: 1px solid var(--xc-border-strong);
    border-radius: var(--xc-radius-sm);
    text-align: center;
    font: inherit;
    font-size: 0.9em;
    background: var(--xc-bg);
    color: inherit;
    transition: border-color var(--xc-transition), box-shadow var(--xc-transition);
}
.xcfp-input-min:focus,
.xcfp-input-max:focus {
    outline: none;
    border-color: var(--xc-accent);
    box-shadow: 0 0 0 3px var(--xc-accent-soft);
}

/* ══ Rating Stars (uses .xcfp-rating-option which inherits .xcfp-option styles) ══ */
.xcfp-stars {
    display: inline-flex;
    gap: 2px;
}
.xcfp-star {
    font-size: 16px;
    line-height: 1;
}
.xcfp-star-filled { color: #f59e0b; }
.xcfp-star-empty  { color: var(--xc-border-strong); }

/* ══ Search Input ══ */
.xcfp-search-wrap {
    padding: 4px 0;
}
.xcfp-search-input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--xc-border-strong);
    border-radius: var(--xc-radius-sm);
    font: inherit;
    font-size: 0.92em;
    background: var(--xc-bg);
    color: inherit;
    transition: border-color var(--xc-transition), box-shadow var(--xc-transition);
}
.xcfp-search-input:focus {
    outline: none;
    border-color: var(--xc-accent);
    box-shadow: 0 0 0 3px var(--xc-accent-soft);
}

/* ══ Date Filter ══ */
.xcfp-date-wrap {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 4px 0;
}
.xcfp-date-field {
    display: flex;
    align-items: center;
    gap: 10px;
}
.xcfp-date-field label {
    font-size: 0.82em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    min-width: 44px;
    color: var(--xc-text-muted);
}
.xcfp-date-field input[type="date"] {
    flex: 1;
    padding: 7px 10px;
    border: 1px solid var(--xc-border-strong);
    border-radius: var(--xc-radius-sm);
    font: inherit;
    font-size: 0.9em;
    background: var(--xc-bg);
    color: inherit;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    min-height: 38px;
    transition: border-color var(--xc-transition), box-shadow var(--xc-transition);
}
.xcfp-date-field input[type="date"]:focus {
    outline: none;
    border-color: var(--xc-accent);
    box-shadow: 0 0 0 3px var(--xc-accent-soft);
}
.xcfp-date-field input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    filter: opacity(0.55);
    transition: filter var(--xc-transition);
}
.xcfp-date-field input[type="date"]::-webkit-calendar-picker-indicator:hover {
    filter: opacity(1);
}

/* ══ Apply Button ══ */
.xcfp-apply-btn-wrap {
    padding: 16px 0 4px;
}
.xcfp-apply-btn {
    width: 100%;
    padding: 11px 18px;
    background: var(--xc-accent);
    color: #fff;
    border: none;
    border-radius: var(--xc-radius-sm);
    font: inherit;
    font-weight: 600;
    font-size: 0.92em;
    cursor: pointer;
    transition: background var(--xc-transition), transform var(--xc-transition);
    letter-spacing: 0.02em;
}
.xcfp-apply-btn:hover {
    background: var(--xc-accent-hover);
}
.xcfp-apply-btn:active {
    transform: translateY(1px);
}

/* ══ Clear All ══ */
.xcfp-clear-wrap {
    padding: 12px 0 4px;
    text-align: center;
}
.xcfp-clear-all {
    font-size: 0.82em;
    color: var(--xc-accent);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    transition: opacity var(--xc-transition);
}
.xcfp-clear-all:hover {
    text-decoration: underline;
    opacity: 0.85;
}

/* ══ Chips Bar (active filters display) ══ */
.xcfp-chips-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 18px;
    align-items: center;
}
.xcfp-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px 5px 12px;
    border: 1px solid var(--xc-border-strong);
    border-radius: 999px;
    font-size: 0.82em;
    font-weight: 500;
    background: var(--xc-bg);
    white-space: nowrap;
    transition: border-color var(--xc-transition), background var(--xc-transition);
}
.xcfp-chip:hover {
    border-color: var(--xc-accent);
}
.xcfp-chip-remove {
    background: transparent;
    border: none;
    color: inherit;
    opacity: 0.55;
    cursor: pointer;
    padding: 2px 4px;
    margin: -2px -4px -2px 0;
    font-size: 1.05em;
    line-height: 1;
    border-radius: 4px;
    transition: opacity var(--xc-transition), background var(--xc-transition);
}
.xcfp-chip-remove:hover {
    opacity: 1;
    background: var(--xc-bg-hover);
}
.xcfp-chip-clear {
    text-decoration: none;
    color: var(--xc-accent);
    border-color: var(--xc-accent);
    font-weight: 600;
}

/* ══ Sorting ══ */
.xcfp-sorting-wrap {
    margin-bottom: 18px;
}
.xcfp-sorting-select {
    padding: 7px 12px;
    border: 1px solid var(--xc-border-strong);
    border-radius: var(--xc-radius-sm);
    font: inherit;
    font-size: 0.88em;
    background: var(--xc-bg);
    color: inherit;
    cursor: pointer;
    transition: border-color var(--xc-transition);
}
.xcfp-sorting-select:hover {
    border-color: var(--xc-accent);
}

/* ══ SEO Description ══ */
.xcfp-seo-description {
    margin-top: 28px;
    padding-top: 18px;
    border-top: 1px solid var(--xc-border);
    font-size: 0.92em;
    color: var(--xc-text-muted);
    line-height: 1.7;
}

/* ══ Loading State ══ */
.xcfp-loading {
    position: relative;
    pointer-events: none;
}
.xcfp-products-region {
    position: relative;
    min-height: 100px;
}
.xcfp-products-region.xcfp-loading {
    opacity: 0.55;
}
.xcfp-loading-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    pointer-events: none;
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
}
.xcfp-spinner,
.xcfp-loading-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid var(--xc-border);
    border-top-color: var(--xc-accent);
    border-radius: 50%;
    animation: xcfp-spin 0.7s linear infinite;
    display: inline-block;
}
@keyframes xcfp-spin { to { transform: rotate(360deg); } }

/* Loading overlay can be toggled via the `is-visible` modifier (server-rendered)
   or via JS that simply appends/removes the element. Both work. */
.xcfp-loading-overlay:not(.is-visible) {
    display: none;
}
.xcfp-loading-overlay.is-visible {
    display: flex;
}

/* Native WordPress screen-reader-text class — guard in case theme strips it */
.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    -webkit-clip-path: inset(50%);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

/* ══ Mobile Toggle Button ══ */
.xcfp-mobile-toggle {
    display: none;
    width: 100%;
    padding: 12px 20px;
    background: var(--xc-accent);
    color: #fff;
    border: none;
    border-radius: var(--xc-radius-sm);
    font: inherit;
    font-weight: 600;
    font-size: 0.95em;
    cursor: pointer;
    margin: 12px 0 16px;
    text-align: center;
    transition: background var(--xc-transition), transform var(--xc-transition), box-shadow var(--xc-transition);
    box-shadow: 0 2px 6px var(--xc-accent-soft);
}
.xcfp-mobile-toggle:hover {
    background: var(--xc-accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px var(--xc-accent-soft);
}
.xcfp-mobile-toggle:active {
    transform: translateY(0);
}

/* ══ Mobile Drawer ══ */
.xcfp-drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99999;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.xcfp-drawer {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 88%; max-width: 380px;
    background: #fff;
    color: var(--xc-text);
    z-index: 100000;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 280ms ease;
    padding: 16px;
    box-shadow: 2px 0 24px rgba(0,0,0,0.18);
    will-change: transform;
}
.xcfp-drawer.xcfp-drawer-open {
    transform: translateX(0);
}
.xcfp-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--xc-border);
    margin-bottom: 12px;
}
.xcfp-drawer-title {
    font-weight: 700;
    font-size: 1.05em;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.xcfp-drawer-close {
    border: none; background: none;
    font-size: 24px; cursor: pointer;
    padding: 4px 8px;
    color: inherit;
    line-height: 1;
    border-radius: var(--xc-radius-sm);
    transition: background var(--xc-transition);
}
.xcfp-drawer-close:hover {
    background: var(--xc-bg-hover);
}
.xcfp-drawer-footer {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding: 14px 0;
    border-top: 1px solid var(--xc-border);
    margin-top: 12px;
}

/* ══ Focus States (a11y, WCAG 2.4.7) ══ */
.xcfp-filter-input:focus-visible,
.xcfp-filter-header:focus-visible,
.xcfp-label-btn:focus-visible,
.xcfp-swatch-btn:focus-visible,
.xcfp-image-swatch-btn:focus-visible,
.xcfp-chip-remove:focus-visible,
.xcfp-mobile-toggle:focus-visible,
.xcfp-drawer-close:focus-visible,
.xcfp-apply-btn:focus-visible {
    outline: 2px solid var(--xc-accent);
    outline-offset: 2px;
}

/* ══ Screen Reader Only ══ */
.xcfp-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* ══ Font inheritance — keep theme font but allow size override on inputs ══ */
.xcfp-filters-wrap,
.xcfp-filters-wrap * {
    font-family: inherit;
}
.xcfp-filter-input,
.xcfp-filter-select,
.xcfp-search-input,
.xcfp-input-min,
.xcfp-input-max {
    font-family: inherit;
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ══════════════════════════════════════════════════════ */

/* ── Large Desktop (1440px+) ── */
@media (min-width: 1440px) {
    :root {
        --xc-sidebar-width: 300px;
        --xc-gap: 40px;
    }
}

/* ── Standard Desktop default applies ── */

/* ── Tablet Landscape (1024-1280px) ── */
@media (min-width: 1024px) and (max-width: 1280px) {
    .xcfp-shop-layout { gap: 20px; }
    .xcfp-filters-sidebar { width: 240px; min-width: 220px; }
}

/* ── Small Desktop / Tablet Landscape (≤ 1024px) ── */
@media (max-width: 1024px) {
    :root {
        --xc-sidebar-width: 240px;
        --xc-gap: 20px;
        --xc-font-size: 13px;
    }
}

/* ── Tablet Portrait & Mobile (≤ 768px) ── */
@media (max-width: 768px) {
    .xcfp-mobile-toggle { display: block; }
    .xcfp-shop-layout   { display: block; }
    .xcfp-filters-sidebar { display: none; }
    .xcfp-shop-content  { width: 100%; }
    .xcfp-chips-bar { gap: 4px; }
    .xcfp-chip { font-size: 0.78em; padding: 4px 9px; }
}

/* ── Small Mobile (≤ 480px) ── */
@media (max-width: 480px) {
    .xcfp-range-values { flex-wrap: wrap; gap: 4px; }
    .xcfp-input-min,
    .xcfp-input-max { width: 64px; font-size: 0.85em; }
    .xcfp-labels-wrap { gap: 4px; }
    .xcfp-label-btn { padding: 5px 10px; font-size: 0.8em; }
    .xcfp-drawer { width: 94%; max-width: none; }
}

/* ── Tiny Mobile (≤ 360px) ── */
@media (max-width: 360px) {
    .xcfp-option { padding: 6px; gap: 8px; font-size: 0.9em; }
    .xcfp-filter-title { font-size: 0.74em; }
    .xcfp-swatch-btn { width: 28px; height: 28px; }
}

/* ── Touch Targets (WCAG 2.5.5: 44x44px minimum) ── */
@media (pointer: coarse), (max-width: 768px) {
    .xcfp-swatch-btn,
    .xcfp-image-swatch-btn,
    .xcfp-chip-remove {
        min-width: 44px;
        min-height: 44px;
    }
    .xcfp-label-btn,
    .xcfp-apply-btn,
    .xcfp-mobile-toggle,
    .xcfp-drawer-close {
        min-height: 44px;
        padding: 10px 16px;
    }
    .xcfp-option {
        min-height: 44px;
        align-items: center;
    }
    .xcfp-filter-header {
        min-height: 44px;
    }
}

/* ── Mobile Landscape ── */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
    .xcfp-drawer { width: 60%; max-width: 400px; }
    .xcfp-drawer-header { padding: 8px 16px; }
    .xcfp-drawer-content {
        max-height: calc(100vh - 100px);
        overflow-y: auto;
    }
}

/* ── High contrast mode ── */
@media (prefers-contrast: more) {
    .xcfp-filter-group + .xcfp-filter-group { border-top-width: 2px; }
    .xcfp-option        { border: 1px solid; }
    .xcfp-filter-title  { font-weight: 800; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
    .xcfp-spinner { animation: none; }
    .xcfp-drawer  { transition: none !important; }
}

/* ── Print styles ── */
@media print {
    .xcfp-filters-wrap,
    .xcfp-mobile-toggle,
    .xcfp-drawer,
    .xcfp-drawer-overlay { display: none !important; }
    .xcfp-shop-content   { width: 100% !important; }
}
