/* ============================================================
   SEARCH SUGGESTIONS — inline product dropdown.

   Whatever the shopper types shows the real matching products right
   under the search box, so the answer never jumps to another page.

   Mounted by js/search-suggest.js next to any search input. The panel
   is absolutely positioned inside a wrapper the script makes
   position:relative, so it never widens the document.
   ============================================================ */

/* The script wraps the input in this element, so it must keep behaving
   like the input did inside a flex row (.search-query) as well as
   inside a plain block (.search-input). */
.ss-wrap {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
}

.ss-wrap > input {
    flex: 1 1 auto;
    min-width: 0;
}

/* ---------------- panel ---------------- */

/* Width and horizontal placement are set by js/search-suggest.js against
   the real viewport, so the panel can never run off the screen. */
.ss-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 90;

    width: 100%;
    max-width: min(440px, calc(100vw - 20px));

    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 18px 44px rgba(15, 35, 60, .16);
    overflow: hidden;

    font-family: inherit;

    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity .14s ease, transform .14s ease, visibility .14s;
}

.ss-panel.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Mounted on <body> because an ancestor of the input clips its overflow
   (.category-hero is `overflow: hidden`). Positioned with viewport
   coordinates instead of against the input's box. */
.ss-panel.ss-panel--fixed {
    position: fixed;
    top: 0;
}

/* Opening upwards, so the panel slides from the other side of the box. */
.ss-panel--up {
    transform: translateY(6px);
}

.ss-panel--up.open {
    transform: translateY(0);
}

html.dark .ss-panel {
    background: #0f172a;
    border-color: #24334a;
    box-shadow: 0 18px 44px rgba(0, 0, 0, .55);
}

/* ---------------- list ---------------- */

/* The height is whichever is smallest: the viewport, the old cap, or the
   room js/search-suggest.js actually measured above or below the input.
   The third term is what stops the "see all" row and the keyboard hint
   from being pushed off the screen on a short page or a phone. */
.ss-list {
    max-height: min(60vh, 420px, var(--ss-room, 60vh));
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 6px;
}

.ss-item {
    display: flex;
    align-items: center;
    gap: 10px;

    width: 100%;
    padding: 8px;
    border: 0;
    border-radius: 10px;

    background: transparent;
    text-align: left;
    cursor: pointer;
    color: inherit;
    font: inherit;

    transition: background .12s ease;
}

.ss-item:hover,
.ss-item.ss-active {
    background: #f1f5f9;
}

html.dark .ss-item:hover,
html.dark .ss-item.ss-active {
    background: #1c2a40;
}

/* group heading inside the list — "Categories" / "Products" */

.ss-group {
    padding: 8px 10px 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: #94a3b8;
}

.ss-group:first-child {
    padding-top: 2px;
}

html.dark .ss-group {
    color: #64748b;
}

/* category row — same row shape as a product row, so the arrow keys and the
   8px rhythm stay identical; only the leading icon differs */

.ss-item--cat {
    background: #f8fafc;
}

html.dark .ss-item--cat {
    background: #16203322;
}

.ss-item--cat:hover,
.ss-item--cat.ss-active {
    background: #e2e8f0;
}

html.dark .ss-item--cat:hover,
html.dark .ss-item--cat.ss-active {
    background: #1c2a40;
}

.ss-cat-ico {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0f766e;
    background: #ccfbf1;
}

html.dark .ss-cat-ico {
    color: #5eead4;
    background: #134e4a55;
}

.ss-cat-ico svg {
    width: 20px;
    height: 20px;
}

.ss-cat-count {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
}

/* thumbnail */

.ss-thumb {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border-radius: 9px;
    overflow: hidden;
    background: #f8fafc;
    border: 1px solid #eef2f7;
    display: flex;
    align-items: center;
    justify-content: center;
}

html.dark .ss-thumb {
    background: #16203322;
    border-color: #24334a;
}

.ss-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* text block */

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

.ss-brand {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 1px;
}

html.dark .ss-brand {
    color: #8ba3bd;
}

.ss-name {
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.3;
    color: #0f172a;

    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

html.dark .ss-name {
    color: #e2e8f0;
}

/* price + store count */

.ss-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
    flex-wrap: wrap;
}

.ss-price {
    font-size: 12.5px;
    font-weight: 800;
    color: #0f766e;
}

html.dark .ss-price {
    color: #5eead4;
}

.ss-mrp {
    font-size: 11px;
    color: #94a3b8;
    text-decoration: line-through;
}

.ss-off {
    font-size: 10px;
    font-weight: 800;
    color: #15803d;
    background: #dcfce7;
    border-radius: 5px;
    padding: 1px 5px;
}

html.dark .ss-off {
    color: #86efac;
    background: #14532d;
}

/* the compare-first signal: how many real stores sell it */
.ss-stores {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 999px;
    background: #e0f2fe;
    color: #0369a1;
    white-space: nowrap;
}

html.dark .ss-stores {
    background: #0c4a6e;
    color: #7dd3fc;
}

.ss-stores.is-single {
    background: #f1f5f9;
    color: #64748b;
}

html.dark .ss-stores.is-single {
    background: #1e293b;
    color: #94a3b8;
}

.ss-stores svg {
    width: 10px;
    height: 10px;
}

/* store logo */
.ss-logo {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    object-fit: contain;
}

/* ---------------- footer: see all ---------------- */

.ss-foot {
    border-top: 1px solid #eef2f7;
    background: #f8fafc;
}

html.dark .ss-foot {
    border-color: #24334a;
    background: #131c2e;
}

.ss-all {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    background: transparent;
    cursor: pointer;
    font: inherit;
    color: #0369a1;
    font-size: 12px;
    font-weight: 700;
    text-align: left;
}

.ss-all:hover {
    background: #eef2f7;
}

html.dark .ss-all {
    color: #7dd3fc;
}

html.dark .ss-all:hover {
    background: #1c2a40;
}

.ss-all span {
    color: #64748b;
    font-weight: 600;
}

html.dark .ss-all span {
    color: #8ba3bd;
}

.ss-all .ss-kbd {
    font-size: 10px;
    font-weight: 700;
    color: #94a3b8;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 1px 5px;
    white-space: nowrap;
}

html.dark .ss-all .ss-kbd {
    border-color: #334155;
}

/* ---------------- states ---------------- */

.ss-msg {
    padding: 16px 14px;
    text-align: center;
    font-size: 12px;
    color: #64748b;
}

html.dark .ss-msg {
    color: #8ba3bd;
}

.ss-msg b {
    color: #0f172a;
}

html.dark .ss-msg b {
    color: #e2e8f0;
}

.ss-hint {
    display: flex;
    gap: 12px;
    padding: 9px 12px;
    border-top: 1px solid #eef2f7;
    font-size: 10.5px;
    color: #94a3b8;
    flex-wrap: wrap;
}

html.dark .ss-hint {
    border-color: #24334a;
}

.ss-hint kbd {
    font-family: inherit;
    font-weight: 700;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 0 4px;
    margin-right: 3px;
}

html.dark .ss-hint kbd {
    border-color: #334155;
}

/* ---------------- loading ---------------- */

.ss-panel .ss-item[aria-busy="true"] {
    opacity: .55;
}

.ss-spin {
    width: 13px;
    height: 13px;
    flex: 0 0 13px;
    border: 2px solid #cbd5e1;
    border-top-color: #0f766e;
    border-radius: 50%;
    animation: ss-spin .6s linear infinite;
}

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

/* ============================================================
   PHONES — full width under the box, chunky tap targets
   ============================================================ */

@media (max-width: 640px) {
    .ss-panel {
        max-width: calc(100vw - 20px);
        border-radius: 13px;
    }

    .ss-list {
        max-height: 52vh;
    }

    .ss-item {
        padding: 9px 8px;
        gap: 9px;
    }

    .ss-thumb {
        flex: 0 0 40px;
        width: 40px;
        height: 40px;
    }

    .ss-name {
        font-size: 12px;
    }

    .ss-all {
        padding: 12px;
    }
}
