/* ==========================================================================
   EASY3D — Catalog Filters (Sidebar & Mobile Drawer)
   ========================================================================== */

/* Desktop Sidebar Filter */
.catalog-sidebar {
    flex: 0 0 280px; width: 280px; padding: 1.5rem 1.2rem;
    border-radius: 24px; position: sticky !important; top: 95px !important;
    align-self: flex-start !important; z-index: 50;
    background: rgba(255, 255, 255, 0.02); border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    display: flex; flex-direction: column; gap: 1.2rem;
    box-sizing: border-box; box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
}

.sidebar-header {
    margin-bottom: 0.2rem; padding-bottom: 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-header h3 {
    margin: 0; color: var(--text-primary);
    font-size: 1.25rem; font-weight: 700;
}

.filter-block { display: flex; flex-direction: column; gap: 0.6rem; }

.filter-block-title {
    font-size: 0.8rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 1px; color: var(--accent-cyan);
    margin: 0 0 0.2rem 0; display: flex; align-items: center; gap: 6px;
}

.filter-categories-list {
    list-style: none; padding: 0; margin: 0;
    display: flex; flex-direction: column; gap: 0.4rem;
}

.filter-cat-btn {
    display: flex; align-items: center; gap: 0.85rem; padding: 0.8rem 1rem;
    color: var(--text-secondary); text-decoration: none; border-radius: 16px;
    transition: all 0.3s ease; font-weight: 500; background: transparent;
    border: 1px solid transparent; cursor: pointer; font-size: 0.92rem;
    width: 100%; box-sizing: border-box; text-align: left; font-family: var(--font-main);
}

.filter-cat-btn i {
    font-size: 1.05rem; width: 20px; text-align: center;
    color: inherit; transition: color 0.3s ease; flex-shrink: 0;
}

.filter-cat-btn:hover:not(.disabled) {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary); border-color: rgba(255, 255, 255, 0.1);
}

.filter-cat-btn.active {
    background: rgba(0, 229, 255, 0.12); color: var(--accent-cyan);
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.25); font-weight: 700;
    border-color: rgba(0, 229, 255, 0.4);
}

.filter-cat-btn.active i { color: var(--accent-cyan); }

.filter-cat-btn.disabled {
    opacity: 0.45; cursor: not-allowed; background: transparent;
    border-color: transparent; user-select: none;
}

.cat-badge-soon {
    margin-left: auto; font-size: 0.65rem; font-weight: 700;
    padding: 2px 7px; border-radius: 6px;
    background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1);
    color: #a0aec0; text-transform: uppercase; letter-spacing: 0.5px; line-height: 1.2;
}

.filter-price-row { display: flex; align-items: center; gap: 6px; }

.price-input-wrap {
    flex: 1; display: flex; align-items: center;
    background: rgba(0, 0, 0, 0.4); border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px; padding: 0 8px; height: 38px;
}

.price-input-wrap span { font-size: 0.75rem; color: var(--text-secondary); margin-right: 3px; }

.price-input {
    width: 100%; background: transparent; border: none; outline: none;
    color: #fff; font-family: var(--font-main); font-size: 0.85rem;
    font-weight: 600; text-align: right; appearance: textfield; -moz-appearance: textfield;
}

.price-input::-webkit-outer-spin-button,
.price-input::-webkit-inner-spin-button {
    -webkit-appearance: none; margin: 0;
}

.btn-price-apply {
    height: 38px; padding: 0 12px; background: rgba(0, 229, 255, 0.15);
    border: 1px solid rgba(0, 229, 255, 0.4); border-radius: 12px;
    color: var(--accent-cyan); font-family: var(--font-main);
    font-weight: 700; font-size: 0.85rem; cursor: pointer; transition: all 0.2s ease;
}

.btn-price-apply:hover { background: var(--accent-cyan); color: #000; }

/* Custom Checkbox UI */
.filter-checkboxes { display: flex; flex-direction: column; gap: 0.5rem; }

.custom-checkbox-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.65rem 0.9rem; background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 14px;
    cursor: pointer; transition: all 0.25s ease; user-select: none;
}

.custom-checkbox-row:hover {
    background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.12);
}

.checkbox-label-text {
    font-size: 0.85rem; color: var(--text-secondary); font-weight: 500;
    display: flex; align-items: center; transition: color 0.25s ease;
}

.custom-checkbox-input { display: none; }

.custom-checkbox-mark {
    width: 18px; height: 18px; border-radius: 5px; background: rgba(0, 0, 0, 0.4);
    border: 1.5px solid rgba(255, 255, 255, 0.18); display: flex;
    align-items: center; justify-content: center; color: #000; font-size: 0.65rem;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1); flex-shrink: 0;
}

.custom-checkbox-mark i {
    transform: scale(0); transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.custom-checkbox-input:checked + .custom-checkbox-mark {
    background: var(--accent-cyan); border-color: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
}

.custom-checkbox-input:checked + .custom-checkbox-mark i { transform: scale(1); }

.custom-checkbox-row:has(.custom-checkbox-input:checked) {
    border-color: rgba(0, 229, 255, 0.3); background: rgba(0, 229, 255, 0.04);
}

.custom-checkbox-row:has(.custom-checkbox-input:checked) .checkbox-label-text {
    color: #fff; font-weight: 600;
}

.btn-reset-sidebar {
    display: flex; align-items: center; justify-content: center;
    gap: 0.8rem; padding: 0.85rem 1.1rem; color: rgba(255, 77, 77, 0.85);
    border-radius: 16px; transition: all 0.3s ease; font-weight: 600;
    background: rgba(255, 77, 77, 0.06); border: 1px solid rgba(255, 77, 77, 0.18);
    cursor: pointer; font-size: 0.92rem; width: 100%; box-sizing: border-box;
    font-family: var(--font-main); margin-top: 0.4rem;
}

.btn-reset-sidebar:hover {
    background: rgba(255, 77, 77, 0.16); color: #ff4d4d;
    border-color: rgba(255, 77, 77, 0.4); box-shadow: 0 0 18px rgba(255, 77, 77, 0.25);
    transform: translateY(-1px);
}

/* ==========================================================================
   Mobile Filter Drawer
   — Overlay covers entire screen including navbar (z-index > navbar's 9999)
   — Content panel: header (fixed) + scrollable area + sticky buttons at bottom
   ========================================================================== */

/* Full-screen overlay — z-index MUST beat navbar (9999) and cart (999998) */
.mobile-filter-drawer {
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 1000000; /* above navbar (9999) and cart (999998/999999) */
    display: flex;
    justify-content: flex-start;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-filter-drawer.open {
    opacity: 1;
    visibility: visible;
}

/* Slide-in panel — uses flex column so inner parts can share the height */
.mobile-filter-content {
    width: 86%;
    max-width: 320px;
    height: 100%;
    height: 100dvh;
    max-height: 100dvh;
    background: #080a0f;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 15px 0 50px rgba(0, 0, 0, 0.95);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
    /* NO overflow here — children handle it */
}

.mobile-filter-drawer.open .mobile-filter-content {
    transform: translateX(0);
}

/* ── Top header — always visible, never scrolls ── */
.mobile-filter-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1rem 0.6rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.mobile-filter-header h3 {
    margin: 0;
    font-size: 1.05rem;
    color: #fff;
    font-weight: 700;
}

.btn-close-filter {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
}

/* ── Scrollable middle area ── */
.mobile-filter-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    /* Custom thin scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(0,229,255,0.25) transparent;
}

.mobile-filter-scroll::-webkit-scrollbar { width: 4px; }
.mobile-filter-scroll::-webkit-scrollbar-track { background: transparent; }
.mobile-filter-scroll::-webkit-scrollbar-thumb {
    background: rgba(0,229,255,0.25);
    border-radius: 4px;
}

/* ── Sticky bottom buttons — always visible ── */
.mobile-filter-actions {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 0.75rem 1rem calc(0.85rem + env(safe-area-inset-bottom, 16px));
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: #080a0f;
}

/* Apply & Reset Buttons */
.btn-apply-drawer {
    width: 100%;
    height: 44px;
    border-radius: 50px;
    background: linear-gradient(135deg, rgba(0, 229, 255, 0.22), rgba(179, 136, 255, 0.22));
    border: 1px solid rgba(0, 229, 255, 0.45);
    color: #fff;
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 0.92rem;
    letter-spacing: 0.3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0, 229, 255, 0.2);
    transition: all 0.25s ease;
}

.btn-apply-drawer:active {
    transform: scale(0.98);
    background: linear-gradient(135deg, rgba(0, 229, 255, 0.35), rgba(179, 136, 255, 0.35));
}

.mobile-filter-actions .btn-reset-sidebar {
    padding: 0.6rem 0.9rem;
    font-size: 0.84rem;
    margin-top: 0;
    border-radius: 14px;
}

/* Compact sizes for filter items inside the scrollable area */
.mobile-filter-scroll .filter-block { gap: 0.4rem; }
.mobile-filter-scroll .filter-block-title { font-size: 0.74rem; margin-bottom: 0.05rem; }
.mobile-filter-scroll .filter-categories-list { gap: 0.25rem; }

.mobile-filter-scroll .filter-cat-btn {
    padding: 0.5rem 0.8rem;
    border-radius: 12px;
    font-size: 0.87rem;
    gap: 0.7rem;
}

.mobile-filter-scroll .filter-cat-btn i { font-size: 0.95rem; width: 18px; }

.mobile-filter-scroll .price-input-wrap { height: 34px; border-radius: 10px; padding: 0 7px; }
.mobile-filter-scroll .price-input { font-size: 0.83rem; }

.mobile-filter-scroll .filter-checkboxes { gap: 0.35rem; }
.mobile-filter-scroll .custom-checkbox-row { padding: 0.5rem 0.75rem; border-radius: 12px; }
.mobile-filter-scroll .checkbox-label-text { font-size: 0.83rem; }
