/**
 * PopRace.org - Sidebar Filter System (2025 Redesign)
 * Unified sidebar layout with floating search bar
 */

/* ===================================
   MODELS SECTION OVERRIDE
   =================================== */

.models-section {
    padding: 80px 0 40px 0; /* Override default padding for sidebar layout */
    max-width: none;
}

/* ===================================
   MOBILE FILTER TOGGLE (hidden on desktop)
   =================================== */

.mobile-filter-toggle {
    display: none; /* Hidden on desktop */
}

.sidebar-overlay {
    display: none; /* Hidden on desktop */
}

/* ===================================
   SIDEBAR LAYOUT CONTAINER
   =================================== */

.models-layout {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 24px;
    padding: 20px;
    min-height: calc(100vh - 200px);
    max-width: 1800px;
    margin: 0 auto;
}

/* ===================================
   SIDEBAR FILTERS
   =================================== */

.sidebar-filters {
    background: rgba(15, 30, 46, 0.6);
    border: 1px solid rgba(212, 165, 116, 0.3);
    border-radius: var(--radius-xl);
    padding: 20px;
    height: fit-content;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(212, 165, 116, 0.2);
}

.sidebar-title {
    font-size: 1em;
    font-weight: 600;
    color: var(--gold);
}

.sidebar-clear-all {
    font-size: 0.8em;
    color: var(--light-blue-gray);
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.sidebar-clear-all:hover {
    color: var(--cream);
}

/* ===================================
   FILTER GROUPS
   =================================== */

.filter-group {
    margin-bottom: 20px;
}

.filter-group-label {
    font-size: 0.75em;
    font-weight: 600;
    color: var(--light-blue-gray);
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    display: block;
}

.filter-group select,
.filter-group input {
    width: 100%;
    height: 40px;
    padding: 8px 12px;
    border: 1px solid rgba(212, 165, 116, 0.4);
    border-radius: var(--radius-sm);
    background: rgba(30, 58, 95, 0.5);
    color: var(--cream);
    font-size: 0.9em;
    transition: all 0.2s ease;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--bright-gold);
    box-shadow: 0 0 0 3px rgba(244, 196, 48, 0.15);
}

.filter-group select option {
    background: var(--navy-blue);
    color: var(--cream);
}

.sidebar-apply-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--gold), var(--bright-gold));
    color: var(--dark-navy);
    border: none;
    border-radius: var(--radius-lg);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 10px;
}

.sidebar-apply-btn:hover {
    background: linear-gradient(135deg, var(--bright-gold), var(--gold));
    transform: translateY(-1px);
}

/* ===================================
   MAIN CONTENT AREA
   =================================== */

.main-content-area {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0; /* Prevent grid blowout */
    flex: 1;
}

/* ===================================
   FLOATING SEARCH BAR
   =================================== */

.floating-search-bar {
    background: rgba(15, 30, 46, 0.8);
    border: 2px solid var(--gold);
    border-radius: var(--radius-xl);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.floating-search-input {
    flex: 1;
    height: 48px;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-lg);
    background: rgba(30, 58, 95, 0.6);
    color: var(--cream);
    font-size: 1.1em;
    transition: all 0.2s ease;
}

.floating-search-input:focus {
    outline: 2px solid var(--bright-gold);
    background: rgba(30, 58, 95, 0.8);
}

.floating-search-input::placeholder {
    color: var(--light-blue-gray);
}

.floating-sort-select {
    padding: 12px 16px;
    border: 1px solid rgba(212, 165, 116, 0.4);
    border-radius: var(--radius-lg);
    background: rgba(30, 58, 95, 0.5);
    color: var(--cream);
    font-size: 0.9em;
    cursor: pointer;
    height: 48px;
}

.floating-sort-select:focus {
    outline: none;
    border-color: var(--gold);
}

.floating-sort-select option {
    background: var(--navy-blue);
}

.floating-search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 48px;
    background: linear-gradient(135deg, rgba(30, 58, 95, 0.8), rgba(15, 30, 46, 0.9));
    border: 2px solid var(--gold);
    border-radius: var(--radius-lg);
    color: var(--gold);
    cursor: pointer;
    transition: all 0.2s ease;
}

.floating-search-btn:hover {
    background: linear-gradient(135deg, var(--gold), var(--bright-gold));
    color: var(--dark-navy);
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(244, 196, 48, 0.4);
}

.floating-search-btn svg {
    width: 22px;
    height: 22px;
}

/* ===================================
   RESULTS HEADER
   =================================== */

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(212, 165, 116, 0.2);
    flex-wrap: wrap;
    gap: 12px;
}

.results-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.results-count {
    font-size: 0.95em;
    color: var(--cream);
}

.results-count strong {
    color: var(--gold);
    font-size: 1.2em;
}

/* Active Filter Chips */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-chip {
    padding: 4px 10px;
    background: rgba(212, 165, 116, 0.2);
    border: 1px solid rgba(212, 165, 116, 0.4);
    border-radius: var(--radius-xl);
    font-size: 0.75em;
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--cream);
}

.filter-chip-remove {
    width: 14px;
    height: 14px;
    border: none;
    background: rgba(0, 0, 0, 0.2);
    color: var(--cream);
    cursor: pointer;
    font-size: 10px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background 0.2s ease;
}

.filter-chip-remove:hover {
    background: rgba(255, 100, 100, 0.4);
}

/* View Controls */
.view-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Collection Button (in results header) */
#view-collection-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px;
    width: 226px;  /* Match sidebar-apply-btn (250px - 24px padding) */
    max-width: 226px;
    flex: none;
    background: linear-gradient(135deg, var(--gold), var(--bright-gold));
    color: var(--dark-navy);
    border: none;
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 1em;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

#view-collection-btn:hover {
    background: linear-gradient(135deg, var(--bright-gold), var(--gold));
    transform: translateY(-1px);
}

#view-collection-btn .badge {
    background: var(--dark-navy);
    color: var(--gold);
    font-size: 0.85em;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: var(--radius-lg);
    min-width: 14px;
    text-align: center;
}

.collection-toggle-btn .badge {
    background: var(--dark-navy);
    color: var(--gold);
    padding: 2px 8px;
    border-radius: var(--radius-lg);
    font-size: 0.8em;
}

/* Page Size Control */
.page-size-control {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid rgba(212, 165, 116, 0.4);
    border-radius: var(--radius-sm);
    background: rgba(30, 58, 95, 0.5);
    color: var(--cream);
    font-size: 0.85em;
    height: calc(2.5rem + 0.75rem + 4px);
}

.page-size-control select {
    background: transparent;
    border: none;
    color: var(--cream);
    font-size: 0.85em;
    cursor: pointer;
}

.page-size-control select option {
    background: var(--navy-blue);
}

/* ===================================
   MOBILE RESPONSIVE
   =================================== */

@media (max-width: 1024px) {
    .models-layout {
        grid-template-columns: 210px minmax(0, 1fr);
        gap: 16px;
        padding: 16px;
    }
}

@media (max-width: 900px) {
    .models-layout {
        display: block; /* Switch from grid to block on mobile */
        padding: 16px;
    }

    .sidebar-filters {
        position: fixed;
        left: -300px;
        top: 0;
        height: 100vh;
        width: 280px;
        z-index: 1000;
        border-radius: 0;
        transition: left 0.3s ease;
        max-height: 100vh;
    }

    .sidebar-filters.open {
        left: 0;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .sidebar-overlay.visible {
        display: block;
    }

    /* Mobile filter toggle button */
    .mobile-filter-toggle {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 10px 16px;
        background: rgba(30, 58, 95, 0.6);
        border: 1px solid rgba(212, 165, 116, 0.4);
        border-radius: var(--radius-lg);
        color: var(--cream);
        cursor: pointer;
        font-size: 0.9em;
        margin-bottom: 16px;
    }

    .mobile-filter-toggle svg {
        width: 18px;
        height: 18px;
    }

    .results-header {
        flex-direction: column;
        align-items: stretch;
    }

    .results-meta {
        justify-content: space-between;
    }

    .view-controls {
        justify-content: flex-end;
    }
}

/* ===================================
   SIDEBAR SCROLLBAR
   =================================== */

.sidebar-filters::-webkit-scrollbar {
    width: 6px;
}

.sidebar-filters::-webkit-scrollbar-track {
    background: rgba(30, 58, 95, 0.3);
    border-radius: var(--radius-sm);
}

.sidebar-filters::-webkit-scrollbar-thumb {
    background: rgba(212, 165, 116, 0.4);
    border-radius: var(--radius-sm);
}

.sidebar-filters::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 165, 116, 0.6);
}
