/**
 * Search Pilot Autocomplete Premium Styles
 * File: assets/css/search-autocomplete.css
 */

:root {
    --sp-primary: #111827;
    --sp-primary-hover: #374151;
    --sp-text: #111827;
    --sp-text-muted: #6b7280;
    --sp-bg: rgba(255, 255, 255, 0.99);
    --sp-border: #e5e7eb;
    --sp-shadow: 0 18px 45px rgba(17, 24, 39, 0.16), 0 1px 2px rgba(17, 24, 39, 0.08);
    --sp-accent: #047857;
    --sp-sidebar-bg: #f9fafb;
    --sp-radius: 10px;
}

.sp-results-container {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 99999;
    margin-top: 8px;
    display: none;
}

.sp-autocomplete-dropdown {
    background: var(--sp-bg);
    border: 1px solid var(--sp-border);
    border-radius: var(--sp-radius);
    box-shadow: var(--sp-shadow);
    overflow: hidden;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: spFadeInDown 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.sp-autocomplete-dropdown.segmented-layout {
    display: flex;
    min-height: 260px;
    max-height: min(620px, 80vh);
}

.sp-dropdown-sidebar {
    width: 280px;
    background: var(--sp-sidebar-bg);
    border-right: 1px solid var(--sp-border);
    padding: 18px 0;
    flex-shrink: 0;
}

.sp-dropdown-main {
    flex-grow: 1;
    padding: 18px 0;
    overflow-y: auto;
}

.sp-dropdown-section {
    margin-bottom: 22px;
}

.sp-dropdown-section h3 {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--sp-text-muted);
    letter-spacing: 0.08em;
    padding: 0 20px 10px;
    margin: 0;
}

.sp-section-list {
    display: flex;
    flex-direction: column;
}

.sp-result-item {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    text-decoration: none;
    color: var(--sp-text);
    transition: background 0.18s ease, transform 0.12s ease;
    position: relative;
    outline: none;
}

.sp-result-item:hover,
.sp-result-item.is-active {
    background: #f3f4f6;
}

.sp-result-item.is-active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--sp-primary);
}

.sp-result-item mark {
    background: #fef3c7;
    color: inherit;
    padding: 0 2px;
    border-radius: 3px;
}

.sp-term-item,
.sp-category-item {
    font-size: 14px;
    gap: 12px;
}

.sp-item-icon {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.48;
    position: relative;
    flex: 0 0 16px;
}

.sp-term-item .sp-item-icon::before {
    content: '';
    width: 11px;
    height: 11px;
    border: 2px solid currentColor;
    border-radius: 50%;
    display: block;
}

.sp-term-item .sp-item-icon::after {
    content: '';
    width: 6px;
    height: 2px;
    background: currentColor;
    display: block;
    transform: rotate(45deg);
    position: absolute;
    left: 10px;
    top: 12px;
}

.sp-category-item .sp-item-icon::before {
    content: '';
    width: 14px;
    height: 11px;
    border: 1.8px solid currentColor;
    border-radius: 2px;
    display: block;
}

.sp-product-item {
    gap: 16px;
    padding: 12px 20px;
}

.sp-product-image {
    width: 52px;
    height: 52px;
    border-radius: 8px;
    overflow: hidden;
    background: #f3f4f6;
    flex-shrink: 0;
    border: 1px solid var(--sp-border);
}

.sp-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sp-product-placeholder {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
}

.sp-product-placeholder::after {
    content: '';
    display: block;
    width: 22px;
    height: 22px;
    margin: 14px auto;
    border-radius: 50%;
    border: 2px solid #d1d5db;
}

.sp-product-info {
    flex-grow: 1;
    min-width: 0;
}

.sp-product-name {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 5px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sp-product-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    flex-wrap: wrap;
}

.sp-product-price {
    color: var(--sp-accent);
    font-weight: 800;
}

.sp-product-sku {
    color: var(--sp-text-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
}

.sp-dropdown-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--sp-border);
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.sp-view-all-link {
    display: inline-flex;
    justify-content: center;
    font-size: 13px;
    color: var(--sp-primary);
    text-decoration: none;
    font-weight: 800;
}

.sp-view-all-link:hover {
    text-decoration: underline;
}

.sp-autocomplete-loading,
.sp-no-results {
    padding: 26px;
    color: var(--sp-text-muted);
    font-size: 14px;
    background: var(--sp-bg);
    border-radius: var(--sp-radius);
    box-shadow: var(--sp-shadow);
}

.sp-no-results {
    text-align: center;
}

.sp-skeleton-row {
    width: 100%;
    height: 14px;
    border-radius: 999px;
    margin: 10px 0;
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 37%, #f3f4f6 63%);
    background-size: 400% 100%;
    animation: spSkeleton 1.1s ease infinite;
}

.sp-skeleton-row.short {
    width: 68%;
}

@keyframes spSkeleton {
    0% { background-position: 100% 0; }
    100% { background-position: 0 0; }
}

.sp-load-more-wrap {
    display: flex;
    justify-content: center;
    margin: 28px 0;
}

.sp-load-more-button {
    border: 1px solid var(--sp-primary);
    background: var(--sp-primary);
    color: #fff;
    border-radius: 8px;
    padding: 12px 24px;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
}

.sp-load-more-button:hover {
    background: var(--sp-primary-hover);
    transform: translateY(-1px);
}

.sp-load-more-button.is-loading {
    opacity: 0.72;
    cursor: wait;
}

.sp-native-pagination-hidden {
    display: none !important;
}

@media (max-width: 768px) {
    .sp-autocomplete-dropdown.segmented-layout {
        flex-direction: column;
        max-height: 80vh;
    }

    .sp-dropdown-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--sp-border);
        padding: 10px 0;
    }

    .sp-dropdown-sidebar .sp-dropdown-section {
        margin-bottom: 10px;
    }
}
