/* Product Filters Wrapper */
.product-filters-wrapper {
    padding-left: 20px;
    padding-right: 20px;
}

/* Product Filters & Sort Toolbar */
.product-filters-toolbar {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: linear-gradient(135deg, #1a1a1a, #0f0f0f);
    border: 1px solid rgba(42, 42, 42, 0.8);
    border-radius: 12px;
    margin: 0 auto 20px auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 1240px;
    box-sizing: border-box;
    overflow: hidden;
}

/* Ensure toolbar aligns with section content */
#products .product-filters-toolbar {
    padding-left: 20px;
    padding-right: 20px;
}

.filters-left,
.filters-right {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    align-items: center;
    flex: 1 1 auto;
}

.filters-left {
    flex: 1 1 auto;
    min-width: 0;
}

.filters-right {
    flex: 0 0 auto;
    flex-shrink: 0;
}

.filter-group {
    position: relative;
    display: flex;
    align-items: center;
}

/* Search Input */
.search-group {
    position: relative;
    min-width: 150px;
    flex: 0 1 180px;
    max-width: 200px;
}

.product-search-input {
    width: 100%;
    padding: 8px 30px 8px 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(42, 42, 42, 0.8);
    border-radius: 8px;
    color: #fff;
    font-size: 12px;
    transition: all 0.3s ease;
    outline: none;
}

.product-search-input:focus {
    border-color: rgb(3, 122, 122);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(3, 122, 122, 0.2);
}

.product-search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.product-search-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.6);
    pointer-events: none;
    font-size: 12px;
}

/* Filter Selects */
.filter-select {
    padding: 10px 30px 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(42, 42, 42, 0.8);
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 10px;
    transition: all 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Category Filter - Medium size */
#categoryFilter {
    min-width: 140px;
    max-width: 160px;
}

/* Price Filter - Medium size */
#priceFilter {
    min-width: 130px;
    max-width: 150px;
}

/* Stock Filter - Small size */
#stockFilter {
    min-width: 120px;
    max-width: 140px;
}

/* Rating Filter - Small size */
#ratingFilter {
    min-width: 120px;
    max-width: 140px;
}

/* Sort Filter - Medium size */
#sortFilter {
    min-width: 150px;
    max-width: 180px;
}

.filter-select:focus {
    border-color: rgb(3, 122, 122);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(3, 122, 122, 0.2);
}

.filter-select option {
    background: #1a1a1a;
    color: #fff;
    padding: 10px;
}

/* Clear Filters Button */
.clear-filters-btn {
    padding: 10px 16px;
    background: rgba(231, 76, 60, 0.2);
    border: 1px solid rgba(231, 76, 60, 0.5);
    border-radius: 8px;
    color: #e74c3c;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    outline: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.clear-filters-btn:hover {
    background: rgba(231, 76, 60, 0.3);
    border-color: #e74c3c;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(231, 76, 60, 0.3);
}

.clear-filters-btn:active {
    transform: translateY(0);
}

/* Results Info */
.results-info {
    padding: 10px 20px;
    margin: 0 auto;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    width: 100%;
    max-width: 1280px;
    box-sizing: border-box;
}

.results-count {
    color: rgb(3, 122, 122);
    font-weight: 500;
}

/* Mobile Filter Button (Hidden on Desktop) */
.mobile-filter-toggle {
    display: none;
    padding: 10px 16px;
    background: rgb(3, 122, 122);
    border: 1px solid rgb(3, 122, 122);
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    align-items: center;
    gap: 8px;
    outline: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.mobile-filter-toggle:hover {
    background: rgba(3, 122, 122, 0.9);
    transform: translateY(-1px);
}

.mobile-filter-toggle i {
    font-size: 14px;
}

/* Mobile Filter Drawer */
.mobile-filter-drawer {
    display: none;
    position: fixed !important;
    top: 0 !important;
    right: -100%;
    width: 85%;
    max-width: 400px;
    height: 100vh !important;
    height: 100dvh !important; /* Dynamic viewport height for mobile browsers */
    background: linear-gradient(135deg, #1a1a1a, #0f0f0f);
    border-left: 1px solid rgba(42, 42, 42, 0.8);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.5);
    z-index: 10002 !important; /* Above header (1000) and banner (1000) */
    transition: right 0.3s ease;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

.mobile-filter-drawer.active {
    right: 0;
}

.mobile-filter-drawer-overlay {
    display: none;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important; /* Dynamic viewport height for mobile browsers */
    background: rgba(0, 0, 0, 0.7);
    z-index: 10001 !important; /* Just below drawer (10002), above header (1000) and banner (1000) */
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.mobile-filter-drawer-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* Prevent parent containers from clipping the filter drawer */
body:has(.mobile-filter-drawer.active) #mainContainer,
body:has(#mobileFilterDrawer.active) #mainContainer {
    overflow: visible !important;
}

body:has(.mobile-filter-drawer.active) #products,
body:has(#mobileFilterDrawer.active) #products {
    overflow: visible !important;
}

body:has(.mobile-filter-drawer.active) header,
body:has(#mobileFilterDrawer.active) header {
    z-index: 1 !important;
}

body:not(:has(.mobile-filter-drawer.active)) header,
body:not(:has(#mobileFilterDrawer.active)) header {
    z-index: 999 !important;
}

.mobile-filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(42, 42, 42, 0.8);
}

.mobile-filter-header h3 {
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.mobile-filter-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.mobile-filter-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.mobile-filter-section {
    margin-bottom: 25px;
}

.mobile-filter-section label {
    display: block;
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 10px;
}

.mobile-filter-section .filter-select {
    width: 100%;
    min-width: unset;
    max-width: 100%;
}

.mobile-filter-actions {
    position: sticky;
    bottom: 0;
    background: linear-gradient(135deg, #1a1a1a, #0f0f0f);
    padding: 15px 0;
    margin-top: 20px;
    border-top: 1px solid rgba(42, 42, 42, 0.8);
    display: flex;
    gap: 10px;
}

.mobile-filter-actions button {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    outline: none;
}

.mobile-filter-apply {
    background: rgb(3, 122, 122);
    color: #fff;
}

.mobile-filter-apply:hover {
    background: rgba(3, 122, 122, 0.9);
}

.mobile-filter-clear {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.5);
}

.mobile-filter-clear:hover {
    background: rgba(231, 76, 60, 0.3);
}

/* No Results Message */
.no-results-message {
    text-align: center;
    padding: 60px 20px;
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0 auto;
}

.no-results-message i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
    color: rgba(255, 255, 255, 0.5);
    display: block;
    text-align: center;
}

.no-results-message p {
    margin: 0;
    text-align: center;
    width: 100%;
    max-width: 100%;
    display: block;
}

.no-results-message p:first-of-type {
    font-size: 16px;
    margin-bottom: 10px;
    text-align: center;
}

.no-results-message .no-results-subtext,
.no-results-message p:last-of-type {
    font-size: 14px;
    opacity: 0.7;
    text-align: center;
    margin-top: 10px;
}

/* Ensure container allows centering - Break out of grid */
#containerClothing .no-results-message,
#containerAccessories .no-results-message,
#containerClothing .no-results-empty,
#containerAccessories .no-results-empty {
    grid-column: 1 / -1;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.no-results-empty .empty-state-icon { color: rgba(255, 255, 255, 0.5); }
.no-results-clear-btn { margin-top: 16px; }

/* Medium Screen (Tablet) - Prevent overlapping */
@media (max-width: 1024px) and (min-width: 769px) {
    .filters-left {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .filter-group {
        flex-shrink: 1;
        min-width: 0;
    }
    
    /* Reduce min-widths slightly for medium screens */
    .search-group {
        min-width: 140px;
        flex: 0 1 160px;
        max-width: 180px;
    }
    
    #categoryFilter {
        min-width: 120px;
        max-width: 140px;
    }
    
    #priceFilter {
        min-width: 110px;
        max-width: 130px;
    }
    
    #stockFilter {
        min-width: 100px;
        max-width: 120px;
    }
    
    #ratingFilter {
        min-width: 100px;
        max-width: 120px;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .product-filters-toolbar {
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px 15px;
    }
    
    /* Hide desktop filters on mobile */
    .filters-left .filter-group:not(.search-group) {
        display: none;
    }
    
    .filters-right .filter-group:not(:last-child) {
        display: none;
    }
    
    /* Show mobile filter button */
    .mobile-filter-toggle {
        display: flex;
    }
    
    /* Show mobile filter drawer */
    .mobile-filter-drawer {
        display: block;
    }
    
    .mobile-filter-drawer-overlay {
        display: block;
    }
    
    /* Search stays visible */
    .search-group {
        flex: 1 1 auto;
        min-width: 0;
        max-width: 100%;
    }
    
    .product-search-input {
        font-size: 14px;
        padding: 10px 35px 10px 12px;
    }
    
    /* Sort stays visible */
    #sortFilter {
        display: block !important;
        min-width: 140px;
        max-width: 160px;
    }
    
    .clear-filters-btn {
        display: none;
    }
}

@media (max-width: 480px) {
    .product-filters-toolbar {
        padding: 12px;
    }
    
    .product-search-input,
    .filter-select {
        font-size: 13px;
        padding: 8px 30px 8px 12px;
    }
    
    .clear-filters-btn {
        padding: 8px 16px;
        font-size: 13px;
    }
}
