/* Merchant Autocomplete Component Styles */

/* Container */
.merchant-autocomplete-container {
    position: relative;
}

/* Input field */
.merchant-autocomplete-input {
    width: 100%;
}

/* Selected merchant info display */
.merchant-selected-info {
    margin-top: 4px;
    padding: 4px 8px;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.merchant-selected-info .selected-merchant-name {
    font-weight: 500;
    color: #495057;
}

.merchant-selected-info i {
    font-size: 0.8rem;
}

/* Dropdown */
.merchant-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ced4da;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1050;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Dropdown items */
.merchant-dropdown-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f8f9fa;
    font-size: 0.9rem;
    transition: background-color 0.15s ease;
}

.merchant-dropdown-item:hover {
    background-color: #f8f9fa;
    color: #0d6efd;
}

.merchant-dropdown-item:last-child {
    border-bottom: none;
}

.merchant-dropdown-item.selected {
    background-color: #e3f2fd;
    color: #1976d2;
    font-weight: 500;
}

/* Merchant ID and Name styling */
.merchant-dropdown-item .merchant-id {
    font-weight: 600;
    color: #495057;
    margin-right: 8px;
}

.merchant-dropdown-item .merchant-name {
    color: #6c757d;
}

.merchant-dropdown-item:hover .merchant-id,
.merchant-dropdown-item.selected .merchant-id {
    color: #1976d2;
}

.merchant-dropdown-item:hover .merchant-name,
.merchant-dropdown-item.selected .merchant-name {
    color: #1976d2;
}

/* Empty state */
.merchant-dropdown-empty {
    padding: 12px;
    text-align: center;
    color: #6c757d;
    font-style: italic;
    font-size: 0.9rem;
}

/* Loading state */
.merchant-dropdown-loading {
    padding: 12px;
    text-align: center;
    color: #6c757d;
    font-size: 0.9rem;
}

.merchant-dropdown-loading i {
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive design */
@media (max-width: 768px) {
    .merchant-dropdown {
        max-height: 150px;
    }
    
    .merchant-dropdown-item {
        padding: 6px 10px;
        font-size: 0.85rem;
    }
    
    .merchant-dropdown-item .merchant-id {
        font-size: 0.8rem;
    }
    
    .merchant-dropdown-item .merchant-name {
        font-size: 0.8rem;
    }
}

/* Custom scrollbar for dropdown */
.merchant-dropdown::-webkit-scrollbar {
    width: 6px;
}

.merchant-dropdown::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.merchant-dropdown::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.merchant-dropdown::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Focus states */
.merchant-autocomplete-input:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Integration with Bootstrap form validation */
.merchant-autocomplete-input.is-invalid {
    border-color: #dc3545;
}

.merchant-autocomplete-input.is-valid {
    border-color: #198754;
}

/* Dark mode support (if needed) */
@media (prefers-color-scheme: dark) {
    .merchant-dropdown {
        background: #343a40;
        border-color: #495057;
        color: #fff;
    }
    
    .merchant-dropdown-item {
        border-bottom-color: #495057;
    }
    
    .merchant-dropdown-item:hover {
        background-color: #495057;
    }
    
    .merchant-dropdown-item.selected {
        background-color: #0d6efd;
    }
    
    .merchant-dropdown-item .merchant-id {
        color: #fff;
    }
    
    .merchant-dropdown-item .merchant-name {
        color: #adb5bd;
    }
    
    .merchant-dropdown-empty {
        color: #adb5bd;
    }
    
    .merchant-dropdown-loading {
        color: #adb5bd;
    }
    
    .merchant-selected-info {
        background-color: #495057;
        border-color: #6c757d;
    }
    
    .merchant-selected-info .selected-merchant-name {
        color: #fff;
    }
}
