/* Smart Search Suggestions - Clean Black & White Theme */

/* Search suggestions dropdown */
.search-suggests-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-top: none;
    max-height: none; /* Remove max-height from parent */
    overflow: visible; /* Allow inner container to handle overflow */
    z-index: 9999;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    display: none;
    border-radius: 0 0 8px 8px;
    margin-top: 0;
}

/* Only show when there's actual content (not just whitespace) */
.search-suggests-results:has(.search-suggests-results-inner) {
    display: block;
    animation: slideDown 0.2s ease-out;
}

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

/* Hide if empty or only whitespace */
.search-suggests-results:empty {
    display: none !important;
}

/* Inner container with scrollbar */
.search-suggests-results-inner {
    max-height: calc(100vh - 200px); /* Use viewport height minus header space */
    min-height: 100px;
    overflow-y: auto;
    overflow-x: hidden;
}

.search-suggests-results-inner ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Suggestion groups */
.suggestion-group {
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 0;
}

.suggestion-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.suggestion-group-title {
    padding: 12px 20px;
    font-size: 10px;
    font-weight: 700;
    color: #000;
    background: #f5f5f5;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 0;
}

.suggestion-group-title:before {
    display: none;
}

/* Search result items */
.search-result-item {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    color: #000;
    text-decoration: none;
    transition: all 0.15s ease;
    gap: 14px;
    border-bottom: 1px solid #f5f5f5;
    position: relative;
}


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

.search-result-item:hover {
    background: #fafafa;
    text-decoration: none;
    transform: translateX(0);
}

.search-result-item:active {
    background: #f0f0f0;
}

/* Filter suggestions */
.filter-suggestion .icon-box {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    border-radius: 6px;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

/* All filter types use same black background */
.filter-suggestion[href*="brand"] .icon-box,
.filter-suggestion[href*="category"]:not([href*="subcat"]) .icon-box,
.filter-suggestion[href*="subcat"] .icon-box {
    background: #000;
    box-shadow: none;
}

.filter-suggestion .icon-box i {
    font-size: 16px;
    color: #fff;
}

.filter-suggestion .box-content {
    flex: 1;
}

.filter-suggestion .title {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    color: #000;
    line-height: 1.4;
}

.filter-suggestion:hover .icon-box {
    transform: scale(1.05);
    background: #333;
}

.filter-suggestion[href*="category"]:not([href*="subcat"]):hover .icon-box,
.filter-suggestion[href*="subcat"]:hover .icon-box {
    background: #333;
}

/* Product suggestions */
.product-suggestion {
    gap: 14px;
    padding: 14px 20px !important;
}

.product-suggestion .img-box {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.product-suggestion .img-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-suggestion:hover .img-box {
    transform: translateY(-1px);
}

.product-suggestion:hover .img-box img {
    transform: scale(1.08);
}

.product-suggestion .img-box.no-image {
    background: #f5f5f5;
    border-style: dashed;
    border-color: #d1d5db;
}

.product-suggestion .img-box.no-image i {
    font-size: 28px;
    color: #9ca3af;
}

.product-suggestion .box-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.product-suggestion .title {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    color: #000;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
}

.product-suggestion .product-meta {
    font-size: 11px;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.product-suggestion .product-meta span {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    background: #000;
    color: #fff;
    border-radius: 3px;
    font-weight: 600;
    font-size: 10px;
    transition: all 0.2s ease;
}

.product-suggestion .product-meta span.brand {
    background: #000;
    color: #fff;
}

.product-suggestion .product-meta span.category {
    background: #666;
    color: #fff;
}

.product-suggestion:hover .product-meta span {
    transform: translateY(0);
}

.product-suggestion .price {
    font-size: 15px;
    font-weight: 700;
    color: #000;
    margin-top: 2px;
}

/* Loading indicator */
.search-loading,
.mobile-search-loading {
    display: none;
    position: absolute;
    right: 50px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
}

.htmx-request .search-loading,
.htmx-request .mobile-search-loading {
    display: inline-block;
}

/* No results */
.no-results {
    text-align: center;
    padding: 50px 20px;
    color: #666;
    background: #fafafa;
}

.no-results i {
    font-size: 56px;
    color: #d1d5db;
    margin-bottom: 16px;
    display: block;
    opacity: 0.6;
}

.no-results p {
    font-size: 15px;
    margin: 0 0 8px 0;
    color: #000;
    font-weight: 600;
}

.no-results small {
    font-size: 13px;
    color: #6b7280;
    display: block;
    font-weight: 400;
}

/* Scrollbar styling for inner container */
.search-suggests-results-inner::-webkit-scrollbar {
    width: 6px;
}

.search-suggests-results-inner::-webkit-scrollbar-track {
    background: #f5f5f5;
}

.search-suggests-results-inner::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.search-suggests-results-inner::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Responsive */
@media (max-width: 768px) {
    .product-suggestion .img-box {
        width: 56px;
        height: 56px;
    }

    .filter-suggestion .icon-box {
        width: 32px;
        height: 32px;
    }

    .filter-suggestion .icon-box i {
        font-size: 14px;
    }

    .search-result-item {
        padding: 12px 16px;
    }

    .search-suggests-results,
    .search-suggests-results-inner {
        max-height: 70vh;
    }

    .suggestion-group-title {
        padding: 10px 16px;
    }
}

