/* ───────────────────────────────────────────────────────────────────────────
   Fresh Bazaar — Live Search Suggestions
   Dropdown styling for the smart search bar. Uses the site design tokens so it
   matches the existing search field. Intentionally minimal — product image,
   name, price. No extra labels or clutter.
   The .search-form / .search-inline-form wrappers are made position:relative
   here so the JS-injected panel anchors correctly (no template markup needed).
   ─────────────────────────────────────────────────────────────────────────── */

.search-form,
.search-inline-form {
    position: relative;
}

.smart-suggest-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 1200;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    max-height: min(70vh, 460px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: none;
}

.smart-suggest-panel.is-open {
    display: block;
    animation: ss-fade var(--dur-fast, 160ms) ease-out;
}

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

/* ── Product row ── */
.ss-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .55rem .8rem;
    min-height: 54px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-lt);
    transition: background var(--dur-instant, 90ms) ease;
    text-decoration: none;
    color: var(--dark);
}

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

.ss-item.is-active,
.ss-item:hover {
    background: var(--green-50);
}

.ss-thumb {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--border-lt);
    border: 1px solid var(--border);
}

.ss-thumb-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--muted-lt);
}

.ss-info {
    flex: 1 1 auto;
    min-width: 0;
}

.ss-name {
    font-size: .92rem;
    font-weight: 600;
    color: var(--dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.ss-name .ss-urdu {
    font-weight: 500;
    color: var(--muted);
    margin-inline-start: .4rem;
}

.ss-meta {
    font-size: .75rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.ss-out {
    color: #b91c1c;
    font-weight: 600;
}

.ss-price-wrap {
    flex: 0 0 auto;
    text-align: end;
    white-space: nowrap;
    padding-inline-start: .4rem;
}

.ss-price {
    font-size: .9rem;
    font-weight: 700;
    color: var(--green-700);
}

.ss-compare {
    display: block;
    font-size: .72rem;
    color: var(--muted-lt);
    text-decoration: line-through;
    margin-top: 1px;
}

/* ── Did-you-mean row ── */
.ss-dym {
    padding: .6rem .85rem;
    font-size: .82rem;
    color: var(--muted);
    border-bottom: 1px solid var(--border-lt);
    background: var(--green-50);
}

.ss-dym a {
    color: var(--green-700);
    font-weight: 700;
}

.ss-dym a:hover { text-decoration: underline; }

/* ── Category shortcuts ── */
.ss-cats {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    padding: .65rem .8rem;
    border-top: 1px solid var(--border-lt);
}

.ss-cat {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    background: var(--green-50);
    color: var(--green-800);
    border: 1px solid var(--green-200);
    border-radius: var(--radius-full);
    padding: .3rem .8rem;
    font-size: .8rem;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--dur-fast, 160ms) ease;
}

.ss-cat:hover,
.ss-cat.is-active {
    background: var(--green-700);
    color: #fff;
    border-color: var(--green-700);
}

/* ── Empty / loading states ── */
.ss-empty {
    padding: 1.1rem .85rem;
    text-align: center;
    color: var(--muted);
    font-size: .88rem;
}

.ss-empty .ss-view-all {
    display: inline-block;
    margin-top: .55rem;
    color: var(--green-700);
    font-weight: 700;
}

.ss-loading {
    padding: 1rem .85rem;
    display: flex;
    align-items: center;
    gap: .55rem;
    color: var(--muted);
    font-size: .85rem;
}

.ss-spinner {
    width: 15px;
    height: 15px;
    border: 2px solid var(--green-200);
    border-top-color: var(--green-700);
    border-radius: 50%;
    animation: ss-spin .6s linear infinite;
    flex: 0 0 auto;
}

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

/* ── Footer "see all results" ── */
.ss-footer {
    display: block;
    padding: .65rem .85rem;
    text-align: center;
    font-size: .85rem;
    font-weight: 700;
    color: var(--green-700);
    border-top: 1px solid var(--border-lt);
    background: var(--white);
    text-decoration: none;
    position: sticky;
    bottom: 0;
}

.ss-footer:hover { background: var(--green-50); }

@media (prefers-reduced-motion: reduce) {
    .smart-suggest-panel.is-open { animation: none; }
    .ss-spinner { animation-duration: 1.2s; }
}
