/**
 * Live Search Styles v2.0
 * Clean and simple
 */

/* Dropdown - appended to body, positioned via JS */
#live-search-dropdown {
    display: none;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 99999;
    overscroll-behavior: contain;
}

#live-search-dropdown.open {
    display: block;
}

/* Section headers */
.ls-header {
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 700;
    color: #888;
    background: #f5f5f5;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
}

/* Items */
.ls-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
}

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

.ls-item:hover,
.ls-item.selected {
    background: #f8f8f8;
}

/* Product image */
.ls-item img {
    display: block;
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 8px;
    margin-left: 12px;
    flex-shrink: 0;
    background: #f3f4f6;
}

/* Product info */
.ls-info {
    flex: 1;
    min-width: 0;
}

.ls-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ls-title mark {
    background: #fff3cd;
    color: inherit;
    padding: 0 2px;
    border-radius: 2px;
}

.ls-price {
    font-size: 13px;
    color: #666;
    margin-top: 4px;
}

/* Category items */
.ls-cat {
    justify-content: space-between;
}

.ls-cat i {
    color: #999;
    margin-left: 10px;
}

.ls-count {
    font-size: 11px;
    color: #888;
    background: #f0f0f0;
    padding: 4px 10px;
    border-radius: 20px;
}

/* Empty state */
.ls-empty {
    padding: 40px 20px;
    text-align: center;
    color: #999;
}

.ls-empty i {
    font-size: 36px;
    opacity: 0.3;
    display: block;
    margin-bottom: 12px;
}

/* Loader */
.live-search-loader {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: none;
}

.live-search-loader .spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #ddd;
    border-top-color: #333;
    border-radius: 50%;
    animation: ls-spin 0.6s linear infinite;
}

@keyframes ls-spin {
    to { transform: rotate(360deg); }
}

/* Scrollbar */
#live-search-dropdown::-webkit-scrollbar {
    width: 6px;
}

#live-search-dropdown::-webkit-scrollbar-track {
    background: #f5f5f5;
}

#live-search-dropdown::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 6px;
}

/* Show All Results Button */
.ls-show-all-section {
    border-top: 2px solid #eee;
    background: #fafafa;
}

.ls-show-all {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    cursor: pointer;
    transition: background 0.15s;
    gap: 10px;
}

.ls-show-all:hover,
.ls-show-all.selected {
    background: #e8f4fd;
}

.ls-show-all i {
    color: #2196f3;
    font-size: 14px;
}

.ls-show-all .ls-title {
    flex: 1;
    font-weight: 600;
    color: #2196f3;
}

.ls-show-all .ls-arrow {
    font-size: 12px;
}

/* Mobile adjustments */
@media (max-width: 767px) {
    #live-search-dropdown {
        border-radius: 0;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
    }

    .ls-item img {
        width: 40px;
        height: 40px;
    }

    .ls-item {
        padding: 8px 12px;
    }
}
