/* =============================================
   FILTER SIDEBAR — Multi-Level Drill-Down
   ============================================= */

/* ---- Base ---- */
#filter-container {
    transition: all 0.3s ease;
    border-radius: 1rem;
    scroll-behavior: smooth;
}

/* Hide the underlying <select> elements (still in DOM for filter logic) */
.filter-select-hidden {
    display: none !important;
}

/* =============================================
   SIDEBAR INNER WRAPPER
   ============================================= */
.filter-sidebar-inner {
    padding: 0;
    overflow: hidden;
    border-radius: 1rem;
}

/* =============================================
   PANELS VIEWPORT (clips overflow during slide)
   ============================================= */
.filter-panels-viewport {
    position: relative;
    overflow: hidden;
    /* Height is driven by the tallest panel — we let JS manage height */
}

/* =============================================
   FILTER PANELS (main + sub)
   ============================================= */
.filter-panel {
    width: 100%;
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

/* Main panel: visible by default */
#filter-panel-main {
    transform: translateX(0);
}

/* Main panel slide-out to left */
#filter-panel-main.panel-slide-out {
    transform: translateX(-100%);
}

/* Sub-panels: hidden off-screen to the right by default */
.filter-sub-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

/* Sub-panel slide-in */
.filter-sub-panel.panel-slide-in {
    transform: translateX(0);
}

/* =============================================
   MAIN PANEL — HEADER
   ============================================= */
.filter-main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.filter-main-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #334155;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.filter-main-title i {
    color: #6366f1;
}

/* Reset button (inside main header) */
.filter-reset-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.7rem;
    font-weight: 700;
    color: #ef4444;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 999px;
    padding: 0.25rem 0.65rem;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-reset-btn:hover {
    background: #fee2e2;
    transform: scale(1.03);
}

.filter-reset-btn i {
    transition: transform 0.5s;
}

.filter-reset-btn:hover i {
    transform: rotate(180deg);
}

.filter-reset-btn.hidden {
    display: none !important;
}

/* =============================================
   MAIN PANEL — MENU LIST
   ============================================= */
.filter-menu-list {
    list-style: none;
    padding: 0.5rem 0;
    margin: 0;
}

.filter-menu-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.7rem 1rem;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    border-radius: 0;
    position: relative;
}

.filter-menu-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 1rem;
    right: 1rem;
    height: 1px;
    background: rgba(148, 163, 184, 0.12);
}

.filter-menu-item:last-child::after {
    display: none;
}

.filter-menu-item:hover {
    background: rgba(99, 102, 241, 0.06);
}

.filter-menu-item:active {
    transform: scale(0.98);
    background: rgba(99, 102, 241, 0.1);
}

/* Active/selected state for menu item */
.filter-menu-item.has-active-filter .filter-menu-icon {
    background: #eef2ff;
    color: #6366f1;
}

.filter-menu-item.has-active-filter .filter-menu-label {
    color: #4f46e5;
    font-weight: 700;
}

.filter-menu-item.has-active-filter .filter-menu-value {
    color: #6366f1;
    font-weight: 600;
}

.filter-menu-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    background: #f1f5f9;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
    transition: all 0.2s;
}

.filter-menu-content {
    flex: 1;
    min-width: 0;
}

.filter-menu-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: #334155;
    line-height: 1.2;
}

.filter-menu-value {
    display: block;
    font-size: 0.7rem;
    color: #94a3b8;
    margin-top: 0.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s;
}

.filter-menu-chevron {
    font-size: 0.65rem;
    color: #cbd5e1;
    flex-shrink: 0;
    transition: transform 0.2s, color 0.2s;
}

.filter-menu-item:hover .filter-menu-chevron {
    color: #6366f1;
    transform: translateX(2px);
}

/* =============================================
   SUB-PANEL — HEADER (Back button + Title)
   ============================================= */
.filter-sub-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.875rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    background: linear-gradient(to right, rgba(99, 102, 241, 0.04), transparent);
}

.filter-back-btn {
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #6366f1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
    font-size: 0.75rem;
}

.filter-back-btn:hover {
    background: #eef2ff;
    border-color: #c7d2fe;
    transform: translateX(-2px);
}

.filter-back-btn:active {
    transform: scale(0.9);
}

.filter-sub-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.filter-sub-title i {
    color: #6366f1;
}

/* =============================================
   SUB-PANEL — OPTIONS LIST
   ============================================= */
.filter-options-list {
    list-style: none;
    padding: 0.5rem 0;
    margin: 0;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    scrollbar-width: thin;
}

.filter-options-list::-webkit-scrollbar {
    width: 3px;
}

.filter-options-list::-webkit-scrollbar-track {
    background: transparent;
}

.filter-options-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

.filter-option-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1rem;
    cursor: pointer;
    font-size: 0.82rem;
    color: #475569;
    transition: background 0.15s, color 0.15s;
    gap: 0.5rem;
}

.filter-option-item:hover {
    background: rgba(99, 102, 241, 0.05);
    color: #4f46e5;
}

.filter-option-item.selected {
    color: #4f46e5;
    font-weight: 700;
    background: rgba(99, 102, 241, 0.07);
}

.filter-option-item.selected::after {
    content: '\f00c'; /* fa-check */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.65rem;
    color: #6366f1;
    flex-shrink: 0;
}

.filter-option-label {
    flex: 1;
    line-height: 1.3;
}

/* "Semua" option styling */
.filter-option-item.option-all {
    font-weight: 600;
    color: #64748b;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
    margin-bottom: 0.25rem;
}

.filter-option-item.option-all:hover {
    color: #4f46e5;
}

/* =============================================
   DESKTOP (≥1024px): Sidebar nested in main flex
   ============================================= */
/* =============================================
   DESKTOP (≥1024px): Sidebar nested in main flex
   ============================================= */
   @media (min-width: 1024px) {
    main#gallery {
        display: flex;
        gap: 1.5rem;
        align-items: flex-start; /* Ini sudah benar, dipertahankan */
    }

    #filter-container {
        width: 240px;
        flex-shrink: 0;
        scrollbar-width: thin;
        display: block;
        
        /* --- TAMBAHAN UNTUK STICKY --- */
        position: sticky;
        top: 100px; /* Menyesuaikan offset dari fixed navbar kamu */
        height: max-content; /* Penting: agar tinggi container tidak stretch */
        z-index: 10; /* Agar tidak tertumpuk card saat di-scroll */
    }

    #filter-container.hidden {
        display: none !important;
    }

    .filter-sidebar-inner {
        /* position: sticky dan top: 100px DIHAPUS DARI SINI */
        
        /* Pertahankan ini agar internal scrolling menu filternya tetap jalan */
        max-height: calc(100vh - 120px);
        overflow: hidden; 
    }

    .filter-options-list {
        max-height: calc(100vh - 260px);
    }

    #filter-container::-webkit-scrollbar {
        width: 4px;
    }

    #desktop-filter-btn {
        position: relative;
        z-index: 45;
        transition: all 0.2s;
    }

    body:not(.filter-sidebar-closed) #desktop-filter-btn {
        background-color: #eef2ff;
        color: #4f46e5;
        border-color: #c7d2fe;
    }
}

/* =============================================
   MOBILE (<1024px): Fixed dropdown
   ============================================= */
@media (max-width: 1023px) {
    #filter-container {
        position: fixed;
        top: 80px;
        left: 1rem;
        right: 1rem;
        width: calc(100% - 2rem);
        z-index: 50;
        border-radius: 1rem;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    }

    #filter-container.hidden {
        display: none !important;
    }

    .filter-sidebar-inner {
        max-height: 70vh;
        overflow: hidden;
    }

    .filter-options-list {
        max-height: 40vh;
    }

    .filter-panels-viewport {
        max-height: 65vh;
    }
}

/* =============================================
   NAVBAR FILTER BUTTONS
   ============================================= */
#desktop-filter-btn i,
#mobile-filter-btn i {
    transition: transform 0.2s;
}

/* =============================================
   DARK THEME
   ============================================= */
[data-theme="dark"] .filter-main-title {
    color: #cbd5e1;
}

[data-theme="dark"] .filter-menu-label {
    color: #cbd5e1;
}

[data-theme="dark"] .filter-menu-icon {
    background: #1e293b;
    color: #94a3b8;
}

[data-theme="dark"] .filter-menu-item:hover {
    background: rgba(99, 102, 241, 0.08);
}

[data-theme="dark"] .filter-menu-item.has-active-filter .filter-menu-icon {
    background: #1e293b;
}

[data-theme="dark"] .filter-main-header,
[data-theme="dark"] .filter-sub-header {
    border-color: rgba(100, 116, 139, 0.2);
}

[data-theme="dark"] .filter-back-btn {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .filter-back-btn:hover {
    background: rgba(99, 102, 241, 0.15);
}

[data-theme="dark"] .filter-sub-title {
    color: #e2e8f0;
}

[data-theme="dark"] .filter-option-item {
    color: #94a3b8;
}

[data-theme="dark"] .filter-option-item:hover,
[data-theme="dark"] .filter-option-item.selected {
    color: #818cf8;
    background: rgba(99, 102, 241, 0.1);
}

[data-theme="dark"] .filter-option-item.option-all {
    border-color: rgba(100, 116, 139, 0.15);
}

/* =============================================
   TECH ICONS IN FILTER OPTIONS
   ============================================= */
.filter-option-content-wrapper {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1; /* Pastikan teks membentang sempurna */
}

/* Style jika icon berupa file gambar (assets/icon/...) */
img.filter-tech-icon {
    width: 1.1rem;
    height: 1.1rem;
    object-fit: contain;
    flex-shrink: 0;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.05));
}

/* Style fallback jika icon berupa font-icon (fa-solid, dll) */
i.filter-tech-icon {
    width: 1.1rem;
    font-size: 1rem;
    text-align: center;
    color: inherit;
    flex-shrink: 0;
}