/**
 * Desktop Layout Fix
 * This CSS ensures the desktop layout works correctly with sidebar on the left
 * while maintaining mobile functionality
 */

/* ===============================================
   DESKTOP LAYOUT FIXES
   =============================================== */

/* Ensure desktop sidebar is visible on desktop */
@media (min-width: 992px) {

    /* Desktop sidebar should be visible and properly positioned */
    .sidebar-shop.col-lg-3.order-lg-first.d-none.d-lg-block {
        display: block !important;
        flex: 0 0 25% !important;
        max-width: 25% !important;
        order: -1 !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: static !important;
        left: auto !important;
        top: auto !important;
        z-index: auto !important;
        overflow: visible !important;
        width: auto !important;
        height: auto !important;
    }

    /* Ensure main content takes correct width on desktop */
    .woocommerce .main-content,
    .main-content {
        flex: 0 0 75% !important;
        max-width: 75% !important;
    }

    /* Force correct Bootstrap grid behavior on desktop */
    .woocommerce .col-lg-9 {
        flex: 0 0 75% !important;
        max-width: 75% !important;
    }

    .woocommerce .col-lg-3 {
        display: block !important;
        flex: 0 0 25% !important;
        max-width: 25% !important;
    }

    /* Ensure the row has proper flexbox behavior */
    .woocommerce .row {
        display: flex !important;
        flex-wrap: wrap !important;
        margin-left: -15px !important;
        margin-right: -15px !important;
    }

    /* Override any mobile-specific hiding rules for desktop */
    .sidebar-shop:not(.mobile-sidebar) {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: static !important;
        left: auto !important;
    }

    /* Hide mobile-specific elements on desktop */
    .mobile-sidebar,
    .filter-toggle-container,
    .sidebar-overlay {
        display: none !important;
    }

    /* Desktop sidebar styling */
    .sidebar-shop {
        padding: 20px 15px;
        background: #fff;
        border: 1px solid #eee;
        border-radius: 5px;
        margin-bottom: 30px;
    }

    .sidebar-shop .widget {
        margin-bottom: 25px;
        padding-bottom: 20px;
        border-bottom: 1px solid #eee;
    }

    .sidebar-shop .widget:last-child {
        border-bottom: none;
        margin-bottom: 0;
    }

    .sidebar-shop .widget-title {
        font-size: 16px;
        font-weight: 600;
        margin-bottom: 15px;
        color: #333;
    }

    .sidebar-shop .widget-title a {
        color: #333;
        text-decoration: none;
    }

    .sidebar-shop .widget-title a:hover {
        color: #007cba;
    }
}

/* ===============================================
   MOBILE LAYOUT - PRESERVE EXISTING FUNCTIONALITY
   =============================================== */

@media (max-width: 991px) {

    /* Hide desktop sidebar on mobile */
    .sidebar-shop.col-lg-3.order-lg-first.d-none.d-lg-block {
        display: none !important;
    }

    /* Show mobile-specific elements */
    .filter-toggle-container {
        display: block !important;
    }
    
    /* Mobile sidebar and overlay styles are handled by mobile-responsive-fix.css */

    /* Force main content to full width on mobile */
    .woocommerce .main-content,
    .main-content {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    .woocommerce .col-lg-9 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
}

/* ===============================================
   GENERAL IMPROVEMENTS
   =============================================== */

/* Filter widget styling */
.widget .filter-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

.widget .filter-items li {
    margin-bottom: 8px;
}

.custom-control-label {
    cursor: pointer;
    font-size: 14px;
    color: #666;
}

.custom-control-input:checked~.custom-control-label {
    color: #333;
    font-weight: 500;
}

/* Hierarchical filter styling */
.filter-items.hierarchical .filter-group {
    margin-bottom: 15px;
}

.filter-items.hierarchical .parent-term {
    margin-bottom: 5px;
}

.filter-items.hierarchical .child-terms {
    margin-left: 20px;
    border-left: 2px solid #eee;
    padding-left: 15px;
}

.filter-items.hierarchical .child-term {
    margin-bottom: 3px;
}

.toggle-children {
    cursor: pointer;
    margin-left: 5px;
    color: #999;
    transition: transform 0.2s ease;
}

.toggle-children.expanded {
    transform: rotate(180deg);
}

/* Button styling */
.clear-filters {
    width: 100%;
    margin-top: 15px;
}

.btn-primary {
    background-color: #007cba;
    border-color: #007cba;
}

.btn-primary:hover {
    background-color: #005a87;
    border-color: #005a87;
}