/**
 * Fuse Search Autocomplete - Frontend Styles
 *
 * @package Fuse_Search_Autocomplete
 * @since   1.0.0
 */

/* ==========================================================================
   Dropdown Container
   ========================================================================== */

.fsa-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 99999;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 50vh;
    overflow-y: auto;
    display: none;
}

.fsa-dropdown.is-open {
    display: block;
}

/* ==========================================================================
   Section Headers
   ========================================================================== */

.fsa-section:not(:first-child) {
    border-top: 1px solid #eee;
}

.fsa-section-header {
    padding: 8px 12px;
    background: #f8f8f8;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
    position: sticky;
    top: 0;
    z-index: 1;
}

/* ==========================================================================
   Result Items
   ========================================================================== */

.fsa-result-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.fsa-result-item:hover,
.fsa-result-item.is-selected {
    background-color: #f5f5f5;
}

.fsa-result-item.is-selected {
    background-color: #e8f4fc;
}

.fsa-result-item:not(:last-child) {
    border-bottom: 1px solid #f0f0f0;
}

/* Product Thumbnails */
.fsa-result-product .fsa-result-thumb {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
    margin-right: 12px;
    background: #f8f8f8;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fsa-result-thumb img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Content */
.fsa-result-content {
    flex: 1;
    min-width: 0;
    line-height: 1.4;
}

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

/* Meta (SKU + Category badge) */
.fsa-result-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
    flex-wrap: wrap;
}

.fsa-result-sku {
    font-size: 12px;
    color: #888;
}

.fsa-result-count {
    font-size: 12px;
    color: #888;
}

/* Category Badge */
.fsa-category-badge {
    display: inline-block;
    background: #e8f0fe;
    color: #1a73e8;
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

/* Price */
.fsa-result-price {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    margin-top: 2px;
}

.fsa-vat {
    font-weight: 400;
    font-size: 11px;
    color: #888;
    margin-left: 2px;
}

/* ==========================================================================
   States
   ========================================================================== */

/* No Results */
.fsa-no-results {
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

/* Loading */
.fsa-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px 20px;
    color: #666;
    font-size: 14px;
}

.fsa-loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e0e0e0;
    border-top-color: #1a73e8;
    border-radius: 50%;
    animation: fsa-spin 0.8s linear infinite;
}

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

/* ==========================================================================
   Responsive
   ========================================================================== */

@media screen and (max-width: 640px) {
    .fsa-dropdown {
        max-height: 70vh;
    }

    .fsa-result-product .fsa-result-thumb {
        width: 40px;
        height: 40px;
        margin-right: 10px;
    }

    .fsa-result-title {
        font-size: 13px;
    }

    .fsa-result-meta {
        font-size: 11px;
    }
}
