/* Custom Dropdown Component */

.custom-dropdown {
    position: relative;
    width: 100%;
}

.dropdown-button {
    width: 100%;
    padding: 12px 40px 12px 16px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-color);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dropdown-button:hover {
    border-color: var(--primary-color);
}

.dropdown-button.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.dropdown-arrow {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--primary-light);
    transition: transform 0.2s ease;
}

.dropdown-button.active .dropdown-arrow {
    transform: translateY(-50%) rotate(180deg);
}

.custom-dropdown .dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.custom-dropdown .dropdown-menu.active {
    max-height: 400px;
    opacity: 1;
    transform: translateY(0);
}

.dropdown-search {
    padding: 10px;
    margin: 10px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-color);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s ease;
}

.dropdown-search:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.dropdown-search::placeholder {
    color: var(--text-muted);
}

.dropdown-list {
    overflow-y: auto;
    max-height: 300px;
    padding: 8px;
}

.dropdown-list::-webkit-scrollbar {
    width: 8px;
}

.dropdown-list::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 6px;
}

.dropdown-list::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 6px;
}

.dropdown-list::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

.custom-dropdown .dropdown-item {
    padding: 10px 14px;
    color: var(--text-color);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.custom-dropdown .dropdown-item:hover {
    background: rgba(99, 102, 241, 0.1);
}

.custom-dropdown .dropdown-item.selected {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary-light);
    font-weight: 600;
}

.custom-dropdown .dropdown-item.selected::after {
    content: '✓';
    margin-left: auto;
    color: var(--success-color);
    font-weight: bold;
}

.custom-dropdown .dropdown-item.hidden {
    display: none;
}

.custom-dropdown .dropdown-no-results {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}

.custom-dropdown .dropdown-item-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.custom-dropdown .dropdown-item-text {
    flex: 1;
}

.custom-dropdown.disabled .dropdown-button {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.custom-dropdown.small .dropdown-button {
    padding: 8px 32px 8px 12px;
    font-size: 0.9rem;
}

.custom-dropdown.small .dropdown-arrow {
    right: 12px;
}

.custom-dropdown.large .dropdown-button {
    padding: 14px 44px 14px 18px;
    font-size: 1.1rem;
}

.custom-dropdown.large .dropdown-arrow {
    right: 18px;
}

@media (max-width: 768px) {
    .custom-dropdown .dropdown-menu {
        position: fixed;
        left: 20px;
        right: 20px;
        top: auto;
        bottom: 20px;
        border-radius: 12px;
    }
}

.custom-dropdown .dropdown-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--text-muted);
}

.custom-dropdown .dropdown-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(99, 102, 241, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 0.8s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.custom-dropdown .dropdown-group-header {
    padding: 8px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 6px;
    margin: 8px 0 4px 0;
}

.custom-dropdown .dropdown-item-badge {
    margin-left: auto;
    padding: 2px 8px;
    background: rgba(99, 102, 241, 0.2);
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-light);
}
