/**
 * Advanced WooCommerce Dynamic Filters - Frontend Layouts
 */

/* Layout structures */
.awdf-flex-shop-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 30px;
    width: 100%;
}

.awdf-flex-products-container {
    flex: 1;
    min-width: 0;
}

/* Sidebar styling for Desktop */
.awdf-flex-sidebar-container {
    width: 240px;
    max-width: 260px;
    flex-shrink: 0;
    background: #ffffff;
    padding: 16px 18px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    box-sizing: border-box;
    transition: all 0.3s ease;
}

.awdf-sidebar-title {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Mobile Toggle Button (hidden by default on desktop) */
.awdf-mobile-toggle-btn {
    display: none;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
    border: 1px solid #d1d5db;
    padding: 12px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    color: #374151;
    font-size: 0.9rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    user-select: none;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 15px;
}

.awdf-mobile-toggle-btn:hover {
    border-color: var(--awdf-primary-color, #EF4444);
    color: var(--awdf-primary-color, #EF4444);
}

.awdf-mobile-funnel-icon {
    margin-right: 6px;
    font-size: 1.1rem;
}

.awdf-mobile-btn-arrow {
    transition: transform 0.2s ease;
    font-size: 0.75rem;
}

.awdf-mobile-toggle-btn.active .awdf-mobile-btn-arrow {
    transform: rotate(180deg);
}

/* Responsive transitions */
.awdf-sidebar-inner-content {
    transition: all 0.3s ease;
}

/* RESPONSIVE DESIGN - MEDIA QUERIES FOR TABLET AND MOBILE */

/* 1. Desktop & Large Screens */
@media (min-width: 1024px) {
    .awdf-flex-shop-layout.awdf-sidebar-right {
        flex-direction: row-reverse;
    }
    .awdf-sidebar-inner-content {
        display: block !important; /* Always visible on desktop */
    }
}

/* 2. Tablet Mode (768px to 1023px) */
@media (max-width: 1023px) and (min-width: 768px) {
    .awdf-flex-shop-layout {
        flex-direction: column;
        gap: 20px;
    }
    
    .awdf-flex-sidebar-container {
        width: 100%;
        padding: 0;
        background: transparent;
        border: none;
        box-shadow: none;
    }
    
    .awdf-mobile-toggle-btn {
        display: flex !important; /* Force visible on tablet */
    }
    
    .awdf-sidebar-inner-content {
        display: none; /* Collapsed by default */
        background: #ffffff;
        padding: 25px;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
        margin-top: 5px;
        box-sizing: border-box;
        width: 100%;
    }
    
    .awdf-sidebar-title {
        display: none; /* Hide default title */
    }
    
    /* Sleek 2-column grid inside tablet dropdown to optimize space! */
    .awdf-sidebar-filters .awdf-filters-container,
    .awdf-filters-container {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 25px !important;
    }
    
    .awdf-filter-section {
        border-bottom: none !important;
        padding: 15px !important;
        background: #f8fafc;
        border-radius: 6px;
        border: 1px solid #f1f5f9 !important;
    }
}

/* 3. Mobile Mode (under 768px) */
@media (max-width: 767px) {
    .awdf-flex-shop-layout {
        flex-direction: column;
        gap: 15px;
    }
    
    .awdf-flex-sidebar-container {
        width: 100%;
        padding: 0;
        background: transparent;
        border: none;
        box-shadow: none;
    }
    
    .awdf-mobile-toggle-btn {
        display: flex !important; /* Force visible on mobile */
    }
    
    .awdf-sidebar-inner-content {
        display: none; /* Collapsed by default */
        background: #ffffff;
        padding: 20px;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
        margin-top: 5px;
        box-sizing: border-box;
        width: 100%;
    }
    
    .awdf-sidebar-title {
        display: none;
    }
    
    .awdf-hide-on-mobile {
        display: none !important;
    }
    
    /* Standard 1-column layout inside mobile dropdown */
    .awdf-sidebar-filters .awdf-filters-container,
    .awdf-filters-container {
        display: flex !important;
        flex-direction: column !important;
        gap: 18px !important;
    }
    
    .awdf-filter-section {
        border-bottom: 1px solid #f1f5f9 !important;
        padding: 0 0 15px 0 !important;
    }
    
    .awdf-filter-section:last-child {
        border-bottom: none !important;
        padding-bottom: 0 !important;
    }
}

.awdf-filters-container {
    width: 100%;
    margin-bottom: 1.5em;
    font-family: inherit;
}

.awdf-filter-section {
    border-bottom: 1px solid #E5E7EB;
    padding: 0.85em 0;
}

.awdf-filter-section:last-child {
    border-bottom: none;
}

.awdf-filter-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 0.6em 0;
    color: #111827;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.awdf-filter-body {
    transition: max-height 0.3s ease-out;
}

/* Price Slider styling */
.awdf-price-slider-container {
    padding: 6px 2px;
}

.awdf-price-slider-element.ui-slider {
    position: relative;
    text-align: left;
    background: #E5E7EB;
    height: 6px;
    border-radius: 9999px;
    margin: 12px 4px;
    border: none;
}

.awdf-price-slider-element .ui-slider-range {
    position: absolute;
    z-index: 1;
    display: block;
    border: 0;
    background: var(--awdf-primary-color, #EF4444);
    height: 100%;
    border-radius: 9999px;
}

.awdf-price-slider-element .ui-slider-handle {
    position: absolute;
    z-index: 2;
    width: 16px;
    height: 16px;
    cursor: grab;
    background: #FFFFFF;
    border: 2px solid var(--awdf-primary-color, #EF4444);
    border-radius: 50%;
    top: -5px;
    margin-left: -8px;
    outline: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.1s, background-color 0.1s;
}

.awdf-price-slider-element .ui-slider-handle:hover,
.awdf-price-slider-element .ui-slider-handle:focus {
    transform: scale(1.15);
    background: var(--awdf-primary-color, #EF4444);
    border-color: #FFFFFF;
}

.awdf-price-slider-element .ui-slider-handle:active {
    cursor: grabbing;
}

.awdf-search-wrapper {
    position: relative;
    margin-bottom: 1em;
}

.awdf-search-input {
    width: 100%;
    padding: 0.6em 1em;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.awdf-search-input:focus {
    border-color: var(--awdf-primary-color, #EF4444);
}


/* Advanced Custom Styling dynamically mapped to design tokens */
.awdf-search-input {
    border-radius: var(--awdf-border-radius, 6px);
}
.awdf-search-input:focus {
    border-color: var(--awdf-primary-color, #10b981);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}
.awdf-price-slider-element .ui-slider-range {
    background-color: var(--awdf-primary-color, #10b981) !important;
}
.awdf-price-slider-element .ui-slider-handle {
    border-color: var(--awdf-primary-color, #10b981) !important;
    background: #ffffff !important;
}
.awdf-tag-button.active {
    background-color: var(--awdf-primary-color, #10b981) !important;
    border-color: var(--awdf-primary-color, #10b981) !important;
    color: #ffffff !important;
}
.awdf-cat-checkbox:checked, .awdf-brand-checkbox:checked, .awdf-brand-filter-checkbox:checked, .awdf-stock-checkbox:checked, .awdf-sale-checkbox:checked {
    accent-color: var(--awdf-primary-color, #10b981) !important;
}
