/*
=============================================================================
CUSTOM DROPDOWNS CSS - Enhanced Select Element Styling
=============================================================================
*/

/* Native Select Styling */
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3csvg xmlns='http://www.w3.org/2000/svg' width='4' height='5' viewBox='0 0 4 5'%3e%3cpath fill='%23ffffff' d='M2 0L0 2h4zm0 5L0 3h4z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
    padding-right: 2.5rem;
    color-scheme: dark;
}

/* Select Options Styling */
select option {
    background: var(--bg-card) !important;
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
    padding: 0.5rem;
}

select option:not(:disabled) {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}

select:focus option,
select option:hover,
select option:checked,
select option:selected {
    background: var(--bg-card) !important;
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

select optgroup {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}

/* Custom Select Component */
.custom-select {
    position: relative;
    display: inline-block;
    width: 100%;
    cursor: pointer;
}

.custom-select-trigger {
    background: var(--bg-secondary) !important;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    color: var(--text-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
    cursor: pointer;
    transition: border-color 0.3s;
    width: 100%;
    box-sizing: border-box;
}

.custom-select-trigger:hover,
.custom-select.open .custom-select-trigger {
    border-color: var(--primary-magenta);
    background: var(--bg-card) !important;
}

.custom-select-arrow {
    color: var(--text-secondary);
    font-size: 0.8rem;
    transition: transform 0.3s;
}

.custom-select.open .custom-select-arrow {
    transform: rotate(180deg);
}

.custom-select-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card) !important;
    border: 2px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 12px var(--shadow-color);
}

.custom-select.open .custom-select-options {
    display: block;
}

.custom-select-option {
    padding: 0.75rem;
    cursor: pointer;
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border: none;
    transition: background-color 0.2s;
    display: block;
    width: 100%;
    text-align: left;
    font-size: 1rem;
}

.custom-select-option:hover {
    background: var(--primary-magenta) !important;
    color: var(--text-primary) !important;
}

.custom-select-option.selected {
    background: var(--primary-purple) !important;
    color: var(--text-primary) !important;
}

/* Custom Scrollbar for Dropdown */
.custom-select-options::-webkit-scrollbar {
    width: 8px;
}

.custom-select-options::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.custom-select-options::-webkit-scrollbar-thumb {
    background: var(--primary-magenta);
    border-radius: 4px;
}

.custom-select-options::-webkit-scrollbar-thumb:hover {
    background: var(--primary-purple);
}

/* Browser-Specific Fixes */
/* Chrome/Safari Scrollbar */
select::-webkit-scrollbar {
    background-color: var(--bg-secondary);
}

select::-webkit-scrollbar-thumb {
    background-color: var(--primary-magenta);
}

/* Firefox Dropdown Fixes */
@-moz-document url-prefix() {
    select option {
        background-color: var(--bg-secondary) !important;
        color: var(--text-primary) !important;
    }
}

/* Edge Dropdown Fixes */
select::-ms-expand {
    background-color: var(--bg-secondary);
}

/* Prevent White Backgrounds */
.search-section, .player-search-section, .overview-card {
    background: var(--bg-secondary) !important;
}

/* Animation for Dropdown */
@keyframes slideDown {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.custom-select-options {
    animation: slideDown 0.2s ease-out;
}