/* Searchable Select Component Styles */

.ab-searchable-select {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 240px; /* Fixed maximum width */
    min-width: 180px; /* Minimum width for mobile */
}

.ab-searchable-select input.ab-search-input {
    width: 100%;
    padding-right: 30px;
    font-size: 0.875rem; /* Slightly smaller font */
}

/* Normal font weight for placeholder with darker color */
.ab-searchable-select input.ab-search-input::placeholder {
    font-weight: 400;
    color: #495057; /* Darker color, not gray/disabled */
    opacity: 1; /* Full opacity */
}

.ab-searchable-select .ab-dropdown-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: auto;
    color: #6c757d;
}

.ab-searchable-select .ab-dropdown-toggle:hover {
    opacity: 0.7;
}

.ab-searchable-select .ab-options-dropdown {
    position: fixed;
    max-height: 300px;
    min-width: 180px;
    max-width: 320px;
    width: auto;
    overflow-y: auto;
    background: white;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 9999;
    display: none;
}

.ab-searchable-select .ab-options-dropdown.show {
    display: block;
}

.ab-searchable-select .ab-option-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    white-space: nowrap;
    font-size: 0.875rem;
}

.ab-searchable-select .ab-option-item:last-child {
    border-bottom: none;
}

.ab-searchable-select .ab-option-item:hover {
    background-color: #f8f9fa;
}

.ab-searchable-select .ab-option-item.selected {
    background-color: #e9ecef;
}

.ab-searchable-select .ab-option-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #f8f9fa;
}

.ab-searchable-select .ab-option-item.text-danger {
    color: #dc3545 !important;
}

.ab-searchable-select .ab-option-item.text-primary {
    color: #0d6efd !important;
}

.ab-searchable-select .ab-option-item .ab-asterisk-red {
    color: #dc3545;
    font-weight: bold;
    margin-left: 4px;
}

.ab-searchable-select .ab-no-results {
    padding: 0.75rem;
    text-align: center;
    color: #6c757d;
    font-size: 0.875rem;
}

/* Color the input text for selected values (not when typing/searching) */
/* Only apply colored text when input has a value AND matches the selected value */
.ab-searchable-select.ab-skip-selected input.ab-search-input:not(:placeholder-shown):not(:focus) {
    color: #dc3545;
    font-weight: 500;
}

/* For import mapping: show custom fields in blue */
/* For export mapping: don't apply blue color (handled by not adding ab-additional-selected class) */
.ab-searchable-select.ab-additional-selected input.ab-search-input:not(:placeholder-shown):not(:focus) {
    color: #0d6efd;
    font-weight: 500;
}

/* When focused (typing/searching), always use normal black color */
.ab-searchable-select input.ab-search-input:focus {
    color: #212529; /* Normal black text */
    font-weight: 400; /* Normal weight */
}

/* Scrollbar styling for dropdown */
.ab-searchable-select .ab-options-dropdown::-webkit-scrollbar {
    width: 6px;
}

.ab-searchable-select .ab-options-dropdown::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.ab-searchable-select .ab-options-dropdown::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.ab-searchable-select .ab-options-dropdown::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Responsive adjustments */
@media (max-width: 1400px) {
    .ab-searchable-select {
        max-width: 200px;
        min-width: 160px;
    }
}

@media (max-width: 760px) {
    .ab-searchable-select {
        max-width: 100%;
        min-width: 140px;
    }
}
