/* Autocomplete Styles - Consolidated */
.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 50;
    background-color: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    color: #1e293b;
    text-align: left;
    -webkit-overflow-scrolling: touch;
}

.autocomplete-item {
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.875rem; /* Added from Dashboard/Manage */
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background-color: #ecfdf5;
    color: #059669;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.autocomplete-results {
    transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out;
}

.autocomplete-results:not(.hidden) {
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.autocomplete-item strong {
    font-weight: 600;
}

/* Dark Mode Autocomplete Overrides */
.dark .autocomplete-results {
    background-color: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
}

.dark .autocomplete-item {
    border-bottom-color: #334155;
    color: #f1f5f9; /* Ensure text color is correct in dark mode */
}

.dark .autocomplete-item:hover {
    background-color: #064e3b;
    color: #34d399;
}

/* Custom Dropdown Styles - Matching Autocomplete */
.custom-dropdown {
    position: relative;
    width: 100%;
}

.custom-dropdown-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.custom-dropdown-trigger svg {
    width: 1rem;
    height: 1rem;
    color: #64748b;
    transition: transform 200ms ease;
    flex-shrink: 0;
}

.custom-dropdown.open .custom-dropdown-trigger svg {
    transform: rotate(180deg);
}

.custom-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 50;
    background-color: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    color: #1e293b;
    margin-top: 0.25rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 150ms ease, transform 150ms ease, visibility 150ms;
}

.custom-dropdown.open .custom-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-dropdown-item {
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.875rem;
    font-weight: 600;
}

.custom-dropdown-item:last-child {
    border-bottom: none;
}

.custom-dropdown-item:hover,
.custom-dropdown-item.selected {
    background-color: #ecfdf5;
    color: #059669;
}

/* Dark Mode Custom Dropdown */
.dark .custom-dropdown-trigger svg {
    color: #94a3b8;
}

.dark .custom-dropdown-menu {
    background-color: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
}

.dark .custom-dropdown-item {
    border-bottom-color: #334155;
    color: #f1f5f9;
}

.dark .custom-dropdown-item:hover,
.dark .custom-dropdown-item.selected {
    background-color: #064e3b;
    color: #34d399;
}

/* Autocomplete Loading State */
.autocomplete-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    color: #64748b;
}

.autocomplete-loading svg {
    animation: spin 1s linear infinite;
}

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

/* Ensure highlight works in autocomplete items */
.autocomplete-item strong {
    font-weight: 700;
    color: inherit;
}