/* 
   =========================================
   BENJA PREMIUM FILTER SYSTEM v14.0
   Apple-Standard Design & Logic
   ========================================= 
*/

:root {
    --f-primary: #0071e3;
    --f-bg-glass: rgba(255, 255, 255, 0.82);
    --f-bg-dark: rgba(29, 29, 31, 0.94);
    --f-blur: saturate(180%) blur(25px);
    --f-shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
    --f-radius: 24px;
    --f-transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 1. FILTER TRIGGER BUTTON */
.f-trigger {
    position: fixed;
    bottom: 32px;
    left: 32px;
    z-index: 8500;
    height: 54px;
    padding: 0 24px;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: var(--f-shadow);
    transition: var(--f-transition);
}

.f-trigger:hover {
    transform: translateY(-4px) scale(1.02);
    background: #1d1d1f;
}

.f-trigger svg {
    width: 18px;
    height: 18px;
    stroke-width: 2.5;
}

/* 2. FILTER DRAWER / PANEL */
.f-panel {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    height: 100vh;
    background: var(--f-bg-glass);
    backdrop-filter: var(--f-blur);
    -webkit-backdrop-filter: var(--f-blur);
    z-index: 11000;
    box-shadow: -10px 0 50px rgba(0, 0, 0, 0.1);
    transition: var(--f-transition);
    display: flex;
    flex-direction: column;
    padding: 32px;
    border-left: 1px solid rgba(255, 255, 255, 0.3);
}

.f-panel.active {
    right: 0;
}

.f-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.f-header h2 {
    font-size: 1.8rem;
    font-weight: 800;
    color: #1d1d1f;
    margin: 0;
}

.f-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #86868b;
    transition: 0.3s;
}

.f-close:hover {
    color: #000;
}

.f-view {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.f-body {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
}

.f-body::-webkit-scrollbar {
    width: 4px;
}

.f-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

/* 3. FILTER GROUPS */
.f-group {
    margin-bottom: 32px;
}

.f-group-title {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #86868b;
    margin-bottom: 16px;
    display: block;
}

/* Pills Multi-Select */
.f-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.f-pill {
    padding: 10px 18px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: 0.3s;
    border: 1px solid transparent;
}

.f-pill:hover {
    background: rgba(0, 0, 0, 0.08);
}

.f-pill.active {
    background: #000;
    color: #fff;
    border-color: #000;
}

/* 4. PRICE RANGE SLIDER (Premium styling) */
.f-range-container {
    margin: 20px 0;
}

.f-price-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-weight: 700;
    color: #1d1d1f;
}

.f-slider-root {
    position: relative;
    width: 100%;
    height: 4px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 2px;
}

.f-slider-track {
    position: absolute;
    height: 100%;
    background: var(--f-primary);
    border-radius: 2px;
}

.f-slider-handle {
    position: absolute;
    top: 50%;
    width: 24px;
    height: 24px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s;
}

.f-slider-handle:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

/* 5. TOGGLES & SELECTS */
.f-toggle-group {
    display: flex;
    background: rgba(0, 0, 0, 0.04);
    padding: 4px;
    border-radius: 12px;
}

.f-toggle-opt {
    flex: 1;
    text-align: center;
    padding: 10px;
    cursor: pointer;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.85rem;
    transition: 0.3s;
}

.f-toggle-opt.active {
    background: #fff;
    color: #000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.f-sort-select {
    display: none;
}

/* 6. RESULTS VIEW INSIDE PANEL */
.f-results-container {
    display: none;
    flex-direction: column;
    height: 100%;
}

.f-results-container.active {
    display: flex;
}

.f-results-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
}

.f-results-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.f-result-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: 0.3s;
}

.f-result-item:hover {
    background: rgba(0, 0, 0, 0.06);
    transform: translateX(5px);
}

.f-result-img {
    width: 60px;
    height: 60px;
    background: #fff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.f-result-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.f-result-info h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #1d1d1f;
}

.f-result-info .price {
    font-size: 0.85rem;
    color: var(--f-primary);
    font-weight: 700;
    margin-top: 2px;
}

.f-btn-back {
    width: 100%;
    padding: 14px;
    background: rgba(0, 0, 0, 0.04);
    border: none;
    border-radius: 14px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 15px;
    transition: 0.3s;
}

.f-btn-back:hover {
    background: rgba(0, 0, 0, 0.08);
}

/* 6. FOOTER ACTIONS */
.f-footer {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.f-btn-apply {
    flex: 2;
    background: #000;
    color: #fff;
    padding: 16px;
    border-radius: 16px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: 0.3s;
}

.f-btn-reset {
    flex: 1;
    background: rgba(0, 0, 0, 0.04);
    color: #1d1d1f;
    padding: 16px;
    border-radius: 16px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: 0.3s;
}

.f-btn-apply:hover {
    background: #1d1d1f;
    transform: translateY(-2px);
}

/* MOBILE */
@media (max-width: 600px) {
    .f-panel {
        width: 100%;
        right: -100%;
        padding: 24px;
    }

    .f-trigger {
        left: 16px;
        bottom: 84px;
        width: 56px;
        padding: 0;
        justify-content: center;
    }

    .f-trigger span {
        display: none;
    }
}

/* ========================================
   DARK MODE SUPPORT - PREMIUM GOLD THEME
   ======================================== */

[data-theme="dark"] .f-panel {
    background: linear-gradient(180deg, #0d0d0d 0%, #000000 100%);
    color: #fff;
    border-left: 1px solid rgba(197, 160, 89, 0.15);
    box-shadow: -15px 0 60px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .f-header {
    border-bottom: 1px solid rgba(197, 160, 89, 0.1);
    padding-bottom: 24px;
    margin-bottom: 32px;
}

[data-theme="dark"] .f-header h2 {
    background: linear-gradient(180deg, #ffffff 0%, #c5a059 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 2rem;
}

[data-theme="dark"] .f-close {
    color: rgba(255, 255, 255, 0.5);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

[data-theme="dark"] .f-close:hover {
    color: #c5a059;
    background: rgba(197, 160, 89, 0.1);
}

[data-theme="dark"] .f-group {
    padding-bottom: 28px;
    margin-bottom: 28px;
    border-bottom: 1px solid rgba(197, 160, 89, 0.08);
}

[data-theme="dark"] .f-group:last-of-type {
    border-bottom: none;
}

[data-theme="dark"] .f-group-title {
    color: #c5a059;
    font-size: 0.75rem;
    letter-spacing: 1.5px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

[data-theme="dark"] .f-group-title::before {
    content: '';
    width: 3px;
    height: 14px;
    background: #c5a059;
    border-radius: 2px;
}

/* Pills - Premium Glass Style */
[data-theme="dark"] .f-pills {
    gap: 10px;
}

[data-theme="dark"] .f-pill {
    background: rgba(255, 255, 255, 0.03);
    color: #eaddca;
    border: 1px solid rgba(197, 160, 89, 0.15);
    border-radius: 12px;
    padding: 12px 20px;
    font-size: 0.9rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

[data-theme="dark"] .f-pill:hover {
    background: rgba(197, 160, 89, 0.08);
    border-color: rgba(197, 160, 89, 0.3);
    color: #ffffff;
    transform: translateY(-1px);
}

[data-theme="dark"] .f-pill.active {
    background: linear-gradient(135deg, #c5a059 0%, #a88942 100%);
    color: #000000;
    border-color: #c5a059;
    font-weight: 700;
    box-shadow: 0 4px 20px rgba(197, 160, 89, 0.25);
}

/* Price Labels */
[data-theme="dark"] .f-price-labels {
    color: #ffffff;
    font-size: 1rem;
}

[data-theme="dark"] .f-price-labels span:first-child,
[data-theme="dark"] .f-price-labels span:last-child {
    background: rgba(197, 160, 89, 0.1);
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid rgba(197, 160, 89, 0.2);
    font-size: 0.9rem;
}

/* Slider Track & Handle */
[data-theme="dark"] .f-slider-root {
    background: rgba(255, 255, 255, 0.1);
    height: 6px;
    border-radius: 3px;
}

[data-theme="dark"] .f-slider-track {
    background: linear-gradient(90deg, #a88942 0%, #c5a059 100%);
}

[data-theme="dark"] .f-slider-handle {
    background: #c5a059;
    border: 3px solid #000;
    width: 28px;
    height: 28px;
    box-shadow: 0 4px 15px rgba(197, 160, 89, 0.4);
}

[data-theme="dark"] .f-slider-handle:hover {
    box-shadow: 0 6px 20px rgba(197, 160, 89, 0.5);
}

/* Toggle Groups */
[data-theme="dark"] .f-toggle-group {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(197, 160, 89, 0.1);
    padding: 6px;
    border-radius: 14px;
}

[data-theme="dark"] .f-toggle-opt {
    color: rgba(255, 255, 255, 0.6);
    padding: 12px 20px;
    border-radius: 10px;
}

[data-theme="dark"] .f-toggle-opt:hover {
    color: #ffffff;
    background: rgba(197, 160, 89, 0.05);
}

[data-theme="dark"] .f-toggle-opt.active {
    background: rgba(197, 160, 89, 0.15);
    color: #c5a059;
    font-weight: 700;
    box-shadow: 0 2px 10px rgba(197, 160, 89, 0.15);
}

/* Footer Buttons */
[data-theme="dark"] .f-footer {
    padding-top: 20px;
    border-top: 1px solid rgba(197, 160, 89, 0.1);
}

[data-theme="dark"] .f-btn-apply {
    background: linear-gradient(135deg, #c5a059 0%, #a88942 100%);
    color: #000000;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 8px 25px rgba(197, 160, 89, 0.3);
    border: none;
}

[data-theme="dark"] .f-btn-apply:hover {
    background: linear-gradient(135deg, #d4af6a 0%, #b99a53 100%);
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(197, 160, 89, 0.4);
}

[data-theme="dark"] .f-btn-reset {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(197, 160, 89, 0.15);
}

[data-theme="dark"] .f-btn-reset:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border-color: rgba(197, 160, 89, 0.3);
}

/* Results View */
[data-theme="dark"] .f-result-item {
    background: rgba(197, 160, 89, 0.05);
    border: 1px solid rgba(197, 160, 89, 0.1);
}

[data-theme="dark"] .f-result-item:hover {
    background: rgba(197, 160, 89, 0.1);
    border-color: rgba(197, 160, 89, 0.2);
    transform: translateX(5px);
}

[data-theme="dark"] .f-result-info h4 {
    color: #ffffff;
}

[data-theme="dark"] .f-result-info .price {
    color: #c5a059;
}

[data-theme="dark"] .f-btn-back {
    background: rgba(255, 255, 255, 0.05);
    color: #eaddca;
    border: 1px solid rgba(197, 160, 89, 0.15);
}

[data-theme="dark"] .f-btn-back:hover {
    background: rgba(197, 160, 89, 0.1);
    color: #c5a059;
    border-color: rgba(197, 160, 89, 0.3);
}

[data-theme="dark"] .f-result-img {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(197, 160, 89, 0.1);
}

[data-theme="dark"] .f-sort-select {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border: 1px solid rgba(197, 160, 89, 0.2);
    border-radius: 10px;
    padding: 10px 14px;
}

/* Scrollbar */
[data-theme="dark"] .f-body::-webkit-scrollbar-thumb {
    background: rgba(197, 160, 89, 0.3);
}

[data-theme="dark"] .f-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
}