/**
 * Autocomplete Component Styles
 */

.autocomplete-input {
    position: relative;
    transition: border-color 0.2s ease-in-out;
}

.autocomplete-input:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.autocomplete-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: none;
}

.autocomplete-suggestion {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
    font-size: 14px;
    line-height: 1.4;
}

.autocomplete-suggestion:last-child {
    border-bottom: none;
}

.autocomplete-suggestion:hover,
.autocomplete-suggestion.active {
    background-color: #f8f9fa;
}

.autocomplete-suggestion mark {
    background-color: #fff3cd;
    color: #856404;
    padding: 1px 2px;
    border-radius: 2px;
    font-weight: 500;
}

.autocomplete-suggestion .suggestion-main {
    font-weight: 500;
    color: #333;
}

.autocomplete-suggestion .suggestion-sub {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}

/* Loading state */
.autocomplete-input.loading {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%23666' d='M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0zM7 3v6l5-3-5-3z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Responsive design */
@media (max-width: 768px) {
    .autocomplete-suggestions {
        max-height: 150px;
    }
    
    .autocomplete-suggestion {
        padding: 8px 10px;
        font-size: 13px;
    }
}

/* Integration with Bootstrap */
.form-control.autocomplete-input {
    background-image: none;
}

.form-control.autocomplete-input:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    .autocomplete-suggestions {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .autocomplete-suggestion {
        border-bottom-color: #4a5568;
    }
    
    .autocomplete-suggestion:hover,
    .autocomplete-suggestion.active {
        background-color: #4a5568;
    }
    
    .autocomplete-suggestion mark {
        background-color: #d69e2e;
        color: #1a202c;
    }
}

/* Custom scrollbar for suggestions */
.autocomplete-suggestions::-webkit-scrollbar {
    width: 6px;
}

.autocomplete-suggestions::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.autocomplete-suggestions::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.autocomplete-suggestions::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}