/**
 * SearchableSelect Component Styles
 *
 * Uses CSS variables from themes.css for automatic light/dark theme support
 */

/* === WRAPPER === */
.searchable-select {
    position: relative;
    width: 100%;
}

.searchable-select.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* === TRIGGER BUTTON === */
.searchable-select-trigger {
    width: 100%;
    min-height: 38px;
    padding: var(--space-2) var(--space-3);
    font-size: var(--font-size-sm);
    font-family: var(--font-family);
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    text-align: left;
}

.searchable-select-trigger:hover:not(.disabled) {
    background-color: var(--bg-hover);
    border-color: var(--border-hover);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.searchable-select-trigger:focus {
    outline: none;
    background-color: var(--bg-primary);
}

.searchable-select-trigger.active {
    border-color: var(--border-hover);
    background-color: var(--bg-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.searchable-select.disabled .searchable-select-trigger {
    cursor: not-allowed;
    background-color: var(--bg-secondary);
}

/* === TRIGGER VALUE === */
.searchable-select-value {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary);
}

.searchable-select-value.has-value {
    color: var(--text-primary);
}

/* === TRIGGER ARROW === */
.searchable-select-arrow {
    flex-shrink: 0;
    font-size: 20px;
    color: var(--text-secondary);
    transition: transform var(--transition-base);
}

.searchable-select-trigger.active .searchable-select-arrow {
    transform: rotate(180deg);
}

/* === DROPDOWN === */
.searchable-select-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 1000;

    background-color: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);

    max-height: 300px;
    display: flex;
    flex-direction: column;

    opacity: 1;
    transform: translateY(0);
    transition: opacity var(--transition-base), transform var(--transition-base);
}

.searchable-select-dropdown.hidden {
    display: none;
    opacity: 0;
    transform: translateY(-8px);
}

/* === SEARCH INPUT === */
.searchable-select-search {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    font-size: var(--font-size-sm);
    font-family: var(--font-family);
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    border: none;
    border-bottom: 1px solid var(--border-primary);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    outline: none;
}

.searchable-select-search::placeholder {
    color: var(--text-tertiary);
}

.searchable-select-search:focus {
    background-color: var(--bg-primary);
}

/* === OPTIONS LIST === */
.searchable-select-options {
    overflow-y: auto;
    max-height: 250px;
    padding: var(--space-1) 0;
}

/* Custom scrollbar for options list */
.searchable-select-options::-webkit-scrollbar {
    width: 8px;
}

.searchable-select-options::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.searchable-select-options::-webkit-scrollbar-thumb {
    background: var(--border-primary);
    border-radius: var(--radius-md);
    border: 2px solid var(--bg-secondary);
}

.searchable-select-options::-webkit-scrollbar-thumb:hover {
    background: var(--border-secondary);
}

.searchable-select-options {
    scrollbar-width: thin;
    scrollbar-color: var(--border-primary) var(--bg-secondary);
}

/* === OPTION ITEM === */
.searchable-select-option {
    padding: var(--space-2) var(--space-3);
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    cursor: pointer;
    transition: background-color var(--transition-base);
}

.searchable-select-option:hover {
    background-color: var(--bg-hover);
}

.searchable-select-option.highlighted {
    background-color: var(--bg-tertiary);
}

.searchable-select-option.selected {
    background-color: var(--bg-tertiary);
    color: var(--brand-primary);
    font-weight: var(--font-weight-medium);
}

.searchable-select-option.selected:hover {
    background-color: var(--bg-hover);
}

/* === EMPTY STATE === */
.searchable-select-empty {
    padding: var(--space-3);
    text-align: center;
    color: var(--text-tertiary);
    font-size: var(--font-size-sm);
    font-style: italic;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .searchable-select-dropdown {
        max-height: 250px;
    }

    .searchable-select-options {
        max-height: 200px;
    }
}
