/**
 * Стили для автодополнения поиска
 */

.search-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
}

.autocomplete-section {
    border-bottom: 1px solid #f1f1f1;
}

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

.autocomplete-title {
    padding: 8px 16px;
    background: #f8f9fa;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.autocomplete-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f8f9fa;
}

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

.autocomplete-item:hover,
.autocomplete-item.highlighted {
    background-color: #f5f5f5;
}

.autocomplete-item.product-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
}

.autocomplete-product-image {
    width: 40px;
    height: 40px;
    margin-right: 12px;
    border-radius: 4px;
    overflow: hidden;
    background: #f8f9fa;
    flex-shrink: 0;
}

.autocomplete-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.autocomplete-product-info {
    flex: 1;
    min-width: 0;
}

.autocomplete-text {
    font-size: 14px;
    color: #333;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.autocomplete-brand {
    font-size: 12px;
    color: #666;
    margin-bottom: 2px;
}

.autocomplete-price {
    font-size: 14px;
    font-weight: 600;
    color: #28a745;
}

.autocomplete-count {
    font-size: 12px;
    color: #666;
}

.autocomplete-loading {
    padding: 20px;
    text-align: center;
    color: #666;
}

.autocomplete-spinner {
    width: 20px;
    height: 20px;
    margin: 0 auto 10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Подсветка совпадений */
.autocomplete-text mark {
    background: #ffeaa7;
    color: #2d3436;
    padding: 0 2px;
    font-weight: 600;
}

/* Адаптивность */
@media (max-width: 768px) {
    .search-autocomplete {
        max-height: 300px;
    }

    .autocomplete-item {
        padding: 10px 12px;
    }

    .autocomplete-product-image {
        width: 35px;
        height: 35px;
        margin-right: 10px;
    }

    .autocomplete-text {
        font-size: 13px;
    }

    .autocomplete-brand,
    .autocomplete-count {
        font-size: 11px;
    }

    .autocomplete-price {
        font-size: 13px;
    }
}

/* Принудительная светлая тема */
.search-autocomplete {
    background: white !important;
    border-color: #ddd !important;
    color: #333 !important;
}

.autocomplete-title {
    background: #f8f9fa !important;
    color: #666 !important;
}

.autocomplete-item {
    border-color: #f8f9fa !important;
    background: white !important;
}

.autocomplete-item:hover,
.autocomplete-item.highlighted {
    background-color: #f5f5f5 !important;
}

.autocomplete-text {
    color: #333 !important;
}

.autocomplete-brand,
.autocomplete-count {
    color: #666 !important;
}

.autocomplete-product-image {
    background: #f8f9fa !important;
}