/* Advanced Product Filters - Frontend Styles */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap');

.apf-filter-container {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: 100%;
    width: 100%;
}

/* Sticky Filter Header */
.apf-sticky-header {
    position: sticky;
    top: 32px; /* WordPress admin bar offset */
    background: #fff;
    z-index: 100;
    padding: 0 0 2rem 0;
    margin-bottom: 0;
    transition: box-shadow 0.2s;
}

.apf-sticky-header.is-stuck {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border-bottom: 1px solid #f0f0f0;
}

/* Scrollable Products Container */
.apf-products-scroll-container {
    max-height: 1050px; /* 50% increase from 700px */
    overflow-y: auto;
    padding-right: 8px;
    scroll-behavior: smooth;
    width: 100%;
}

.apf-products-scroll-container::-webkit-scrollbar {
    width: 4px;
}

.apf-products-scroll-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.apf-products-scroll-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.apf-products-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Stats Section */
.apf-stats-section {
    background: #f5f5f5;
    padding: 3rem 0;
    margin-bottom: 2rem;
    text-align: center;
}

.apf-stat-item {
    display: inline-block;
    padding: 0 2rem;
}

.apf-stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: #1a1a1a;
    margin-bottom: 0.5rem;
}

.apf-stat-label {
    color: #666;
    font-size: 1rem;
}

/* Active Filters */
.apf-active-filters {
    margin-bottom: 1.5rem;
    padding: 0;
    background: transparent;
}

.apf-active-filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.apf-active-count {
    font-weight: 600;
    color: #1a1a1a;
    font-size: 1.125rem;
}

.apf-clear-all {
    background: none;
    border: none;
    color: #1a1a1a;
    cursor: pointer;
    font-weight: 500;
    padding: 0.5rem 1rem;
    font-size: 0.9375rem;
}

.apf-clear-all:hover {
    text-decoration: underline;
}

.apf-active-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.apf-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    background: #273AE5;
    color: white;
    padding: 0.625rem 1rem;
    border-radius: 50px;
    font-size: 0.9375rem;
    font-weight: 500;
    transition: background 0.2s;
}

.apf-filter-tag:hover {
    background: #1e2ebf;
}

.apf-tag-remove {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    line-height: 1;
}

.apf-tag-remove:hover {
    opacity: 0.8;
}

/* Filter Dropdowns */
.apf-filter-dropdowns {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.75rem;
    gap: 0.5rem;
    margin-bottom: 0;
    align-items: flex-start;
    
}

.apf-filters-left {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    gap: 0.5rem;
    align-items: center;
    flex: 1;
    min-width: 0;
}

/* Sort Dropdown */
.apf-sort-dropdown {
    flex-shrink: 0;
    margin-left: 1rem;
}

.apf-sort-select {
    padding: 0.75rem 2.5rem 0.75rem 1.25rem;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    background: white;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #1a1a1a;
    cursor: pointer;
    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='%236b7280' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.875rem center;
    background-size: 12px;
    min-width: 160px;
    transition: all 0.2s;
    accent-color: #273AE5;
}

.apf-sort-select:hover {
    border-color: #273AE5;
    box-shadow: 0 0 0 1px #273AE5;
}

.apf-sort-select:focus {
    outline: none;
    border-color: #273AE5;
    box-shadow: 0 0 0 2px rgba(39, 58, 229, 0.1);
}

.apf-filter-dropdown {
    position: relative;
}

.apf-dropdown-button {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem 1.25rem;
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #1a1a1a;
    transition: all 0.2s;
}

.apf-dropdown-button:hover {
    border-color: #273AE5;
    box-shadow: 0 0 0 1px #273AE5;
}

.apf-filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    background: #273AE5;
    color: white;
    border-radius: 50%;
    font-size: 0.8125rem;
    font-weight: 600;
}

.apf-dropdown-icon {
    font-size: 0.625rem;
    color: #6b7280;
    transition: transform 0.2s;
}

.apf-filter-dropdown.active .apf-dropdown-icon {
    transform: rotate(180deg);
}

.apf-dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    min-width: 280px;
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 0.75rem;
    display: none;
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
}

.apf-filter-dropdown.active .apf-dropdown-menu {
    display: block;
}

.apf-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s;
}

.apf-dropdown-item:hover {
    background: #f8f9fa;
}

.apf-dropdown-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #273AE5;
}

.apf-option-label {
    flex: 1;
    font-size: 0.875rem;
    color: #374151;
}

.apf-option-count {
    font-size: 0.75rem;
    color: #9ca3af;
}

/* Results Count */
.apf-results-count {
    margin-top: 1rem;
    margin-bottom: 0;
    color: #6b7280;
    font-size: 0.875rem;
}

/* Products Grid */
.apf-products-grid {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 2rem;
    width: 100%;
}

/* Dynamic column classes for desktop */
.apf-products-grid[data-columns-desktop="1"] { grid-template-columns: repeat(1, 1fr); }
.apf-products-grid[data-columns-desktop="2"] { grid-template-columns: repeat(2, 1fr); }
.apf-products-grid[data-columns-desktop="3"] { grid-template-columns: repeat(3, 1fr); }
.apf-products-grid[data-columns-desktop="4"] { grid-template-columns: repeat(4, 1fr); }
.apf-products-grid[data-columns-desktop="5"] { grid-template-columns: repeat(5, 1fr); }
.apf-products-grid[data-columns-desktop="6"] { grid-template-columns: repeat(6, 1fr); }

.apf-product-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.apf-product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.apf-product-image {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: #000;
}

.apf-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.apf-product-card:hover .apf-product-image img {
    transform: scale(1.05);
}

/* Video Player Styles */
.apf-video-player {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.apf-video-player::-webkit-media-controls-panel {
    background: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.8) 100%);
}

.apf-video-player::-webkit-media-controls-play-button,
.apf-video-player::-webkit-media-controls-timeline,
.apf-video-player::-webkit-media-controls-current-time-display,
.apf-video-player::-webkit-media-controls-time-remaining-display,
.apf-video-player::-webkit-media-controls-mute-button,
.apf-video-player::-webkit-media-controls-volume-slider,
.apf-video-player::-webkit-media-controls-fullscreen-button {
    filter: brightness(1.2);
}

.apf-product-info {
    padding: 1rem;
}

.apf-product-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.apf-product-price {
    color: #4361ee;
    font-weight: 600;
    font-size: 1.125rem;
}

/* Loading State */
.apf-loading {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
    grid-column: 1 / -1;
}

/* No Results */
.apf-no-results {
    text-align: center;
    padding: 3rem;
    grid-column: 1 / -1;
}

.apf-no-results-text {
    font-size: 1.125rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.apf-no-results-hint {
    font-size: 0.875rem;
    color: #9ca3af;
}

/* Tablet Responsive */
@media (max-width: 1024px) and (min-width: 769px) {
    .apf-products-grid[data-columns-tablet="1"] { grid-template-columns: repeat(1, 1fr); }
    .apf-products-grid[data-columns-tablet="2"] { grid-template-columns: repeat(2, 1fr); }
    .apf-products-grid[data-columns-tablet="3"] { grid-template-columns: repeat(3, 1fr); }
    .apf-products-grid[data-columns-tablet="4"] { grid-template-columns: repeat(4, 1fr); }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .apf-sticky-header {
        top: 46px; /* Mobile admin bar is taller */
    }
    
    .apf-filter-dropdowns {
        flex-direction: column;
        gap: 0.625rem;
    }
    
    .apf-filters-left {
        width: 100%;
        flex-direction: column;
        gap: 0.625rem;
    }
    
    .apf-sort-dropdown {
        width: 100%;
        margin-left: 0;
        order: -1; /* Move sort to top on mobile */
    }
    
    .apf-sort-select {
        width: 100%;
        padding: 0.75rem 2.5rem 0.75rem 1.25rem;
        font-size: 0.875rem;
    }
    
    .apf-dropdown-button {
        width: 100%;
        justify-content: space-between;
        padding: 0.75rem 0.875rem;
        font-size: 0.875rem;
    }
    
    .apf-filter-badge {
        min-width: 20px;
        height: 20px;
        padding: 0 6px;
        font-size: 0.75rem;
        flex-shrink: 0;
    }
    
    .apf-dropdown-icon {
        flex-shrink: 0;
    }
    
    .apf-dropdown-menu {
        left: 0;
        right: 0;
        min-width: 100%;
    }
    
    .apf-products-scroll-container {
        max-height: 1400px; /* 2x the original 700px */
    }
    
    .apf-products-grid[data-columns-mobile="1"] { grid-template-columns: repeat(1, 1fr); }
    .apf-products-grid[data-columns-mobile="2"] { grid-template-columns: repeat(2, 1fr); }
    .apf-products-grid[data-columns-mobile="3"] { grid-template-columns: repeat(3, 1fr); }
    
    .apf-products-grid {
        gap: 1.25rem;
    }
    
    .apf-filter-tag {
        font-size: 0.875rem;
        padding: 0.5rem 0.875rem;
    }
}
