/* =============================================
   SEARCH AUTOCOMPLETE DROPDOWN
   ============================================= */

/* Wrapper for positioning the dropdown relative to the search input */
.search-autocomplete-wrapper {
    position: relative;
}

/* The autocomplete dropdown */
.search-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1060;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-top: none;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    max-height: 420px;
    overflow-y: auto;
    display: none;
    animation: autocompleteSlideDown 0.2s ease;
}

.search-autocomplete.active {
    display: block;
}

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

/* Scrollbar styling */
.search-autocomplete::-webkit-scrollbar {
    width: 6px;
}
.search-autocomplete::-webkit-scrollbar-track {
    background: transparent;
}
.search-autocomplete::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* Section headers */
.autocomplete-section-header {
    font-size: 0.7em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #94a3b8;
    padding: 10px 16px 4px;
    border-top: 1px solid #f1f5f9;
}

.autocomplete-section-header:first-child {
    border-top: none;
}

.autocomplete-section-header i {
    margin-right: 6px;
    font-size: 0.9em;
}

/* Suggestion items */
.autocomplete-item {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    cursor: pointer;
    transition: background 0.15s ease;
    text-decoration: none;
    color: inherit;
    gap: 12px;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background: #f0fdfa;
}

.autocomplete-item img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 6px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    flex-shrink: 0;
}

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

.autocomplete-item-name {
    font-size: 0.85em;
    font-weight: 500;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.autocomplete-item-name mark {
    background: #fef3c7;
    color: #92400e;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 600;
}

.autocomplete-item-category {
    font-size: 0.72em;
    color: #94a3b8;
    margin-top: 1px;
}

/* Text-only items (recent / popular searches) */
.autocomplete-text-item {
    display: flex;
    align-items: center;
    padding: 7px 16px;
    cursor: pointer;
    transition: background 0.15s ease;
    text-decoration: none;
    color: #475569;
    font-size: 0.85em;
    gap: 10px;
}

.autocomplete-text-item:hover,
.autocomplete-text-item.active {
    background: #f0fdfa;
    color: #0f766e;
}

.autocomplete-text-item i {
    width: 16px;
    text-align: center;
    color: #94a3b8;
    font-size: 0.85em;
}

.autocomplete-text-item:hover i {
    color: #0f766e;
}

/* Clear recent searches button */
.autocomplete-clear-btn {
    display: block;
    text-align: center;
    padding: 6px 16px;
    font-size: 0.72em;
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.15s;
}

.autocomplete-clear-btn:hover {
    color: #ef4444;
}

/* "View all results" link */
.autocomplete-view-all {
    display: block;
    text-align: center;
    padding: 10px 16px;
    font-size: 0.82em;
    font-weight: 600;
    color: #00ADB5;
    border-top: 1px solid #f1f5f9;
    text-decoration: none;
    transition: background 0.15s;
}

.autocomplete-view-all:hover {
    background: #f0fdfa;
    color: #0f766e;
}

.autocomplete-view-all i {
    margin-left: 4px;
}

/* Mobile-specific: full-width dropdown below the mobile search bar */
.mobile-search-bar .search-autocomplete {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    border-radius: 0;
    max-height: 60vh;
}
