/* =================================================================
   Filter Sidebar — filter.css
   /public/site/assets/css/filter.css
================================================================= */

/* ─── Reset main.css global input/button overrides ───────────── */
.filter-sidebar input[type="checkbox"],
.filter-sheet input[type="checkbox"] {
    display: none !important;
    position: absolute !important;
    width: 0 !important;
    height: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.filter-sidebar .filter-section__toggle,
.filter-sheet .filter-section__toggle,
.filter-sidebar .filter-clear-btn,
.filter-sheet .filter-sheet-close,
.filter-sidebar .fc-showmore-btn,
.filter-sheet .fc-showmore-btn {
    -webkit-appearance: none;
    appearance: none;
    box-shadow: none;
}

.filter-sidebar .price-input-wrap input[type="number"],
.filter-sheet .price-input-wrap input[type="number"] {
    height: auto;
    min-height: 0;
    padding: 7px 10px;
    font-size: 13px;
    line-height: 1.4;
    box-shadow: none;
}

.filter-sidebar.is-loading {
    pointer-events: none;
    opacity: .65;
}

/* ─── Filter Sidebar Wrapper ─────────────────────────────────── */
.filter-sidebar {
    background: #fff;
    border-radius: 14px;
    border: 1px solid #f0f0f0;
    overflow: hidden;
    box-shadow: 0 2px 16px rgba(0, 0, 0, .06);
    width: 100%;
    min-width: 0;
}

/* ─── Filter Header ──────────────────────────────────────────── */
.filter-sidebar__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #f4f4f4;
}

.filter-sidebar__head h5 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #1a1a2e;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-sidebar__head h5 svg {
    color: var(--primary-color);
}

.filter-clear-btn {
    font-size: 12px;
    color: #999;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 20px;
    transition: all .2s;
    font-weight: 500;
}

.filter-clear-btn:hover {
    background: #fff0f0;
    color: var(--primary-color);
}

/* ─── Active Chips ───────────────────────────────────────────── */
.filter-chips {
    padding: 10px 16px;
    display: none;
    flex-wrap: wrap;
    gap: 6px;
    border-bottom: 1px solid #f4f4f4;
    transition: all .3s;
}

.filter-chips.has-chips {
    display: flex;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: color-mix(in srgb, var(--primary-color) 12%, #fff);
    color: var(--primary-color);
    border: 1px solid color-mix(in srgb, var(--primary-color) 25%, transparent);
    border-radius: 20px;
    padding: 3px 10px 3px 12px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: default;
    animation: chipIn .2s ease;
}

@keyframes chipIn {
    from { opacity: 0; transform: scale(.85); }
    to   { opacity: 1; transform: scale(1); }
}

.filter-chip button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary-color);
    font-size: 14px;
    line-height: 1;
    padding: 0;
    opacity: .7;
    transition: opacity .15s;
}

.filter-chip button:hover { opacity: 1; }

/* ─── Accordion Section ──────────────────────────────────────── */
.filter-section {
    border-bottom: 1px solid #f4f4f4;
}

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

.filter-section__toggle {
    width: 100%;
    background: none;
    border: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    cursor: pointer;
    text-align: left;
    transition: background .15s;
}

.filter-section__toggle:hover { background: #fafafa; }

.filter-section__toggle .fs-title {
    font-size: 13px;
    font-weight: 700;
    color: #1a1a2e;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.filter-section__toggle .fs-arrow {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f4f4f4;
    transition: transform .25s, background .15s;
    flex-shrink: 0;
}

.filter-section.open .fs-arrow {
    transform: rotate(180deg);
    background: color-mix(in srgb, var(--primary-color) 15%, #fff);
}

.filter-section__body {
    max-height: 0;
    overflow: hidden;
    transition: max-height .35s cubic-bezier(.4, 0, .2, 1);
}

.filter-section.open .filter-section__body {
    max-height: 600px;
}

.filter-section__inner {
    padding: 6px 20px 16px;
}

/* ─── Custom Checkbox Item ───────────────────────────────────── */
.fc-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 4px;
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s;
    user-select: none;
}

.fc-item:hover { background: #fafafa; }

.fc-box {
    width: 18px;
    height: 18px;
    border: 2px solid #ddd;
    border-radius: 5px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s;
    background: #fff;
}

.fc-item:has(input:checked) .fc-box {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.fc-box svg {
    opacity: 0;
    transform: scale(.5);
    transition: all .15s;
    stroke: #fff;
}

.fc-item:has(input:checked) .fc-box svg {
    opacity: 1;
    transform: scale(1);
}

.fc-label {
    font-size: 13px;
    color: #444;
    line-height: 1.3;
    flex: 1;
    transition: color .15s;
}

.fc-item:has(input:checked) .fc-label {
    color: var(--primary-color);
    font-weight: 600;
}

/* ─── Show More / Less ───────────────────────────────────────── */
.fc-showmore {
    margin-top: 6px;
    padding: 4px;
}

.fc-showmore-btn {
    background: none;
    border: 1px solid #e8e8e8;
    border-radius: 20px;
    padding: 4px 14px;
    font-size: 12px;
    color: var(--primary-color);
    cursor: pointer;
    transition: all .2s;
    font-weight: 500;
}

.fc-showmore-btn:hover {
    background: color-mix(in srgb, var(--primary-color) 8%, #fff);
}

/* ─── Price Range ────────────────────────────────────────────── */
.price-inputs {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.price-input-wrap { flex: 1; }

.price-input-wrap label {
    font-size: 11px;
    color: #999;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    display: block;
    margin-bottom: 4px;
}

.price-input-wrap input {
    width: 100%;
    border: 1.5px solid #e8e8e8;
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 13px;
    color: #1a1a2e;
    font-weight: 600;
    outline: none;
    transition: border-color .2s;
    background: #fafafa;
}

.price-input-wrap input:focus {
    border-color: var(--primary-color);
    background: #fff;
}

/* Dual range slider */
.dual-range-wrap {
    position: relative;
    height: 28px;
    margin: 8px 4px 4px;
}

.dual-range-wrap input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    position: absolute;
    width: 100%;
    height: 18px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    pointer-events: none;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    outline: none;
    z-index: 2;
}

.dual-range-wrap input[type="range"]:last-of-type {
    z-index: 3;
}

.dual-range-wrap input[type="range"]::-webkit-slider-runnable-track {
    -webkit-appearance: none;
    height: 4px;
    background: transparent;
    border: none;
    border-radius: 0;
}

.dual-range-wrap input[type="range"]::-moz-range-track {
    height: 4px;
    background: transparent;
    border: none;
    border-radius: 0;
}

.dual-range-wrap input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    pointer-events: all;
    width: 18px;
    height: 18px;
    margin-top: -7px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
    transition: transform .15s;
}

.dual-range-wrap input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.dual-range-wrap input[type="range"]::-moz-range-thumb {
    pointer-events: all;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
    transform: translateY(0);
}

.dual-range-wrap input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.15);
}

.range-track {
    position: absolute;
    width: 100%;
    height: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: #e8e8e8;
    border-radius: 4px;
    pointer-events: none;
}

.range-fill {
    position: absolute;
    height: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary-color);
    border-radius: 4px;
    pointer-events: none;
    z-index: 1;
}

/* ─── Apply Button ───────────────────────────────────────────── */
.filter-apply-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: .03em;
    transition: all .2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 4px;
    white-space: nowrap;
}

.filter-apply-btn:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, .2);
}

.filter-apply-btn:active { transform: translateY(0); }

.filter-apply-btn.loading {
    opacity: .75;
    pointer-events: none;
}

.filter-apply-btn .btn-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, .4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: filterSpin .6s linear infinite;
    display: none;
}

.filter-apply-btn.loading .btn-spinner { display: block; }
.filter-apply-btn.loading .btn-text { display: none; }

@keyframes filterSpin { to { transform: rotate(360deg); } }

.filter-section-footer {
    padding: 14px 20px 20px;
}

/* ─── Mobile Trigger Button ──────────────────────────────────── */
.mobile-filter-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1.5px solid #e8e8e8;
    border-radius: 10px;
    padding: 9px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
    cursor: pointer;
    transition: all .2s;
    width: 100%;
}

.mobile-filter-trigger:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.mobile-filter-trigger .mft-badge {
    margin-left: auto;
    background: var(--primary-color);
    color: #fff;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    min-width: 20px;
    text-align: center;
    display: none;
}

/* ─── Backdrop ───────────────────────────────────────────────── */
.filter-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    z-index: 9998;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity .3s;
}

.filter-backdrop.open { opacity: 1; }

/* ─── Bottom Sheet (Mobile) ──────────────────────────────────── */
.filter-sheet {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 20px 20px 0 0;
    z-index: 9999;
    max-height: 88vh;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform .35s cubic-bezier(.4, 0, .2, 1);
    box-shadow: 0 -4px 40px rgba(0, 0, 0, .15);
}

.filter-sheet.open { transform: translateY(0); }

.filter-sheet__handle {
    width: 36px;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
    margin: 10px auto 0;
    flex-shrink: 0;
}

.filter-sheet__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px 12px;
    border-bottom: 1px solid #f4f4f4;
    flex-shrink: 0;
}

.filter-sheet__head h5 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #1a1a2e;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-sheet-close {
    width: 32px;
    height: 32px;
    border: none;
    background: #f4f4f4;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    color: #666;
    font-size: 16px;
}

.filter-sheet-close:hover { background: #e8e8e8; }

.filter-sheet__chips {
    padding: 8px 16px;
    display: none;
    flex-wrap: wrap;
    gap: 6px;
    border-bottom: 1px solid #f4f4f4;
    flex-shrink: 0;
}

.filter-sheet__chips.has-chips { display: flex; }

.filter-sheet__body {
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

.filter-sheet__footer {
    padding: 14px 20px;
    border-top: 1px solid #f4f4f4;
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    background: #fff;
}

.filter-sheet-clear {
    flex: 1;
    padding: 12px;
    border: 1.5px solid #e8e8e8;
    border-radius: 10px;
    background: #fff;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all .2s;
}

.filter-sheet-clear:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.filter-sheet-apply {
    flex: 2;
    padding: 12px;
    background: var(--primary-color);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all .2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.filter-sheet-apply:hover { filter: brightness(1.08); }

/* ─── Inside sheet reuse desktop accordion styles ────────────── */
.filter-sheet .filter-section { border-bottom: 1px solid #f4f4f4; }
.filter-sheet .filter-section__toggle { padding: 14px 20px; }
.filter-sheet .filter-section__inner { padding: 6px 20px 14px; }
