/* Glowis storefront search: the header field, its suggestion panel, the phone overlay and the results page.
   Static file, cached for a year by nginx: change the ?v= in templates/base.html.twig with every edit. */

/* ── second header bar: the category links ── */
.nav-sub {
    position: fixed;
    top: var(--nav-top);
    left: 0;
    right: 0;
    height: var(--nav-sub);
    z-index: 99;
    display: flex;
    align-items: center;
    padding: 0 var(--nav-pad);
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
}

.nav-sub .nav-links { gap: 2rem; }

/* ── the field in the top row ── */
.nav-search {
    position: relative;
    flex: 1 1 auto;
    min-width: 170px;
    max-width: 560px;
    margin: 0 1.25rem;
}

.ns-field {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: 40px;
    padding: 0 0.35rem 0 0.8rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.ns-field:focus-within {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(232, 90, 0, 0.14);
}

.ns-ico { color: var(--text-muted); font-size: 1.1rem; flex: none; }

.ns-field input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 0.88rem;
    font-weight: 400;
    color: var(--text);
    -webkit-appearance: none;
    appearance: none;
}

.ns-field input::placeholder { color: var(--text-muted); }
.ns-field input::-webkit-search-cancel-button { display: none; }

.ns-clear,
.ns-go,
.ns-back {
    border: 0;
    background: transparent;
    cursor: pointer;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ns-clear { width: 28px; height: 28px; font-size: 1rem; flex: none; }
.ns-clear[hidden] { display: none; }
.ns-clear:hover { color: var(--text); }

.ns-go {
    width: 32px;
    height: 30px;
    flex: none;
    border-radius: var(--radius);
    background: var(--gold);
    color: #fff;
    font-size: 1rem;
}

.ns-go:hover { background: var(--gold-lt); }

.ns-back,
.nav-search-open { display: none; }

/* ── suggestion panel ── */
.ns-panel {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    z-index: 120;
    max-height: min(70vh, 560px);
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 28px rgba(42, 42, 32, 0.14);
    font-size: 0.85rem;
    font-weight: 400;
}

.ns-panel[hidden] { display: none; }

.ns-sec {
    padding: 0.7rem 0.9rem 0.3rem;
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.ns-note {
    margin: 0.5rem 0.9rem 0.1rem;
    padding: 0.4rem 0.6rem;
    background: #fff1e6;
    color: #7a3300;
    border-radius: var(--radius);
    font-size: 0.74rem;
}

.ns-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.45rem 0.9rem;
    color: var(--text);
    text-decoration: none;
}

.ns-item.is-active,
.ns-item:hover { background: var(--bg2); }

.ns-thumb {
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    background: var(--bg) center / cover no-repeat;
    overflow: hidden;
}

.ns-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }

.ns-name { flex: 1; min-width: 0; line-height: 1.3; }
.ns-name > span:first-child { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ns-tag { display: block; font-size: 0.68rem; color: var(--text-muted); }
.ns-price { flex: none; font-size: 0.8rem; font-weight: 600; color: var(--gold); white-space: nowrap; }

.ns-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0.3rem 0.9rem 0.7rem; }

.ns-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.28rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--bg2);
    font-size: 0.76rem;
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
}

.ns-chip:hover { border-color: var(--gold); color: var(--gold); }

.ns-all {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.7rem 0.9rem;
    border-top: 1px solid var(--border);
    color: var(--gold);
    font-weight: 600;
    font-size: 0.8rem;
    text-decoration: none;
}

.ns-all.is-active,
.ns-all:hover { background: var(--bg2); }

.ns-empty { padding: 0.9rem 0.9rem 0.2rem; font-weight: 600; }
.ns-empty-hint { padding: 0 0.9rem 0.4rem; color: var(--text-muted); font-size: 0.78rem; }
.ns-wa { display: inline-flex; align-items: center; gap: 0.4rem; margin: 0.2rem 0.9rem 0.9rem; padding: 0.5rem 0.9rem; border-radius: var(--radius); background: #25d366; color: #fff; font-size: 0.8rem; font-weight: 600; text-decoration: none; }

/* ── phones: the field becomes a full-screen layer opened from an icon ── */
@media (max-width: 768px) {
    /* looks like the other header icons (.nav-ico, base.html.twig) */
    .nav-search-open {
        display: inline-flex;
        color: var(--text);
    }

    .nav-search {
        display: none;
        margin: 0;
        max-width: none;
    }

    .nav-search.is-open {
        display: flex;
        flex-direction: column;
        position: fixed;
        inset: 0;
        z-index: 300;
        background: var(--bg2);
        padding: 0;
    }

    .nav-search.is-open .ns-field {
        margin: 12px 12px 0 56px;
        height: 44px;
    }

    .nav-search.is-open .ns-back {
        display: inline-flex;
        position: absolute;
        left: 6px;
        top: 12px;
        width: 44px;
        height: 44px;
        font-size: 1.4rem;
        color: var(--text);
    }

    .nav-search.is-open .ns-field input { font-size: 16px; } /* 16px: iOS must not zoom the page on focus */

    .nav-search.is-open .ns-panel {
        position: static;
        flex: 1;
        max-height: none;
        margin-top: 10px;
        border: 0;
        border-top: 1px solid var(--border);
        border-radius: 0;
        box-shadow: none;
    }

    body.ns-lock { overflow: hidden; }
}

/* ── results page ── */
.sp-wrap { max-width: 1180px; margin: 0 auto; padding: 1.8rem 1.5rem 4rem; }
.sp-title { font-size: 1.5rem; font-weight: 600; margin-bottom: 0.3rem; overflow-wrap: anywhere; }
.sp-count { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 0.8rem; }
.sp-note { margin: 0 0 1rem; padding: 0.55rem 0.8rem; background: #fff1e6; color: #7a3300; border-radius: var(--radius); font-size: 0.84rem; }

.sp-tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.4rem 0 1.2rem; }

.sp-tab {
    padding: 0.4rem 0.95rem;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--bg2);
    color: var(--text);
    font-size: 0.82rem;
    text-decoration: none;
}

.sp-tab b { font-weight: 600; color: var(--text-muted); margin-left: 0.25rem; }
.sp-tab.is-on { background: var(--gold); border-color: var(--gold); color: #fff; }
.sp-tab.is-on b { color: #fff; }

.sp-sort { margin: 0 0 1rem; font-size: 0.82rem; color: var(--text-muted); }
.sp-sort select { margin-left: 0.4rem; padding: 0.3rem 0.5rem; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; font: inherit; color: var(--text); }

.sp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1rem; }

.sp-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.7rem;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    transition: border-color 0.15s, transform 0.15s;
}

.sp-card:hover { border-color: var(--gold); transform: translateY(-2px); }

.sp-img {
    display: block;
    aspect-ratio: 1 / 1;
    margin-bottom: 0.4rem;
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
}

.sp-img img { width: 100%; height: 100%; object-fit: contain; display: block; }

.sp-tag {
    position: absolute;
    top: 1rem;
    left: 1rem;
    padding: 0.1rem 0.5rem;
    background: rgba(244, 247, 238, 0.92);
    border: 1px solid var(--border);
    border-radius: 7px;
    font-size: 0.64rem;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

/* a product we hold in Kazakhstan */
.sp-tag.is-instock {
    color: #1c6f46;
    border-color: #1c6f46;
    font-weight: 600;
}

.sp-brand { font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.sp-name { font-size: 0.84rem; line-height: 1.35; font-weight: 400; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.sp-price { margin-top: auto; padding-top: 0.3rem; font-size: 0.95rem; font-weight: 700; color: var(--text); }
.sp-price.is-ask { font-size: 0.78rem; font-weight: 500; color: var(--text-muted); }

.sp-pages { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4rem; margin-top: 2rem; }
.sp-pages a, .sp-pages span { min-width: 2.2rem; padding: 0.4rem 0.7rem; text-align: center; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg2); color: var(--text); font-size: 0.82rem; text-decoration: none; }
.sp-pages .is-on { background: var(--gold); border-color: var(--gold); color: #fff; }
.sp-pages .is-gap { border-color: transparent; background: transparent; }

.sp-empty { max-width: 640px; margin: 2rem auto; text-align: center; }
.sp-empty h2 { font-size: 1.2rem; font-weight: 600; margin-bottom: 0.4rem; }
.sp-empty p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1rem; }
.sp-empty .ns-chips { justify-content: center; }
.sp-empty .ns-wa { margin: 0.6rem 0 0; }

@media (max-width: 560px) {
    .sp-wrap { padding: 1.2rem 0.9rem 3rem; }
    .sp-title { font-size: 1.2rem; }
    .sp-grid { grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
    .sp-card { padding: 0.5rem; }
}
