/* Nutri World - Scan & Go */
.nw-scan { max-width: 560px; }

.nw-scan-camera {
    position: relative;
    aspect-ratio: 4 / 3;
    border-radius: 12px;
    overflow: hidden;
    background: #111;
    color: #fff;
}
.nw-scan-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}
.nw-scan-idle {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.nw-scan-frame {
    display: none;
    position: absolute;
    left: 10%;
    right: 10%;
    top: 25%;
    bottom: 25%;
    border: 3px solid rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.35);
    pointer-events: none;
}
.nw-scan-frame::after {
    content: "";
    position: absolute;
    left: 6%;
    right: 6%;
    top: 50%;
    height: 2px;
    background: #e53935;
    animation: nw-scan-line 1.6s ease-in-out infinite alternate;
}
@keyframes nw-scan-line {
    from { transform: translateY(-40px); }
    to { transform: translateY(40px); }
}
@media (prefers-reduced-motion: reduce) {
    .nw-scan-frame::after { animation: none; }
}
.nw-scan-tools {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 6px;
}

.nw-scan-live .nw-scan-video,
.nw-scan-live .nw-scan-frame { display: block; }
.nw-scan-live .nw-scan-idle { display: none; }

.nw-scan-lines .nw-line-name { min-width: 0; word-break: break-word; }
.nw-scan-lines .nw-line-qty {
    min-width: 2.5rem;
    opacity: 1;
    background: #fff;
    color: var(--nw-forest, #0F2A1D);
    font-weight: 700;
    border-color: var(--bs-secondary, #6c757d);
}

/* ---- Header, store, steps (matches the NW theme: orange #EB6E10, forest #0F2A1D) ---- */
.nw-scan-eyebrow {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--nw-orange, #EB6E10);
}
.nw-scan-title { font-size: 1.6rem; font-weight: 800; margin: 0; color: var(--nw-forest, #0F2A1D); }
.nw-scan-cartlink { border-radius: 10px; }
.nw-scan-store {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(47, 158, 68, .08);
    color: var(--nw-forest, #0F2A1D);
}
.nw-scan-store .fa { color: var(--nw-green, #2F9E44); }
.nw-scan-steps {
    list-style: none;
    padding: 0;
    display: grid;
    gap: 6px;
    font-size: 13px;
    color: var(--nw-muted, #56635C);
}
.nw-scan-steps li { display: flex; align-items: center; gap: 10px; }
.nw-scan-steps li p { margin: 0; }
.nw-scan-steps li span {
    flex: 0 0 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    background: var(--nw-orange, #EB6E10);
}
.nw-scan-has-items .nw-scan-steps { display: none; }
.nw-scan-camera { border-radius: 16px; }
.nw-scan-cart { border-radius: 14px; overflow: hidden; }
.nw-scan-checkout { border-radius: 12px; font-weight: 700; }
.nw-line-img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    border-radius: 8px;
    background: #f6f7f6;
    flex: 0 0 44px;
}
.nw-scan-login { color: var(--nw-muted, #56635C); }
.nw-scan-login .fa { color: var(--nw-orange, #EB6E10); }

/* ---- Sticky checkout bar on phones ---- */
.nw-scan-sticky { display: none; }
@media (max-width: 767.98px) {
    .nw-scan-sticky:not(.d-none) {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1040;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
        background: #fff;
        box-shadow: 0 -6px 20px rgba(15, 42, 29, .12);
    }
    .nw-scan-sticky-info { display: flex; flex-direction: column; line-height: 1.2; }
    .nw-scan-sticky-info strong { font-size: 1.1rem; color: var(--nw-forest, #0F2A1D); }
    .nw-scan.nw-scan-has-items { padding-bottom: 96px !important; }
    /* Keep floating buttons (e.g. WhatsApp) clear of the bar on this page only. */
    body:has(.nw-scan-has-items) #nw-wa { bottom: 96px !important; }
}

/* ---- Phones: /scan starts right under the header, no duplicate controls ---- */
@media (max-width: 767.98px) {
    #wrap > .nw-scan { padding-top: 8px !important; }
    .nw-scan-cartlink { display: none !important; } /* header already shows the cart + badge */
    body:has(#nw_scan_go) #nw-wa { display: none !important; } /* staff are on hand in store */
}

/* ---- Search by name (products without a barcode) ---- */
.nw-scan-manual-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--nw-forest, #0F2A1D);
    margin-bottom: 6px;
}
.nw-scan-manual .input-group-text { background: #fff; color: var(--nw-muted, #56635C); }
.nw-scan-manual input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
.nw-scan-results { border-radius: 12px; overflow: hidden; box-shadow: 0 6px 18px rgba(15, 42, 29, .08); }
.nw-scan-results .nw-hit-add { border-radius: 10px; font-weight: 700; min-width: 64px; }
.nw-scan-results .nw-results-title { background: var(--cream, #FFF6EE); color: var(--nw-forest, #0F2A1D); }
.nw-scan-results .nw-results-title .btn-close { font-size: 12px; }

/* Quick checkout form open: hide the sticky bar so it does not cover "Continue to pay". */
.nw-scan-details-open .nw-scan-sticky { display: none !important; }
.nw-scan-details .form-control { border-radius: 10px; }
