/* ============================================================
   MAPP — NEW FEATURES (v3.5.0)
   Shared bottom-sheet shell + per-feature styling.
   Everything here is scoped under .mapp-nf-* so it can never
   collide with the theme, and all of it is hidden on desktop
   where the app UI doesn't run.
============================================================ */

/* ---------- Shared bottom-sheet shell ---------- */
.mapp-nf-sheet {
    position: fixed;
    inset: 0;
    z-index: 99993;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity .28s ease, visibility 0s linear .28s;
}
.mapp-nf-sheet[hidden] { display: none !important; }
.mapp-nf-sheet.is-open {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transition: opacity .28s ease;
}

.mapp-nf-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 15, 25, .5);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.mapp-nf-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    /* Forced light palette — same reasoning as the cart drawer: purchase
       surfaces need maximum contrast regardless of the site's dark mode. */
    --nf-bg: #ffffff;
    --nf-text: #0f172a;
    --nf-muted: #64748b;
    --nf-line: #e5e7eb;
    --nf-soft: #f1f5f9;
    color-scheme: light;
    background: var(--nf-bg);
    color: var(--nf-text);
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -14px 44px rgba(0, 0, 0, .22);
    display: flex;
    flex-direction: column;
    max-height: 88dvh;
    overflow: hidden;
    transform: translateY(100%);
    transition: transform .4s cubic-bezier(.32, .72, 0, 1);
}
.mapp-nf-sheet.is-open .mapp-nf-panel { transform: translateY(0); }

@media (min-width: 768px) {
    .mapp-nf-panel {
        max-width: 460px;
        right: 24px;
        left: auto;
        bottom: 92px;
        border-radius: 22px;
        max-height: min(700px, 84vh);
    }
    html[dir="rtl"] .mapp-nf-panel { right: auto; left: 24px; }
}

.mapp-nf-grab {
    width: 38px;
    height: 4px;
    background: #d8dde6;
    border-radius: 99px;
    margin: 8px auto 0;
    flex: 0 0 auto;
}
@media (min-width: 768px) { .mapp-nf-grab { display: none; } }

.mapp-nf-head {
    flex: 0 0 auto;
    padding: 14px 20px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.mapp-nf-head h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    color: var(--nf-text);
    letter-spacing: -.2px;
}
.mapp-nf-close {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 999px;
    background: var(--nf-soft);
    color: var(--nf-text);
    display: grid;
    place-items: center;
    cursor: pointer;
    padding: 0;
    flex: 0 0 auto;
}
.mapp-nf-close span {
    display: block;
    font-size: 26px;
    line-height: 1;
    margin-top: -3px;
    font-family: Arial, sans-serif;
}
.mapp-nf-close:active { transform: scale(.92); }

.mapp-nf-body {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 4px 18px 18px;
}

.mapp-nf-foot {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: 1fr 1.6fr;
    gap: 10px;
    padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--nf-line);
    background: var(--nf-bg);
}

.mapp-nf-btn {
    border: 0;
    border-radius: 13px;
    padding: 15px 14px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    font-family: inherit;
    transition: transform .14s;
}
.mapp-nf-btn:active { transform: scale(.97); }
.mapp-nf-btn-solid { background: #0f172a; color: #fff; }
.mapp-nf-btn-ghost { background: var(--nf-soft); color: var(--nf-text); }

/* ============================================================
   FEATURE: FREE SHIPPING PROGRESS BAR
============================================================ */
.mapp-nf-ship {
    margin: 0 0 14px;
    padding: 14px 16px;
    border-radius: 14px;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    border: 1px solid #bfdbfe;
}
.mapp-nf-ship.is-qualified {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border-color: #a7f3d0;
}
.mapp-nf-ship-text {
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: 700;
    color: #1e3a8a;
    display: flex;
    align-items: center;
    gap: 7px;
    line-height: 1.5;
}
.mapp-nf-ship.is-qualified .mapp-nf-ship-text { color: #065f46; }
.mapp-nf-ship-text b { font-weight: 800; }
.mapp-nf-ship-bar {
    height: 8px;
    border-radius: 99px;
    background: rgba(255, 255, 255, .75);
    overflow: hidden;
}
.mapp-nf-ship-fill {
    height: 100%;
    width: 0;
    border-radius: 99px;
    background: linear-gradient(90deg, #3b82f6, #2563eb);
    transition: width .55s cubic-bezier(.4, 0, .2, 1);
}
.mapp-nf-ship.is-qualified .mapp-nf-ship-fill {
    background: linear-gradient(90deg, #10b981, #059669);
}
html[dir="rtl"] .mapp-nf-ship-fill {
    background: linear-gradient(270deg, #3b82f6, #2563eb);
}
html[dir="rtl"] .mapp-nf-ship.is-qualified .mapp-nf-ship-fill {
    background: linear-gradient(270deg, #10b981, #059669);
}

/* ============================================================
   FEATURE: WHATSAPP ORDER BUTTON
============================================================ */
.mapp-nf-wa {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    padding: 15px 14px;
    margin-top: 10px;
    border: 0;
    border-radius: 13px;
    background: #25d366;
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 5px 16px rgba(37, 211, 102, .32);
    transition: transform .14s;
}
.mapp-nf-wa:active { transform: scale(.97); }
.mapp-nf-wa svg { width: 20px; height: 20px; fill: currentColor; }

/* ============================================================
   FEATURE: CART UPSELLS
============================================================ */
.mapp-nf-upsell { margin-top: 16px; }
.mapp-nf-upsell-title {
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: 800;
    color: var(--nf-text, #0f172a);
}
.mapp-nf-upsell-track {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
}
.mapp-nf-upsell-track::-webkit-scrollbar { display: none; }
.mapp-nf-upsell-card {
    flex: 0 0 128px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 13px;
    padding: 9px;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.mapp-nf-upsell-card img {
    width: 100%;
    height: 90px;
    object-fit: contain;
    background: #fff;
    border-radius: 9px;
}
.mapp-nf-upsell-name {
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.35;
    color: #0f172a;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.mapp-nf-upsell-price {
    font-size: 13px;
    font-weight: 800;
    color: #0f172a;
}
.mapp-nf-upsell-add {
    border: 0;
    background: #0f172a;
    color: #fff;
    border-radius: 9px;
    padding: 7px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
}
.mapp-nf-upsell-add:active { transform: scale(.95); }
.mapp-nf-upsell-add.is-busy { opacity: .55; pointer-events: none; }

/* ============================================================
   FEATURE: SEARCH SHEET
============================================================ */
.mapp-nf-search .mapp-nf-panel { max-height: 90dvh; }
.mapp-nf-searchbar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--nf-line);
}
.mapp-nf-searchicon {
    color: var(--nf-muted);
    display: grid;
    place-items: center;
    flex: 0 0 auto;
}
.mapp-nf-searchicon svg { width: 19px; height: 19px; }
.mapp-nf-searchinput {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    background: var(--nf-soft);
    border-radius: 11px;
    padding: 12px 14px;
    font-size: 16px; /* 16px stops iOS from zooming on focus */
    font-family: inherit;
    color: var(--nf-text);
    outline: none;
}
.mapp-nf-searchcancel {
    border: 0;
    background: transparent;
    color: #2563eb;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    flex: 0 0 auto;
    padding: 6px 2px;
}
.mapp-nf-searchresults {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 12px 18px;
}
.mapp-nf-searchhint,
.mapp-nf-searchempty {
    text-align: center;
    color: var(--nf-muted);
    font-size: 14px;
    padding: 34px 20px;
    margin: 0;
}
.mapp-nf-result {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: background .15s;
}
.mapp-nf-result:active { background: var(--nf-soft); }
.mapp-nf-result img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    background: #fff;
    border-radius: 10px;
    flex: 0 0 auto;
    border: 1px solid var(--nf-line);
}
.mapp-nf-result-body { min-width: 0; flex: 1 1 auto; }
.mapp-nf-result-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--nf-text);
    line-height: 1.4;
    margin: 0 0 3px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.mapp-nf-result-price {
    font-size: 14px;
    font-weight: 800;
    color: var(--nf-text);
    margin: 0;
}
.mapp-nf-spinner {
    width: 30px;
    height: 30px;
    margin: 34px auto;
    border: 3px solid rgba(0, 0, 0, .1);
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: mappNfSpin .8s linear infinite;
}
@keyframes mappNfSpin { to { transform: rotate(360deg); } }

/* ============================================================
   FEATURE: FILTER SHEET
============================================================ */
.mapp-nf-filter-fab {
    position: fixed;
    bottom: calc(var(--mapp-nav-h, 78px) + env(safe-area-inset-bottom, 0px) + 14px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 9988;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    border: 0;
    border-radius: 999px;
    background: #0f172a;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .3);
}
.mapp-nf-filter-fab svg { width: 17px; height: 17px; }
.mapp-nf-filter-fab:active { transform: translateX(-50%) scale(.95); }

.mapp-nf-group { margin-bottom: 22px; }
.mapp-nf-group h3 {
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: 800;
    color: var(--nf-text);
}
.mapp-nf-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.mapp-nf-chip {
    border: 1px solid var(--nf-line);
    background: var(--nf-bg);
    color: var(--nf-text);
    border-radius: 999px;
    padding: 9px 15px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s, border-color .15s, color .15s;
}
.mapp-nf-chip.is-active {
    background: #0f172a;
    border-color: #0f172a;
    color: #fff;
}
.mapp-nf-pricerow {
    display: flex;
    align-items: center;
    gap: 10px;
}
.mapp-nf-pricerow input {
    flex: 1 1 0;
    min-width: 0;
    border: 1px solid var(--nf-line);
    border-radius: 11px;
    padding: 12px 14px;
    font-size: 16px;
    font-family: inherit;
    color: var(--nf-text);
    background: var(--nf-bg);
    outline: none;
}
.mapp-nf-pricerow input:focus { border-color: #2563eb; }
.mapp-nf-pricedash { color: var(--nf-muted); flex: 0 0 auto; }

/* ============================================================
   FEATURE: ORDER TRACKING
============================================================ */
.mapp-nf-trackform {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
}
.mapp-nf-trackform input {
    border: 1px solid var(--nf-line);
    border-radius: 11px;
    padding: 13px 14px;
    font-size: 16px;
    font-family: inherit;
    color: var(--nf-text);
    background: var(--nf-bg);
    outline: none;
}
.mapp-nf-trackform input:focus { border-color: #2563eb; }
.mapp-nf-trackform .mapp-nf-btn { width: 100%; }

.mapp-nf-trackcard {
    border: 1px solid var(--nf-line);
    border-radius: 14px;
    padding: 16px;
    background: #f8fafc;
}
.mapp-nf-trackrow {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
    font-size: 13.5px;
}
.mapp-nf-trackrow span { color: var(--nf-muted); }
.mapp-nf-trackrow b { color: var(--nf-text); font-weight: 700; }

.mapp-nf-steps {
    display: flex;
    margin: 20px 0 6px;
    padding: 0;
    list-style: none;
}
.mapp-nf-step {
    flex: 1 1 0;
    text-align: center;
    position: relative;
    font-size: 11.5px;
    color: var(--nf-muted);
    font-weight: 600;
}
.mapp-nf-step::before {
    content: '';
    display: block;
    width: 22px;
    height: 22px;
    margin: 0 auto 8px;
    border-radius: 50%;
    background: #e2e8f0;
    border: 3px solid var(--nf-bg);
    box-shadow: 0 0 0 1px #e2e8f0;
    position: relative;
    z-index: 2;
}
.mapp-nf-step::after {
    content: '';
    position: absolute;
    top: 11px;
    inset-inline-start: 50%;
    width: 100%;
    height: 3px;
    background: #e2e8f0;
    z-index: 1;
}
.mapp-nf-step:last-child::after { display: none; }
.mapp-nf-step.is-done { color: #059669; }
.mapp-nf-step.is-done::before { background: #10b981; box-shadow: 0 0 0 1px #10b981; }
.mapp-nf-step.is-done::after { background: #10b981; }
.mapp-nf-step.is-current::before {
    background: #2563eb;
    box-shadow: 0 0 0 1px #2563eb, 0 0 0 6px rgba(37, 99, 235, .16);
}
.mapp-nf-step.is-current { color: #2563eb; font-weight: 800; }

.mapp-nf-trackitems {
    margin: 16px 0 0;
    padding: 14px 0 0;
    border-top: 1px dashed var(--nf-line);
    list-style: none;
}
.mapp-nf-trackitems li {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    padding: 4px 0;
    color: var(--nf-text);
    gap: 12px;
}
.mapp-nf-trackitems li span:last-child { color: var(--nf-muted); flex: 0 0 auto; }
.mapp-nf-trackerror {
    text-align: center;
    color: #dc2626;
    font-size: 14px;
    font-weight: 600;
    padding: 18px;
    background: #fef2f2;
    border-radius: 12px;
}

/* ============================================================
   FEATURE: RECENTLY VIEWED
============================================================ */
.mapp-nf-recent {
    padding: 20px 16px calc(20px + var(--mapp-nav-h, 78px));
    background: #f8fafc;
    margin-top: 24px;
}
.mapp-nf-recent[hidden] { display: none !important; }
.mapp-nf-recent-title {
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
}
.mapp-nf-recent-track {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
}
.mapp-nf-recent-track::-webkit-scrollbar { display: none; }
.mapp-nf-recent-card {
    flex: 0 0 118px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 13px;
    padding: 9px;
    text-decoration: none;
    color: inherit;
}
.mapp-nf-recent-card img {
    width: 100%;
    height: 88px;
    object-fit: contain;
    border-radius: 9px;
    margin-bottom: 7px;
}
.mapp-nf-recent-name {
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.35;
    color: #0f172a;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 4px;
}
.mapp-nf-recent-price {
    font-size: 12.5px;
    font-weight: 800;
    color: #0f172a;
}

/* ============================================================
   FEATURE: PAYMENT BADGES
============================================================ */
.mapp-nf-pay {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 7px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--nf-line, #e5e7eb);
}
.mapp-nf-pay-badge {
    height: 27px;
    min-width: 42px;
    padding: 0 9px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid #e5e7eb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: .3px;
    color: #0f172a;
    text-transform: uppercase;
}
.mapp-nf-pay-badge.is-knet       { background: #003b7a; color: #fff; border-color: #003b7a; }
.mapp-nf-pay-badge.is-visa       { background: #1a1f71; color: #fff; border-color: #1a1f71; }
.mapp-nf-pay-badge.is-mastercard { background: #eb001b; color: #fff; border-color: #eb001b; }
.mapp-nf-pay-badge.is-amex       { background: #006fcf; color: #fff; border-color: #006fcf; }
.mapp-nf-pay-badge.is-applepay   { background: #000; color: #fff; border-color: #000; }
.mapp-nf-pay-badge.is-googlepay  { background: #fff; color: #5f6368; }
.mapp-nf-pay-badge.is-tabby      { background: #3bffb4; color: #002c1b; border-color: #3bffb4; }
.mapp-nf-pay-badge.is-tamara     { background: #1c1c3c; color: #fff; border-color: #1c1c3c; }
.mapp-nf-pay-badge.is-paypal     { background: #003087; color: #fff; border-color: #003087; }
.mapp-nf-pay-badge.is-cod        { background: #f1f5f9; color: #0f172a; }

/* ============================================================
   FEATURE: INSTALLMENT NOTE
============================================================ */
.mapp-nf-installment {
    display: block;
    margin-top: 6px;
    font-size: 12.5px;
    font-weight: 600;
    color: #7c3aed;
    background: #f5f3ff;
    border: 1px dashed #ddd6fe;
    border-radius: 8px;
    padding: 6px 11px;
    width: fit-content;
}

/* ============================================================
   DESKTOP: the whole app layer is hidden above 1024px, so every
   new-feature surface must be too.
============================================================ */
@media (min-width: 1025px) {
    .mapp-nf-sheet,
    .mapp-nf-filter-fab,
    .mapp-nf-recent {
        display: none !important;
    }
}
