.search-container {
    padding: 0.7rem 1rem 0.4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

/* Big, pill-shaped search bar with an inline SVG icon */
#search-bar {
    width: min(650px, 90%);
    max-width: 100%;
    padding: 0.55rem 1rem 0.55rem 3rem;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.06);
    background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.006));
    color: var(--text);
    font-size: 0.9rem;
    box-shadow: 0 6px 18px -12px rgba(0,0,0,0.8), 0 6px 30px -18px rgba(52,217,255,0.03) inset;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2334d9ff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='6'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>");
    background-repeat: no-repeat;
    background-position: 12px center;
    transition: box-shadow 0.18s, transform 0.12s, border-color 0.12s;
    box-sizing: border-box;
}

#search-bar::placeholder {
    color: rgba(232,225,213,0.6);
    font-weight: 600;
}

#search-bar:focus {
    outline: none;
    border-color: rgba(52,217,255,0.9);
    box-shadow: 0 6px 28px -10px rgba(52,217,255,0.14), 0 0 0 6px rgba(52,217,255,0.035);
    transform: translateY(-1px);
}

.filter-sort-container {
    padding: 0 1rem 1rem;
    width: 100%;
    max-width: 100%;
    display: flex;
    justify-content: center;
    margin: 0 auto;
    box-sizing: border-box;
}

.filters {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-start;
    flex-wrap: wrap;
    align-items: center;
    background: rgba(255,255,255,0.02);
    padding: 0.55rem;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.03);
    box-shadow: 0 6px 24px -18px rgba(0,0,0,0.8);
    max-width: 100%;
    box-sizing: border-box;
}

.filters label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.5rem;
    border-radius: 10px;
    color: var(--text-dim);
    font-weight: 600;
    white-space: nowrap;
    min-width: 0;
}

/* Slight style for the new progress select to match other selects */
.filters select#filter-progress {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding: 0.45rem 0.9rem;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.04);
    background: linear-gradient(180deg, rgba(255,255,255,0.012), rgba(0,0,0,0.03));
    color: var(--text);
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.32) inset;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 20 20' fill='none' stroke='%23e8e1d5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 8 10 12 14 8' /></svg>");
    background-repeat: no-repeat;
    background-position: calc(100% - 10px) center;
    padding-right: 2.2rem;
}

.filters select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding: 0.45rem 0.9rem;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.04);
    background: linear-gradient(180deg, rgba(255,255,255,0.012), rgba(0,0,0,0.03));
    color: var(--text);
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.32) inset;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 20 20' fill='none' stroke='%23e8e1d5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 8 10 12 14 8' /></svg>");
    background-repeat: no-repeat;
    background-position: calc(100% - 10px) center;
    padding-right: 2.2rem;
    min-width: 0;
    box-sizing: border-box;
}

/* Enhanced dropdown interactions */
.filters select:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 30px -22px rgba(0,0,0,0.8), 0 6px 20px -14px rgba(52,217,255,0.035) inset;
}

.filters select:focus, .filters select:focus-visible {
    outline: none;
    border-color: rgba(52,217,255,0.9);
    box-shadow: 0 8px 34px -18px rgba(52,217,255,0.12), 0 0 0 6px rgba(52,217,255,0.04);
}

/* Hide native dropdown arrow on IE/Edge while preserving accessibility */
select::-ms-expand {
    display: none;
}

/* Try to style option elements (limited across browsers) */
.filters select option {
    background: linear-gradient(180deg, #1a1a1a, #151515);
    color: var(--text);
    padding: 8px 12px;
}

/* Fancy select styles for the custom select component */
.fancy-select {
    position: relative;
    min-width: 140px;
    box-sizing: border-box;
}

.fancy-select__trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.45rem 0.9rem;
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(255,255,255,0.012), rgba(0,0,0,0.03));
    color: var(--text);
    font-weight: 700;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.04);
    box-shadow: 0 2px 8px rgba(0,0,0,0.32) inset;
    transition: transform 0.12s, box-shadow 0.12s;
    box-sizing: border-box;
    white-space: nowrap;
}

.fancy-select__trigger:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 30px -22px rgba(0,0,0,0.8), 0 6px 20px -14px rgba(52,217,255,0.035) inset;
}

.fancy-select__label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fancy-select__arrow {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    display: inline-block;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 20 20' fill='none' stroke='%23e8e1d5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 8 10 12 14 8' /></svg>");
    background-repeat: no-repeat;
    background-position: center;
    transition: transform 0.2s;
}

.fancy-select__trigger[aria-expanded="true"] .fancy-select__arrow {
    transform: rotate(180deg);
}

.fancy-select__options {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    min-width: 100%;
    width: max-content;
    max-width: 300px;
    background: linear-gradient(180deg, #1a1a1a, #141414);
    border: 1px solid rgba(52,217,255,0.15);
    padding: 0.4rem;
    border-radius: 10px;
    max-height: none;
    overflow: visible;
    z-index: 12000;
    box-shadow: 0 12px 40px rgba(0,0,0,0.7), 0 0 0 1px rgba(52,217,255,0.1);
    display: none;
    box-sizing: border-box;
}

.fancy-select__options.open {
    display: block;
}

.fancy-select__option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.7rem;
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    box-sizing: border-box;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fancy-select__option:hover, .fancy-select__option[aria-selected="true"] {
    background: rgba(52,217,255,0.1);
    color: var(--cyan);
}

.fancy-select__option:focus {
    outline: 2px solid rgba(52,217,255,0.5);
    outline-offset: -2px;
}

.option-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
    flex-shrink: 0;
    filter: brightness(1.1) drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

.fancy-select__label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fancy-select__label img {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Checkbox styled toggle */
.filters input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--cyan);
    cursor: pointer;
}

.clear-filters {
    background: transparent;
    color: var(--text-dim);
    border: 1px dashed rgba(255,255,255,0.04);
    padding: 0.35rem 0.6rem;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.12s, color 0.12s, transform 0.12s;
}

.clear-filters:hover {
    background: rgba(255,255,255,0.02);
    color: var(--text);
    transform: translateY(-2px);
}

/* Small helper for filter 'chips' if we ever transform selections into chips */
.filter-chip {
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    background: rgba(52,217,255,0.06);
    color: var(--cyan);
    font-weight: 700;
    border: 1px solid rgba(52,217,255,0.06);
}

/* Responsive filter layout: grid on smaller screens for better alignment */
@media (max-width: 880px) {
    .filters {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 0.5rem;
        align-items: stretch;
    }

    .filters label {
        white-space: normal;
        justify-content: space-between;
        padding-right: 0.6rem;
    }

    .fancy-select {
        min-width: 0;
    }

    #sort-by {
        min-width: 120px;
    }
}
