/* Styles for the custom sort dropdown on desktop */
.custom-sort-container {
    position: relative;
}

.custom-sort-container select#input-sort {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 10px 30px 10px 15px;
    cursor: pointer;
    width: 100%;
    font-size: 14px;
    background-image: none;
}

.custom-sort-container::after {
    content: "\f078";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    pointer-events: none;
    color: #6c757d;
}

/* --- Mobile Specific Styles --- */
@media (max-width: 991.98px) {
    /* --- Category Filter Sidebar (Left) --- */
    body.category-sidebar-open {
        overflow: hidden;
    }
    #category-sidebar-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1040;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease;
    }
    body.category-sidebar-open #category-sidebar-backdrop {
        opacity: 1;
        visibility: visible;
    }
    #column-left {
        position: fixed;
        top: 0;
        left: 0;
        width: 300px;
        max-width: 80%;
        height: 100%;
        background: #fff;
        z-index: 1050;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
        padding: 20px;
        box-shadow: 0 0 15px rgba(0,0,0,0.2);
    }
    body.category-sidebar-open #column-left {
        transform: translateX(0);
    }
    #column-left .sidebar-title {
        font-size: 18px;
        font-weight: 600;
        margin-top: 30px; /* Add space below the close button */
        margin-bottom: 15px;
        padding-bottom: 10px;
        border-bottom: 1px solid #f0f0f0;
    }
    #column-left #category-sidebar-close {
        position: absolute;
        top: 10px;
        right: 15px;
        z-index: 10;
    }

    /* --- Sort UI (Right Button & Bottom Sheet) --- */
    .custom-sort-container {
        display: none;
    }
    #category-mobile-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    .category-mobile-header-left {
        display: flex;
        align-items: center;
        cursor: pointer;
    }
    #category-sidebar-toggle,
    #mobile-sort-toggle {
        width: 40px;
        height: 40px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        border: 1px solid #dee2e6;
    }
    .sidebar-toggle-text {
        font-size: 0.9em;
        margin-left: 10px;
        color: #6c757d;
        font-weight: 500;
    }
    body.sort-sheet-open {
        overflow: hidden;
    }
    #mobile-sort-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.3);
        z-index: 1055;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease;
    }
    body.sort-sheet-open #mobile-sort-backdrop {
        opacity: 1;
        visibility: visible;
    }
    #mobile-sort-content {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 45%;
        background: #fff;
        z-index: 1060;
        transform: translateY(100%);
        transition: transform 0.3s ease;
        border-top-left-radius: 16px;
        border-top-right-radius: 16px;
        padding: 15px;
        display: flex;
        flex-direction: column;
    }
    body.sort-sheet-open #mobile-sort-content {
        transform: translateY(0);
    }
    .mobile-sort-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-bottom: 10px;
        border-bottom: 1px solid #f0f0f0;
    }
    .mobile-sort-header h4 {
        margin: 0;
        font-size: 18px;
        font-weight: 600;
    }
    #mobile-sort-options {
        overflow-y: auto;
        padding-top: 10px;
    }
    .mobile-sort-list li a {
        display: block;
        padding: 12px 10px;
        text-decoration: none;
        color: #333;
        font-size: 16px;
        border-radius: 6px;
    }
    .mobile-sort-list li a.active {
        background-color: #f0f0f0;
        font-weight: 600;
        color: #6f4e37;
    }
}

/* --- Sub-category Button Styles --- */
.subcat-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 1px solid #e9e9e9;
}

.subcat-btn {
    display: inline-block;
    padding: 8px 15px;
    font-size: 14px;
    font-weight: 500;
    color: #555;
    background-color: #fff;
    border: 1px solid #e9e9e9;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease-in-out;
}

.subcat-btn:hover {
    background-color: #f5f5f5;
    color: #333;
    border-color: #ddd;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
}

