/**
 * Search Autocomplete — Compact Minimal Design
 */

.autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 6px;
    border: 1px solid rgba(226,232,240,0.6);
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    /* No max-height — all suggestions fully visible */
    z-index: 10000;
    animation: acFadeIn 0.15s ease;
}

@keyframes acFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.autocomplete-dropdown::-webkit-scrollbar { width: 4px; }
.autocomplete-dropdown::-webkit-scrollbar-track { background: #f8f8f8; }
.autocomplete-dropdown::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }

/* Sections */
.autocomplete-section {
    border-bottom: 1px solid #f0f0f0;
}
.autocomplete-section:last-child { border-bottom: none; }

.autocomplete-section-title {
    padding: 5px 12px 3px;
    font-size: 10px;
    font-weight: 700;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: flex;
    align-items: center;
    gap: 5px;
    background: transparent;
}
.autocomplete-section-title i { color: #7C4A85; font-size: 9px; }

/* Items */
.autocomplete-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    cursor: pointer;
    transition: background 0.1s;
    text-decoration: none;
    color: #1f2937;
    border: none;
    background: transparent;
    width: 100%;
    font-size: 13px;
}
.autocomplete-item:hover,
.autocomplete-item.active {
    background: rgba(124,74,133,0.15);
    border-left: 2px solid #7C4A85;
    padding-left: 10px;
}

.autocomplete-item mark {
    background: #fef9c3;
    color: #854d0e;
    font-weight: 600;
    padding: 0 2px;
    border-radius: 2px;
}

/* Product image */
.autocomplete-image {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.autocomplete-item-content {
    flex: 1;
    min-width: 0;
}

.autocomplete-item-name {
    font-size: 13px;
    font-weight: 500;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.autocomplete-item-meta {
    font-size: 11px;
    color: #9ca3af;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 1px;
}
.autocomplete-item-meta .price { font-weight: 600; color: #7C4A85; }
.autocomplete-item-meta .offers { color: #10b981; }

/* Icon items (category/brand) */
.category-item i,
.brand-item i { font-size: 13px; color: #9ca3af; flex-shrink: 0; }

.recent-item i,
.popular-item i { font-size: 11px; color: #c4c9d4; flex-shrink: 0; }

/* Remove recent button */
.remove-recent {
    margin-left: auto;
    background: none;
    border: none;
    padding: 2px 5px;
    cursor: pointer;
    color: #d1d5db;
    font-size: 10px;
    border-radius: 3px;
    opacity: 0;
    transition: opacity 0.1s;
}
.recent-item:hover .remove-recent { opacity: 1; }
.remove-recent:hover { background: #fee2e2; color: #dc2626; }

/* States */
.autocomplete-loading,
.autocomplete-error,
.autocomplete-empty {
    padding: 14px 12px;
    text-align: center;
    color: #9ca3af;
    font-size: 12px;
}
.autocomplete-loading i { color: #7C4A85; margin-right: 5px; }
.autocomplete-error { color: #dc2626; }
.autocomplete-empty i { font-size: 20px; color: #e5e7eb; display: block; margin-bottom: 6px; }

/* Typo correction */
.autocomplete-typo {
    padding: 7px 12px;
    background: #eff6ff;
    border-left: 2px solid #3b82f6;
    font-size: 12px;
    color: #1e40af;
    display: flex;
    align-items: center;
    gap: 6px;
}
.autocomplete-typo i { color: #3b82f6; font-size: 11px; }
.typo-suggestion { color: #2563eb; font-weight: 600; text-decoration: underline; cursor: pointer; }
.typo-suggestion:hover { color: #1d4ed8; }

/* Mobile */
@media (max-width: 768px) {
    .autocomplete-dropdown { /* no max-height on mobile either */ }
    .autocomplete-item { padding: 7px 10px; gap: 7px; }
    .autocomplete-image { width: 28px; height: 28px; }
    .autocomplete-item-name { font-size: 12px; }
    .autocomplete-section-title { padding: 5px 10px 2px; }
}

/* Accessibility */
.autocomplete-item:focus { outline: 2px solid #7C4A85; outline-offset: -2px; }

@media (prefers-reduced-motion: reduce) {
    .autocomplete-dropdown { animation: none; }
}

@media (prefers-color-scheme: dark) {
    .autocomplete-dropdown { background: rgba(31,41,55,0.85); border-color: rgba(55,65,81,0.6); }
    .autocomplete-item { background: transparent; color: #f3f4f6; }
    .autocomplete-item:hover, .autocomplete-item.active { background: rgba(55,65,81,0.5); }
    .autocomplete-section-title { background: transparent; color: #6b7280; }
    .autocomplete-section { border-bottom-color: rgba(55,65,81,0.4); }
    .autocomplete-item-name { color: #f9fafb; }
    .autocomplete-item-meta { color: #6b7280; }
    .autocomplete-image { border-color: #374151; }
    .autocomplete-typo { background: rgba(30,58,95,0.5); border-left-color: #3b82f6; color: #93c5fd; }
    .autocomplete-loading, .autocomplete-empty { color: #6b7280; }
    .autocomplete-dropdown::-webkit-scrollbar-thumb { background: #4b5563; }
}
