/* ==========================================================
   Neat Meat — First Order Popup  |  popup.css  v1.0.0
   RTL-first, WCAG 2.1 AA, mobile-first
   ========================================================== */

/* Overlay */
.nm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    z-index: 999990;
    display: flex;
    align-items: flex-end;          /* mobile: sheet from bottom */
    justify-content: center;
    padding: 0;
    -webkit-overflow-scrolling: touch;
}

/* Desktop: center vertically */
@media (min-width: 600px) {
    .nm-overlay {
        align-items: center;
        padding: 1.5rem;
    }
}

/* ── Box ── */
.nm-popup-box {
    position: relative;
    background: #FAF5EE;            /* brand cream */
    border-radius: 20px 20px 0 0;   /* mobile: bottom sheet */
    width: 100%;
    max-width: 420px;
    overflow: hidden;
    /* Prevent layout shift on mobile with keyboard open */
    max-height: 95dvh;
    overflow-y: auto;
}

@media (min-width: 600px) {
    .nm-popup-box {
        border-radius: 16px;        /* desktop: fully rounded */
        max-height: 90vh;
    }
}

/* ── Close button ── */
.nm-close-btn {
    position: absolute;
    top: 12px;
    left: 14px;                     /* RTL default: physical left = visual start */
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0,0,0,.15);
    color: #fff;
    border-radius: 50%;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity .3s ease, background .2s;
    z-index: 2;
}
.nm-close-btn:hover,
.nm-close-btn:focus-visible {
    background: rgba(0,0,0,.30);
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* LTR (English) — flip close button and text alignment */
[dir="ltr"] .nm-close-btn {
    left: auto;
    right: 14px;
}
[dir="ltr"] .nm-popup-body {
    text-align: left;
}
[dir="ltr"] .nm-coupon-label {
    text-align: left;
}
[dir="ltr"] .nm-disclaimer {
    text-align: center;
}

/* ── Header ── */
.nm-popup-header {
    background: #db1f26;
    padding: 28px 24px 22px;
    text-align: center;
}

.nm-brand-badge {
    display: inline-block;
    background: rgba(255,255,255,.18);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: 4px 14px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,.35);
}

/* ── Body ── */
.nm-popup-body {
    padding: 24px 24px 28px;
    text-align: right;
}

.nm-popup-title {
    font-size: clamp(17px, 4vw, 20px);
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 10px;
    line-height: 1.45;
    font-family: 'IBM Plex Sans Arabic', 'Cairo', sans-serif;
}

.nm-popup-sub {
    font-size: 14px;
    color: #444;
    line-height: 1.7;
    margin: 0 0 20px;
    font-family: 'IBM Plex Sans Arabic', 'Cairo', sans-serif;
}

/* ── Coupon ── */
.nm-coupon-wrap {
    margin-bottom: 20px;
}

.nm-coupon-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: .07em;
    margin-bottom: 8px;
}

.nm-coupon-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    border: 2px dashed #db1f26;
    border-radius: 10px;
    padding: 12px 16px;
    gap: 12px;
}

.nm-coupon-code {
    font-size: 22px;
    font-weight: 700;
    color: #db1f26;
    letter-spacing: .06em;
    font-family: 'IBM Plex Mono', 'Courier New', monospace;
}

.nm-copy-btn {
    flex-shrink: 0;
    background: #db1f26;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, transform .1s;
    font-family: 'IBM Plex Sans Arabic', 'Cairo', sans-serif;
}
.nm-copy-btn:hover {
    background: #b91920;
}
.nm-copy-btn:active {
    transform: scale(.96);
}
.nm-copy-btn:focus-visible {
    outline: 3px solid #db1f26;
    outline-offset: 2px;
}
.nm-copy-btn.copied {
    background: #2e7d32;
}

/* ── CTA button (Continue Shopping — closes popup) ── */
.nm-cta-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background: #db1f26;
    color: #FAF5EE;
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    padding: 15px 20px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: background .2s, transform .1s;
    font-family: 'IBM Plex Sans Arabic', 'Cairo', sans-serif;
    margin-bottom: 12px;
    /* Touch target: min 48px — WCAG 2.5.5 */
    min-height: 48px;
    line-height: 1.2;
    -webkit-appearance: none;
    appearance: none;
}
.nm-cta-btn:hover {
    background: #b91920;
    color: #FAF5EE;
}
.nm-cta-btn:active {
    transform: scale(.98);
}
.nm-cta-btn:focus-visible {
    outline: 3px solid #b91920;
    outline-offset: 3px;
}

/* ── Disclaimer ── */
.nm-disclaimer {
    font-size: 11px;
    color: #999;
    text-align: center;
    margin: 0;
    line-height: 1.5;
    font-family: 'IBM Plex Sans Arabic', 'Cairo', sans-serif;
}

/* ==========================================================
   ANIMATIONS
   ========================================================== */

/* --- slide-up (default — mobile bottom sheet feel) --- */
.nm-anim-slide-up {
    transform: translateY(60px);
    opacity: 0;
    transition: transform .38s cubic-bezier(.22,.68,0,1.2), opacity .28s ease;
}
.nm-anim-slide-up.nm-visible {
    transform: translateY(0);
    opacity: 1;
}

/* --- fade --- */
.nm-anim-fade {
    opacity: 0;
    transition: opacity .35s ease;
}
.nm-anim-fade.nm-visible {
    opacity: 1;
}

/* --- scale --- */
.nm-anim-scale {
    transform: scale(.88);
    opacity: 0;
    transition: transform .35s cubic-bezier(.34,1.56,.64,1), opacity .25s ease;
}
.nm-anim-scale.nm-visible {
    transform: scale(1);
    opacity: 1;
}

/* overlay fade */
.nm-overlay {
    opacity: 0;
    transition: opacity .25s ease;
}
.nm-overlay.nm-overlay-visible {
    opacity: 1;
}

/* ==========================================================
   REDUCED MOTION — respect OS preference (WCAG 2.3.3)
   ========================================================== */
@media (prefers-reduced-motion: reduce) {
    .nm-anim-slide-up,
    .nm-anim-fade,
    .nm-anim-scale {
        transition: opacity .15s ease !important;
        transform: none !important;
    }
}

/* ==========================================================
   HIGH CONTRAST MODE (Windows forced colors)
   ========================================================== */
@media (forced-colors: active) {
    .nm-popup-box     { border: 2px solid ButtonText; }
    .nm-cta-btn       { forced-color-adjust: none; }
    .nm-coupon-box    { border-style: solid; }
}
