.nk-search-wrap {
    position: relative;
    width: 100%;
}

.nk-search-form--open {
    /* "keret" effektet visszafogjuk (user kérés: ne legyen hangsúlyos border/keret) */
    border-color: rgba(148, 163, 184, 0.42);
    box-shadow: none;
}

.nk-search-clear {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 8px;
    background: rgba(148, 163, 184, 0.18);
    color: rgba(15, 23, 42, 0.9);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex: 0 0 auto;
}

.nk-search-clear:hover {
    background: rgba(148, 163, 184, 0.28);
}

.nk-search-suggest {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 1400;
    background: #fff;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 14px;
    box-shadow: 0 16px 34px rgba(15, 23, 42, 0.18);
    overflow: hidden;
    padding: 6px;
}

.nk-search-suggest-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: min(62vh, 460px);
    overflow: auto;
    padding-right: 2px;
}

.nk-search-suggest-state {
    margin: 2px;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 12px;
    line-height: 1.35;
}

.nk-search-suggest-state--loading {
    background: rgba(15, 23, 42, 0.04);
    color: rgba(15, 23, 42, 0.82);
}

.nk-search-suggest-state--loading::before {
    content: "";
    display: inline-block;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 2px solid rgba(15, 23, 42, 0.2);
    border-top-color: rgba(15, 23, 42, 0.7);
    margin-right: 8px;
    vertical-align: -1px;
    animation: nk-search-spin 0.7s linear infinite;
}

.nk-search-suggest-state--empty {
    background: rgba(148, 163, 184, 0.1);
    color: rgba(15, 23, 42, 0.78);
}

.nk-search-suggest-state--error {
    background: rgba(254, 242, 242, 0.96);
    color: rgba(127, 29, 29, 0.95);
}

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

.nk-search-suggest-item {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 10px;
    padding: 8px;
    border-radius: 10px;
    border: 1px solid transparent;
}

.nk-search-suggest-item:hover {
    border-color: rgba(245, 158, 11, 0.34);
    background: rgba(255, 251, 235, 0.45);
}

.nk-search-suggest-item.is-unavailable {
    opacity: 0.9;
}

.nk-search-suggest-thumb {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    background: #fff;
    overflow: hidden;
    display: block;
}

.nk-search-suggest-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.nk-search-suggest-content {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.nk-search-suggest-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.nk-search-suggest-title {
    color: #0f172a;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.nk-search-suggest-title:hover {
    text-decoration: underline;
}

.nk-search-suggest-fav-form {
    flex: 0 0 auto;
    margin: 0;
}

.nk-search-suggest-fav-form .pc-icon {
    width: 30px;
    height: 30px;
}

.nk-search-suggest-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.nk-search-suggest-price {
    font-size: 14px;
    font-weight: 800;
    color: #0f172a;
}

.nk-search-suggest-oldprice {
    font-size: 12px;
    color: rgba(100, 116, 139, 0.95);
    text-decoration: line-through;
}

.nk-search-suggest-sku {
    font-size: 11px;
    color: rgba(71, 85, 105, 0.95);
}

.nk-search-suggest-stock {
    font-size: 11px;
    line-height: 1.3;
}

.nk-search-suggest-stock.is-in {
    color: rgba(21, 128, 61, 0.96);
}

.nk-search-suggest-stock.is-out {
    color: rgba(185, 28, 28, 0.94);
}

.nk-search-suggest-stock-sep {
    color: rgba(100, 116, 139, 0.95);
}

.nk-search-suggest-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.nk-search-suggest-cart-form {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    min-width: 0;
}

.nk-search-suggest-qty {
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 999px;
    background: #fff;
    overflow: hidden;
}

.nk-qty-btn {
    width: 28px;
    height: 28px;
    border: 0;
    background: transparent;
    color: #0f172a;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.nk-qty-btn:hover {
    background: rgba(15, 23, 42, 0.06);
}

.nk-qty-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.nk-search-suggest-qty input[type="number"] {
    width: 40px;
    border: 0;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    background: transparent;
    outline: 0;
    color: #0f172a;
}

.nk-search-suggest-qty input[type="number"]::-webkit-outer-spin-button,
.nk-search-suggest-qty input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.nk-search-suggest-add {
    white-space: nowrap;
    min-height: 30px;
    padding: 0 12px;
    font-size: 11px;
}

.nk-search-suggest-note {
    font-size: 11px;
    color: rgba(185, 28, 28, 0.94);
}

.nk-search-suggest-open {
    display: inline-flex;
    align-items: center;
    height: 30px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    padding: 0 10px;
    text-decoration: none;
    color: #0f172a;
    font-size: 11px;
    font-weight: 700;
    background: #fff;
}

.nk-search-suggest-open:hover {
    border-color: rgba(245, 158, 11, 0.45);
}

.nk-search-suggest-more {
    display: block;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    margin: 6px -6px -6px;
    padding: 10px 12px;
    text-align: center;
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
    color: #0f172a;
    background: rgba(248, 250, 252, 0.92);
}

.nk-search-suggest-more:hover {
    background: rgba(255, 251, 235, 0.85);
}

@media (max-width: 1024px) {
    .nk-search-suggest {
        max-height: 70vh;
    }
}

@media (max-width: 767px) {
    .nk-search-suggest {
        top: calc(100% + 6px);
        left: -2px;
        right: -2px;
    }

    .nk-search-suggest-item {
        grid-template-columns: 50px minmax(0, 1fr);
        gap: 9px;
        padding: 7px;
    }

    .nk-search-suggest-thumb {
        width: 50px;
        height: 50px;
    }

    .nk-search-suggest-title {
        font-size: 12px;
    }

    .nk-search-suggest-price {
        font-size: 13px;
    }

    .nk-search-suggest-cart-form {
        flex-wrap: wrap;
    }
}

@media (max-width: 520px) {
    .nk-search-suggest-actions {
        align-items: flex-start;
    }

    .nk-search-suggest-cart-form {
        width: 100%;
    }

    .nk-search-suggest-add {
        flex: 1 1 auto;
    }
}

/* =========================================
   Search modal (overlay)
   - Headerből nyílik, a teljes kereső UI itt él.
   - Középre nyitott overlay (mobilon is), nem bottom-sheet.
   ========================================= */
.nk-search-modal {
    position: fixed;
    inset: 0;
    z-index: 1750;
    --nk-search-vh: 100dvh;
    --nk-search-vw: 100dvw;
    opacity: 0;
    pointer-events: none;
    transition: opacity .14s ease;
    overscroll-behavior: contain;
    overscroll-behavior-y: none;
    touch-action: none;

    /* Stabil viewport (mobil: fixed dinamikus újraszámolás nélkül). */
    height: var(--nk-search-vh);
    width: var(--nk-search-vw);
    max-width: var(--nk-search-vw);

    /* Stable centering container (mobile + desktop). */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding:
        calc(12px + env(safe-area-inset-top))
        calc(12px + env(safe-area-inset-right))
        calc(12px + env(safe-area-inset-bottom))
        calc(12px + env(safe-area-inset-left));
}

.nk-search-modal[hidden] {
    display: none !important;
}

.nk-search-modal.is-open {
    opacity: 1;
    pointer-events: auto;
}

.nk-search-modal__backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .46);
}

.nk-search-modal__panel {
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    width: min(860px, calc(var(--nk-search-vw) - 24px));
    height: min(calc(var(--nk-search-vh) - 88px), 86vh);
    max-height: min(calc(var(--nk-search-vh) - 88px), 86vh);
    max-width: 100%;
    max-width: min(var(--nk-search-vw), 860px);
    overflow: hidden;
    will-change: transform, opacity;

    background: #fff;
    color: var(--wx-fg-on-light, #111827);
    border-radius: 18px;
    box-shadow: 0 22px 70px rgba(15, 23, 42, .30);
    border: 1px solid rgba(148, 163, 184, .22);

    opacity: .98;
    transition: opacity .16s ease;

    display: flex;
    flex-direction: column;
    overflow: hidden;
    overscroll-behavior: contain;
    touch-action: pan-y;
}

.nk-search-modal.is-open .nk-search-modal__panel {
    opacity: 1;
}

.nk-search-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(15, 23, 42, .08);
    background: rgba(255, 255, 255, .98);
}

.nk-search-modal__title {
    font-size: 13px;
    font-weight: 950;
    letter-spacing: .01em;
    color: var(--wx-fg-on-light, #111827);
}

.nk-search-modal__close {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, .28);
    background: #fff;
    color: var(--wx-fg-on-light, #111827);
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

.nk-search-modal__body {
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    touch-action: pan-y;
    overscroll-behavior: contain;
}

.nk-search-modal .nk-search-wrap {
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
}

.nk-search-modal .nk-search-form {
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(248, 250, 252, .96);
    border-color: rgba(148, 163, 184, .22);
}

.nk-search-modal .nk-search-suggest {
    position: static;
    top: auto;
    left: auto;
    right: auto;

    flex: 1 1 auto;
    min-height: 0;
    max-height: none;

    display: flex;
    flex-direction: column;
}

.nk-search-modal .nk-search-suggest-list {
    max-height: none;
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.nk-search-modal .nk-search-input {
    font-size: 16px;
}

@media (max-width: 767px) {
    .nk-search-modal {
        padding:
            calc(10px + env(safe-area-inset-top))
            calc(10px + env(safe-area-inset-right))
            calc(10px + env(safe-area-inset-bottom))
            calc(10px + env(safe-area-inset-left));
        overflow: hidden;
    }

    .nk-search-modal__panel {
        width: min(100%, calc(var(--nk-search-vw) - 12px));
        height: min(calc(var(--nk-search-vh) - 16px), 86vh);
        max-height: min(calc(var(--nk-search-vh) - 16px), 86vh);
    }
}

@media (prefers-reduced-motion: reduce) {
    .nk-search-modal,
    .nk-search-modal__panel {
        transition: none !important;
    }
}
