/* Custom Select Dropdown UI */
.custom-select-container {
    position: relative;
    user-select: none;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 100%;
    padding: 9px 28px 9px 12px;
    border: 1px solid var(--border);
    border-radius: inherit; /* inherit from select-wrapper */
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: inherit;
    transition: var(--transition);
    box-sizing: border-box;
}

.custom-select-trigger:hover {
    border-color: var(--border-hover);
}

.custom-select-container.open .custom-select-trigger {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

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

.custom-select-options {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-card);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-5px);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1000; /* Ensure it stays on top */
    overflow: hidden;
    max-height: min(420px, 55vh);
    overflow-y: auto;
    box-sizing: border-box;
}

.custom-select-container.open .custom-select-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-select-option {
    padding: 10px 14px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: background 0.15s;
}

.custom-select-option:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.custom-select-option.selected {
    background: var(--accent-glow);
    color: var(--accent);
    font-weight: 600;
}

.custom-select-group {
    padding: 8px 14px 4px;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-top: 1px solid var(--border);
}

.custom-select-group:first-child {
    border-top: 0;
}
