@media (min-width: 1024px) {
    .category-layout {
        display: flex;
        gap: 2.5rem;
        align-items: flex-start;
    }
}

/* Strict Sidebar Hiding for Mobile (Fixes "Patlak" Layout) */
@media (max-width: 1023px) {

    aside#categorySidebar,
    .sidebar {
        display: none !important;
        visibility: hidden !important;
        width: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
        position: absolute !important;
        pointer-events: none !important;
    }
}

/* Sidebar Sticky Container */
.sidebar-sticky {
    position: sticky;
    top: 2rem;
    background: #ffffff;
    border-radius: 1.5rem;
    padding: 1.25rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.03), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
    scrollbar-width: thin;
}

/* Filter Section Headers */
.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f1f5f9;
}

.filter-group-title {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: #64748b;
    text-transform: uppercase;
}

.filter-section-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.75rem;
    display: block;
}

/* Scrollable area styling */
.sidebar-scroll-area {
    max-height: 240px;
    overflow-y: auto;
    padding-right: 0.5rem;
    margin-right: -0.5rem;
}

/* Custom Scrollbar */
.sidebar-scroll-area::-webkit-scrollbar {
    width: 4px;
}

.sidebar-scroll-area::-webkit-scrollbar-track {
    background: #f8fafc;
    border-radius: 10px;
}

.sidebar-scroll-area::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.sidebar-scroll-area::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Category List */
.cat-list-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.cat-item-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.6rem;
    border-radius: 0.5rem;
    font-size: 0.825rem;
    color: #475569;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.cat-item-link:hover {
    background: #f1f5f9;
    color: #2563eb;
    padding-left: 0.8rem;
}

.cat-item-link.active {
    background: #eff6ff;
    color: #2563eb;
    font-weight: 600;
}

/* Internal Filter Search */
.sidebar-search-wrapper {
    position: relative;
    margin-bottom: 0.75rem;
}

.sidebar-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}

.sidebar-search-input {
    width: 100%;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.625rem;
    padding: 0.4rem 1rem 0.4rem 2.25rem;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.sidebar-search-input:focus {
    background: #ffffff;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    outline: none;
}

/* Filter Items (Checkbox/Radio) */
.filter-item-label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    padding: 0.3rem 0.5rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
    user-select: none;
    width: 100%;
    text-align: left;
}

.filter-item-label:hover {
    background: #f8fafc;
}

.filter-item-label span {
    font-size: 0.825rem;
    font-weight: 500;
    color: #475569;
    line-height: 1.2;
}

.filter-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 1rem;
    height: 1rem;
    border-radius: 0.25rem;
    border: 1.5px solid #cbd5e1;
    background: #fff;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    flex-shrink: 0;
    margin: 0;
}

.filter-checkbox[type="radio"] {
    border-radius: 50%;
}

.filter-checkbox:checked {
    background: #2563eb;
    border-color: #2563eb;
}

.filter-checkbox:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0.4rem;
    height: 0.4rem;
    background: #fff;
    border-radius: 1px;
}

.filter-checkbox[type="radio"]:checked::after {
    border-radius: 50%;
}

/* Filter Group Container */
.filter-group {
    margin-bottom: 1.5rem;
}

.filter-group:last-child {
    margin-bottom: 0;
}

/* Mobile Side-sheet Utilities */
#mobileSidebar {
    z-index: 5000;
    /* Above everything */
}

#mobileSidebarOverlay {
    transition: opacity 0.3s ease;
}

#mobileSidebarContent {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.-translate-x-full {
    transform: translateX(-100%) !important;
}

.translate-x-full {
    transform: translateX(100%) !important;
}

.translate-x-0 {
    transform: translateX(0) !important;
}

.opacity-0 {
    opacity: 0 !important;
}

.opacity-100 {
    opacity: 1 !important;
}

/* Mobile Drawer Specific Fixes */
@media (max-width: 1023px) {
    #mobileSidebarInject .cat-item-link {
        padding: 0.75rem 0.5rem !important;
        font-size: 0.9rem !important;
        border-bottom: 1px solid #f8fafc;
    }

    #mobileSidebarInject .filter-section-title {
        font-size: 0.9rem !important;
        margin-top: 0.5rem;
    }

    #mobileSidebarInject .sidebar-scroll-area {
        max-height: 250px !important;
        overflow-y: auto !important;
        padding-right: 0.5rem;
        -webkit-overflow-scrolling: touch;
    }

    #mobileSidebarInject {
        padding-bottom: 100px !important;
        /* Prevent cut-off by mobile nav */
    }

    #mobileSidebarInject .filter-item-label {
        padding: 0.6rem 0.5rem !important;
    }
}

/* Animation for loader */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}