/**
 * Modern Pill-Based Filter Styles
 * AIClips V2 Theme - Items Page
 */

/* ============================================
   FILTER PILL WRAPPER
   ============================================ */

.filter-pill-wrapper {
    position: relative;
}

/* ============================================
   FILTER PILL STYLES
   ============================================ */

.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background-color: white;
    border: 1.5px solid #e5e7eb;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.filter-pill:hover {
    background-color: #f9fafb;
    border-color: #d1d5db;
}

.filter-pill.pill-active {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border-color: #2563eb;
    color: white;
}

.filter-pill.pill-active:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    border-color: #1d4ed8;
}

/* Active state chevron rotation */
.filter-pill.active .chevron-icon {
    transform: rotate(180deg);
}

/* Dark mode for filter pills */
:is(.dark *) .filter-pill {
    background-color: #1f2937;
    border-color: rgba(255, 255, 255, 0.1);
    color: #d1d5db;
}

:is(.dark *) .filter-pill:hover {
    background-color: #374151;
    border-color: rgba(255, 255, 255, 0.2);
}

:is(.dark *) .filter-pill.pill-active {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border-color: #2563eb;
    color: white;
}

:is(.dark *) .filter-pill.pill-active:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
}

/* ============================================
   PILL BADGE STYLES
   ============================================ */

.pill-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.375rem;
    background-color: rgba(255, 255, 255, 0.25);
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
}

.filter-pill:not(.pill-active) .pill-badge {
    background-color: #dbeafe;
    color: #1e40af;
}

:is(.dark *) .filter-pill:not(.pill-active) .pill-badge {
    background-color: rgba(37, 99, 235, 0.2);
    color: #60a5fa;
}

/* ============================================
   PILL DROPDOWN STYLES
   ============================================ */

.pill-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    background-color: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    z-index: 100;
    min-width: 200px;
    max-width: 320px;
    animation: slideDown 0.2s ease-out;
}

:is(.dark *) .pill-dropdown {
    background-color: #1f2937;
    border-color: rgba(255, 255, 255, 0.1);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pill-dropdown.is-open {
    display: block;
}


/* ============================================
   CHEVRON ICON TRANSITION
   ============================================ */

.chevron-icon {
    transition: transform 0.2s ease;
}

/* ============================================
   PRICE RANGE SLIDER STYLES
   ============================================ */

/* Slider container needs proper positioning */
.price-range-slider {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
    height: 100%;
    outline: none;
}

/* WebKit/Chrome slider thumb */
.price-range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #2563eb;
    border: 4px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.2s ease;
    position: relative;
    z-index: 2;
}

.price-range-slider::-webkit-slider-thumb:hover {
    background: #1d4ed8;
    transform: scale(1.15);
    box-shadow: 0 3px 6px rgba(37, 99, 235, 0.3);
}

.price-range-slider::-webkit-slider-thumb:active {
    transform: scale(1.25);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.4);
}

/* Firefox slider thumb */
.price-range-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #2563eb;
    border: 4px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.2s ease;
}

.price-range-slider::-moz-range-thumb:hover {
    background: #1d4ed8;
    transform: scale(1.15);
    box-shadow: 0 3px 6px rgba(37, 99, 235, 0.3);
}

.price-range-slider::-moz-range-thumb:active {
    transform: scale(1.25);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.4);
}

/* Slider progress bar (active range) */
.slider-progress {
    position: absolute;
    height: 6px;
    background: linear-gradient(90deg, #3b82f6, #2563eb);
    border-radius: 3px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 1;
}

/* Slider track background */
.price-range-slider::before {
    content: '';
    position: absolute;
    height: 6px;
    width: 100%;
    background: #e5e7eb;
    border-radius: 3px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 0;
}

/* Dark mode slider styles */
:is(.dark *) .price-range-slider::before {
    background: #374151;
}

:is(.dark *) .price-range-slider::-webkit-slider-thumb {
    border-color: #1f2937;
}

:is(.dark *) .price-range-slider::-moz-range-thumb {
    border-color: #1f2937;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    /* Stack filter bar on mobile */
    .filter-main-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .filter-pills-container {
        overflow-x: auto;
        padding-bottom: 0.5rem;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .filter-pills-container::-webkit-scrollbar {
        height: 4px;
    }

    .filter-pills-container::-webkit-scrollbar-track {
        background: #f3f4f6;
        border-radius: 2px;
    }

    .filter-pills-container::-webkit-scrollbar-thumb {
        background: #d1d5db;
        border-radius: 2px;
    }

    :is(.dark *) .filter-pills-container::-webkit-scrollbar-track {
        background: #374151;
    }

    :is(.dark *) .filter-pills-container::-webkit-scrollbar-thumb {
        background: #6b7280;
    }

    .sort-selector-wrapper {
        width: 100%;
    }

    .sort-selector-btn {
        width: 100%;
        justify-content: space-between;
    }

    /* Mobile Dropdown Fix - Prevent Overflow with Fixed Positioning */
    .pill-dropdown {
        position: fixed !important;
        max-width: calc(100vw - 2rem);
        left: 1rem !important;
        right: 1rem !important;
        top: auto !important;
        z-index: 9999;
    }

    .filter-pill-wrapper {
        position: static;
    }

    /* Center dropdown below trigger - calculated via JS */
    .pill-dropdown.is-open {
        transform: translateY(0);
    }
}

@media (max-width: 640px) {
    .filter-pill {
        padding: 0.5rem 0.875rem;
        font-size: 0.8125rem;
    }

    .pill-badge {
        min-width: 1.125rem;
        height: 1.125rem;
        font-size: 0.6875rem;
    }

    .sort-selector-btn {
        padding: 0.5rem 0.875rem;
        font-size: 0.8125rem;
    }
}

/* ============================================
   ACTIVE FILTERS SECTION
   ============================================ */

.active-filters {
    margin-top: 1rem;
}

.filter-chip {
    cursor: default;
}

.clear-all-filters {
    cursor: pointer;
}

.clear-all-filters:hover {
    border-color: #dc2626;
}

/* ============================================
   ACCESSIBILITY & FOCUS STATES
   ============================================ */

.filter-pill:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

:is(.dark *) .filter-pill:focus-visible {
    outline-color: #60a5fa;
}

/* ============================================
   LOADING & DISABLED STATES
   ============================================ */

.filter-pill:disabled,
.sort-selector-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

