/* =====================================================
   FILTER DROPDOWN THEME FIX
   Passt Select-Dropdowns an alle Themes an
   ===================================================== */

/* === BASE SELECT STYLING === */
body #appSection select {
    background-color: var(--bg-card);
    color: var(--text-main);
    border: 1px solid rgba(var(--brand-rgb), 0.15);
    border-radius: 0.75rem;
    padding: 0.625rem 1rem;
    transition: all 0.2s ease;
    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='%2364748b' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
    padding-right: 2.5rem;
}

select:hover {
    border-color: rgba(var(--brand-rgb), 0.4) !important;
    background-color: rgba(var(--brand-rgb), 0.03) !important;
}

select:focus {
    outline: none !important;
    border-color: rgb(var(--brand-rgb)) !important;
    background-color: var(--bg-card) !important;
    box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.1) !important;
}

/* === OPTION ELEMENTS (DROPDOWN ITEMS) === */
select option {
    background-color: var(--bg-card) !important;
    color: var(--text-main) !important;
    padding: 0.5rem 1rem !important;
}

/* === DARK MODE === */
.dark select {
    background-color: #0F172A !important; /* Exakt --bg-card aus :root */
    color: #F1F5F9 !important; /* Exakt --text-main aus :root */
    border-color: rgba(129, 140, 248, 0.2) !important; /* Wie --card-border */
    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='%2394a3b8' d='M6 9L1 4h10z'/%3E%3C/svg%3E") !important;
}

.dark select:hover {
    background-color: rgba(129, 140, 248, 0.05) !important;
    border-color: rgba(129, 140, 248, 0.4) !important;
}

.dark select:focus {
    border-color: rgb(129, 140, 248) !important;
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.15) !important;
}

.dark select option {
    background-color: #0F172A !important; /* Exakt --bg-card */
    color: #F1F5F9 !important; /* Exakt --text-main */
}

/* Webkit-spezifisch für Dark Mode Dropdown-Menü */
@supports (-webkit-appearance: none) {
    .dark select option {
        background: #0F172A !important;
        color: #F1F5F9 !important;
    }
}

/* === JAPANDI THEME === */
[data-theme="japandi"] select {
    background-color: #F9F7F2 !important; /* Exakt --bg-card aus :root */
    color: #32302E !important; /* Exakt --text-main aus :root */
    border: 1.5px solid rgba(138, 154, 91, 0.25) !important; /* Wie --card-border */
    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='%238c857d' d='M6 9L1 4h10z'/%3E%3C/svg%3E") !important; /* Icon in --text-muted Farbe */
    box-shadow: 4px 4px 0px rgba(138, 154, 91, 0.05) !important; /* Wie --card-shadow */
}

[data-theme="japandi"] select:hover {
    background-color: rgba(138, 154, 91, 0.05) !important;
    border-color: rgba(138, 154, 91, 0.35) !important;
    box-shadow: 4px 4px 0px rgba(138, 154, 91, 0.08) !important;
}

[data-theme="japandi"] select:focus {
    border-color: rgb(138, 154, 91) !important;
    box-shadow: 0 0 0 3px rgba(138, 154, 91, 0.15) !important;
}

[data-theme="japandi"] select option {
    background-color: #F9F7F2 !important; /* Exakt --bg-card */
    color: #32302E !important; /* Exakt --text-main */
}

/* === FIREFOX-SPEZIFISCH === */
@-moz-document url-prefix() {
    select option {
        background-color: var(--bg-card);
        color: var(--text-main);
    }
    
    .dark select option {
        background-color: #0F172A; /* Exakt --bg-card */
        color: #F1F5F9; /* Exakt --text-main */
    }
    
    [data-theme="japandi"] select option {
        background-color: #F9F7F2; /* Exakt --bg-card */
        color: #32302E; /* Exakt --text-main */
    }
}

/* === SELECT IN FILTER CONTAINER === */
#filterContainer select {
    font-size: 0.875rem !important;
    font-weight: 500 !important;
}

#filterContainer select:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}

/* === MOBILE OPTIMIERUNG === */
@media (max-width: 640px) {
    select {
        font-size: 1rem !important; /* Verhindert Zoom auf iOS */
        padding: 0.75rem 1rem !important;
    }
}

/* === ACTIVE/SELECTED STATE === */
select:active {
    transform: scale(0.98) !important;
}

/* === PLACEHOLDER OPTION STYLING === */
select option:first-child {
    color: var(--text-muted) !important;
    font-style: italic !important;
}

.dark select option:first-child {
    color: #94A3B8 !important; /* Exakt --text-muted */
}

[data-theme="japandi"] select option:first-child {
    color: #8C857D !important; /* Exakt --text-muted */
}

/* === ACCESSIBILITY === */
select:focus-visible {
    outline: 2px solid rgb(var(--brand-rgb)) !important;
    outline-offset: 2px !important;
}

/* === HIGH CONTRAST MODE === */
@media (prefers-contrast: high) {
    select {
        border-width: 2px !important;
    }
}

/* === REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {
    select {
        transition: none !important;
    }
}
