/* Searchable Dropdown Styles */
.searchable-dropdown-wrapper {
    position: relative;
}

.searchable-dropdown .dropdown-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    min-height: 2.5rem;
}

.searchable-dropdown .dropdown-trigger:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.searchable-dropdown .dropdown-trigger .selected-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.searchable-dropdown .dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 50;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    max-height: 15rem;
    overflow: hidden;
    margin-top: 0.25rem;
}

.searchable-dropdown .dropdown-menu.tw-hidden {
    display: none !important;
}

.searchable-dropdown .dropdown-search {
    padding: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.searchable-dropdown .search-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    transition: all 0.2s;
}

.searchable-dropdown .search-input:focus {
    outline: none;
    ring: 2px;
    ring-color: #3b82f6;
    border-color: transparent;
}

.searchable-dropdown .dropdown-options {
    max-height: 12rem;
    overflow-y: auto;
}

.searchable-dropdown .dropdown-option {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background-color 0.15s;
    border-bottom: 1px solid #f3f4f6;
}

.searchable-dropdown .dropdown-option:last-child {
    border-bottom: none;
}

.searchable-dropdown .dropdown-option:hover {
    background-color: #f3f4f6;
}

.searchable-dropdown .dropdown-option[data-disabled="true"] {
    color: #9ca3af;
    cursor: not-allowed;
    background-color: #f9fafb;
}

.searchable-dropdown .dropdown-option[data-disabled="true"]:hover {
    background-color: #f9fafb;
}

/* Animation for chevron rotation */
.searchable-dropdown .fa-chevron-down {
    transition: transform 0.2s ease;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .searchable-dropdown .dropdown-menu {
        max-height: 60vh;
    }
    
    .searchable-dropdown .dropdown-options {
        max-height: calc(60vh - 4rem);
    }
}

/* Loading state */
.searchable-dropdown.loading .dropdown-trigger {
    opacity: 0.6;
    pointer-events: none;
}

.searchable-dropdown.loading .dropdown-trigger::after {
    content: "";
    width: 1rem;
    height: 1rem;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 0.5rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Focus states for accessibility */
.searchable-dropdown .dropdown-option:focus,
.searchable-dropdown .dropdown-option.focused {
    background-color: #dbeafe;
    outline: none;
}

/* Custom scrollbar for dropdown options */
.searchable-dropdown .dropdown-options::-webkit-scrollbar {
    width: 6px;
}

.searchable-dropdown .dropdown-options::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.searchable-dropdown .dropdown-options::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.searchable-dropdown .dropdown-options::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .searchable-dropdown .dropdown-menu {
        background: #1f2937;
        border-color: #374151;
    }
    
    .searchable-dropdown .dropdown-search {
        background: #111827;
        border-color: #374151;
    }
    
    .searchable-dropdown .search-input {
        background: #1f2937;
        border-color: #374151;
        color: #f9fafb;
    }
    
    .searchable-dropdown .dropdown-option {
        color: #f9fafb;
        border-color: #374151;
    }
    
    .searchable-dropdown .dropdown-option:hover {
        background-color: #374151;
    }
}