/* ═══════════════════════════════════════════════════════════════
   PWA — install + order-update notifications (pwa.js)
   Loaded on every public page via _PwaHead, before the page stylesheets,
   so every selector here is .pwa-* scoped.
   ═══════════════════════════════════════════════════════════════ */

/* "Get app" buttons show only while pwa.js says this browser can install (any page, even ones
   rendered later by the menu app) */
html:not([data-pwa-install-mode]) [data-pwa-install] {
    display: none !important;
}

.pwa-sheet[hidden],
.pwa-sheet-backdrop[hidden],
.pwa-success-card[hidden],
.pwa-promo-slot[hidden],
.pwa-section[hidden],
.pwa-row[hidden],
.pwa-row [hidden],
.pwa-section-note[hidden],
.success-push[hidden] {
    display: none !important;
}

/* ── Navbar "Get app" button ──────────────────────────────── */
.pwa-nav-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--yellow, #E7FC93);
    color: var(--red, #C12239);
    font-family: var(--font-body, sans-serif);
    font-size: 1rem;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    overflow: hidden;
    isolation: isolate;
    box-shadow: 0 6px 16px rgba(100, 15, 30, 0.22);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

[dir="rtl"] .pwa-nav-btn {
    padding: 0;
}

.pwa-nav-btn .pwa-nav-label { display: none; }

    .pwa-nav-btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 10px 22px rgba(100, 15, 30, 0.28);
    }

    .pwa-nav-btn:active {
        transform: scale(0.95);
    }

    .pwa-nav-btn:focus-visible {
        outline: 3px solid rgba(231, 252, 147, 0.7);
        outline-offset: 2px;
    }

    .pwa-nav-btn svg {
        flex-shrink: 0;
        animation: pwaNavNudge 3.2s ease-in-out 1.2s infinite;
    }

    /* A light sweep across the pill every few seconds */
    .pwa-nav-btn::before {
        content: "";
        position: absolute;
        inset: 0;
        z-index: -1;
        background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.85) 50%, transparent 70%);
        transform: translateX(-120%);
        animation: pwaNavShine 4.8s ease-in-out 2s infinite;
    }

    /* Pulse ring — draws the eye on arrival, then settles */
    .pwa-nav-btn::after {
        content: "";
        position: absolute;
        inset: 0;
        border-radius: inherit;
        box-shadow: 0 0 0 0 rgba(231, 252, 147, 0.75);
        animation: pwaNavPulse 2s ease-out 0.6s 3;
        pointer-events: none;
    }

    html[data-pwa-install-mode] .pwa-nav-btn {
        animation: pwaNavIn 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

@keyframes pwaNavIn {
    from { opacity: 0; transform: scale(0.6); }
    to { opacity: 1; transform: none; }
}

@keyframes pwaNavNudge {
    0%, 62%, 100% { transform: translateY(0); }
    70% { transform: translateY(3px); }
    78% { transform: translateY(-1px); }
    86% { transform: translateY(2px); }
}

@keyframes pwaNavShine {
    0%, 70% { transform: translateX(-120%); }
    100% { transform: translateX(120%); }
}

@keyframes pwaNavPulse {
    0% { box-shadow: 0 0 0 0 rgba(231, 252, 147, 0.75); }
    100% { box-shadow: 0 0 0 12px rgba(231, 252, 147, 0); }
}

/* Marketing navbar: the compact twin sits beside the burger when the link row collapses */
.pwa-nav-btn--compact {
    display: none;
    margin-inline-start: auto;
    margin-inline-end: 0.5rem;
}

@media (max-width: 1300px) {
    .pwa-nav-btn--compact {
        display: inline-flex;
    }
}

/* Order navbar: icon-only on small phones so the logo keeps its room */
@media (max-width: 479px) {
    .pwa-nav-btn--order {
        width: 44px;
        padding: 0;
    }

        .pwa-nav-btn--order .pwa-nav-label {
            display: none;
        }
}

@media (max-width: 380px) {
    .pwa-nav-btn--compact {
        width: 44px;
        padding: 0;
    }

        .pwa-nav-btn--compact .pwa-nav-label {
            display: none;
        }
}

/* ── Shared buttons ───────────────────────────────────────── */
.pwa-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 3.25rem;
    padding: 0 1.4rem;
    border: none;
    border-radius: 999px;
    font-family: var(--font-body, sans-serif);
    font-size: 1.1rem;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

    .pwa-btn:active {
        transform: scale(0.97);
    }

.pwa-btn-primary {
    background: var(--red, #C12239);
    color: #fff;
    box-shadow: 0 10px 22px rgba(193, 34, 57, 0.28);
}

    .pwa-btn-primary:hover {
        background: #a91d31;
    }

.pwa-btn-ghost {
    background: transparent;
    color: #5f5254;
}

    .pwa-btn-ghost:hover {
        background: rgba(38, 27, 29, 0.05);
    }

.pwa-btn-sm {
    min-height: 2.5rem;
    padding: 0 1rem;
    font-size: 0.95rem;
    box-shadow: none;
}

/* ── Install sheet (popup + iOS guide) ────────────────────── */
html.pwa-sheet-open,
html.pwa-sheet-open body {
    overflow: hidden;
}

/* The floating privacy-settings pill would sit on top of full-screen UI */
html.pwa-sheet-open .tracking-preferences,
body:has(#profileSheet:not([hidden])) .tracking-preferences {
    display: none !important;
}

.pwa-sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10000; /* above the privacy-settings pill (9999) */
    background: rgba(38, 20, 24, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: pwaFade 0.25s ease;
}

.pwa-sheet {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 10001;
    max-height: 92dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 1.5rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
    border-radius: 1.75rem 1.75rem 0 0;
    background: #fffdf9;
    color: #261b1d;
    font-family: var(--font-body, sans-serif);
    box-shadow: 0 -18px 48px rgba(38, 20, 24, 0.25);
    animation: pwaSheetUp 0.38s cubic-bezier(0.2, 0.9, 0.25, 1.1);
}

    .pwa-sheet::before {
        content: "";
        position: absolute;
        inset: 0 0 auto;
        height: 7.5rem;
        border-radius: inherit;
        background: radial-gradient(120% 100% at 50% 0%, rgba(255, 187, 248, 0.5) 0%, rgba(253, 225, 168, 0.35) 45%, transparent 75%);
        pointer-events: none;
    }

@media (min-width: 600px) {
    .pwa-sheet {
        inset-inline: auto;
        left: 50%;
        top: 50%;
        bottom: auto;
        width: min(28rem, calc(100vw - 2rem));
        max-height: calc(100dvh - 2rem);
        padding-bottom: 1.5rem;
        border-radius: 1.75rem;
        transform: translate(-50%, -50%);
        animation: pwaSheetPop 0.32s cubic-bezier(0.2, 0.9, 0.25, 1.1);
    }
}

@keyframes pwaFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pwaSheetUp {
    from { transform: translateY(100%); }
    to { transform: none; }
}

@keyframes pwaSheetPop {
    from { opacity: 0; transform: translate(-50%, -46%) scale(0.96); }
    to { opacity: 1; transform: translate(-50%, -50%); }
}

.pwa-sheet-close {
    position: absolute;
    top: 0.875rem;
    inset-inline-end: 0.875rem;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 2.375rem;
    height: 2.375rem;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 0 0 1px rgba(38, 27, 29, 0.08);
    color: #5f5254;
    cursor: pointer;
}

.pwa-sheet-head {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.35rem;
    padding: 0.25rem 1.5rem 0;
}

.pwa-sheet-icon {
    width: 4.5rem;
    height: 4.5rem;
    margin-bottom: 0.4rem;
    border-radius: 1.2rem;
    box-shadow: 0 12px 26px rgba(193, 34, 57, 0.28), 0 0 0 4px #fff;
    animation: pwaIconBob 3s ease-in-out 0.5s infinite;
}

@keyframes pwaIconBob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.pwa-sheet-title {
    margin: 0;
    font-family: var(--font-display, sans-serif);
    font-size: 1.6rem;
    font-weight: 900;
    line-height: 1.15;
    color: #261b1d;
}

.pwa-sheet-sub {
    margin: 0;
    max-width: 22rem;
    font-size: 1.02rem;
    line-height: 1.45;
    color: #76686a;
}

.pwa-perks,
.pwa-steps {
    position: relative;
    list-style: none;
    margin: 1.25rem 0 0;
    padding: 0;
}

    .pwa-perks li {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.6rem 0.25rem;
        font-size: 1.02rem;
        font-weight: 600;
        line-height: 1.35;
    }

.pwa-perk-icon {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.75rem;
    background: rgba(193, 34, 57, 0.08);
    color: var(--red, #C12239);
}

.pwa-steps {
    counter-reset: none;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.pwa-step {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 0.95rem;
    border-radius: 1.125rem;
    background: #fff;
    box-shadow: 0 1px 2px rgba(38, 27, 29, 0.05), 0 0 0 1px rgba(38, 27, 29, 0.06);
    animation: pwaStepIn 0.4s ease both;
}

    .pwa-step:nth-child(2) { animation-delay: 0.08s; }
    .pwa-step:nth-child(3) { animation-delay: 0.16s; }

@keyframes pwaStepIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

.pwa-step-num {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--red, #C12239);
    color: #fff;
    font-family: var(--font-display, sans-serif);
    font-size: 1.05rem;
    font-weight: 900;
}

.pwa-step-copy {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    line-height: 1.35;
}

    .pwa-step-copy strong {
        font-size: 1.05rem;
        font-weight: 800;
    }

    .pwa-step-copy span {
        font-size: 0.9rem;
        color: #76686a;
    }

/* The glyph the customer will see on their screen (iOS system blue) */
.pwa-step-glyph {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    min-width: 2.75rem;
    height: 2.75rem;
    padding: 0 0.5rem;
    border-radius: 0.8rem;
    background: #eef4ff;
    color: #007aff;
}

.pwa-step-add {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
    font-size: 1rem;
    font-weight: 700;
}

.pwa-sheet-actions {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 1.25rem;
}

    .pwa-sheet-actions .pwa-btn {
        width: 100%;
    }

.pwa-sheet-foot {
    margin: 0.5rem 0 0;
    text-align: center;
    font-size: 0.85rem;
    color: #9a8e90;
}

/* ── Profile: "App & notifications" page ──────────────────── */
.pwa-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.pwa-row {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 1rem;
    border-radius: 1.25rem;
    background: #fff;
    box-shadow: 0 1px 2px rgba(38, 27, 29, 0.05), 0 0 0 1px rgba(38, 27, 29, 0.05);
    font-family: var(--font-body, sans-serif);
}

.pwa-row-icon {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.875rem;
    background: rgba(193, 34, 57, 0.08);
    color: var(--red, #C12239);
}

.pwa-row.is-blocked .pwa-row-icon {
    background: rgba(107, 114, 128, 0.12);
    color: #6b7280;
}

.pwa-row-copy {
    flex: 1 1 0%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    line-height: 1.4;
}

    .pwa-row-copy strong {
        font-size: 1.1rem;
        font-weight: 800;
        color: #261b1d;
    }

    .pwa-row-copy span {
        font-size: 0.92rem;
        color: #76686a;
    }

.pwa-row.is-blocked .pwa-row-copy span {
    color: #991b1b;
}

.pwa-row .btn {
    flex: 0 0 auto;
    padding-inline: 1.1rem;
    white-space: nowrap;
}

.pwa-section-note {
    margin: 0;
    padding: 0.25rem 0.5rem;
    text-align: center;
    font-size: 0.92rem;
    color: #15803d;
}

/* On/off switch */
.pwa-switch {
    position: relative;
    flex: 0 0 auto;
    width: 3.25rem;
    height: 1.95rem;
    padding: 0;
    border: none;
    border-radius: 999px;
    background: #d9d2d3;
    cursor: pointer;
    transition: background 0.2s ease;
}

    .pwa-switch[aria-checked="true"] {
        background: #16a34a;
    }

.pwa-switch-knob {
    position: absolute;
    top: 0.2rem;
    inset-inline-start: 0.2rem;
    width: 1.55rem;
    height: 1.55rem;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: inset-inline-start 0.22s cubic-bezier(0.3, 1.4, 0.6, 1);
}

.pwa-switch[aria-checked="true"] .pwa-switch-knob {
    inset-inline-start: calc(100% - 1.75rem);
}

.pwa-switch.is-busy {
    cursor: progress;
    opacity: 0.7;
}

    .pwa-switch.is-busy .pwa-switch-knob {
        animation: pwaBusy 0.9s ease-in-out infinite;
    }

@keyframes pwaBusy {
    50% { transform: scale(0.8); }
}

.pwa-switch:focus-visible {
    outline: 3px solid rgba(193, 34, 57, 0.35);
    outline-offset: 2px;
}

/* Profile home: "Get the app" promo card */
.pwa-promo-slot {
    margin-top: 1rem;
}

.pwa-promo {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 1rem;
    border-radius: 1.25rem;
    background: linear-gradient(120deg, #fff 0%, #fff6fe 55%, #fdf3dd 100%);
    box-shadow: 0 1px 2px rgba(38, 27, 29, 0.05), 0 0 0 1px rgba(193, 34, 57, 0.12);
    font-family: var(--font-body, sans-serif);
}

.pwa-promo-icon {
    flex-shrink: 0;
    width: 3rem;
    height: 3rem;
    border-radius: 0.85rem;
    box-shadow: 0 6px 14px rgba(193, 34, 57, 0.22);
}

.pwa-promo-copy {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    line-height: 1.3;
}

    .pwa-promo-copy strong {
        font-size: 1.05rem;
        font-weight: 800;
        color: #261b1d;
    }

    .pwa-promo-copy span {
        font-size: 0.88rem;
        color: #76686a;
    }

/* ── Success overlay ──────────────────────────────────────── */
/* One-tap "notify me when it's ready" */
.success-push {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem 0.875rem;
    border-radius: 1.25rem;
    background: rgba(41, 66, 140, 0.06);
    border: 1px solid rgba(41, 66, 140, 0.14);
    color: var(--blue);
    font-family: var(--font-body);
    text-align: start;
}

    .success-push > svg {
        flex: 0 0 auto;
    }

    .success-push.is-on {
        background: rgba(34, 197, 94, 0.08);
        border-color: rgba(34, 197, 94, 0.25);
        color: #15803d;
    }

.success-push-text {
    flex: 1 1 0%;
    min-width: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.35;
}

.success-push .btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

/* "Get the app" card after the order is placed */
.pwa-success-card {
    width: 100%;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 0.75rem 0.875rem;
    padding: 1rem;
    border-radius: 1.25rem;
    background: linear-gradient(125deg, #fff6fe 0%, #fffdf5 50%, #f5fbdc 100%);
    border: 1.5px solid rgba(193, 34, 57, 0.16);
    font-family: var(--font-body, sans-serif);
    text-align: start;
    animation: pwaCardIn 0.5s cubic-bezier(0.2, 0.9, 0.25, 1.1) 0.35s both;
}

@keyframes pwaCardIn {
    from { opacity: 0; transform: translateY(14px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

.pwa-success-icon {
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 0.9rem;
    box-shadow: 0 8px 18px rgba(193, 34, 57, 0.25);
}

.pwa-success-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    line-height: 1.35;
}

    .pwa-success-copy strong {
        font-size: 1.05rem;
        font-weight: 800;
        color: #261b1d;
    }

    .pwa-success-copy span {
        font-size: 0.92rem;
        color: #76686a;
    }

.pwa-success-card .pwa-btn {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 3rem;
}

@media (max-width: 380px) {
    .pwa-row,
    .success-push {
        flex-wrap: wrap;
    }

        .pwa-row .btn,
        .success-push .btn {
            width: 100%;
        }
}

@media (prefers-reduced-motion: reduce) {
    .pwa-nav-btn,
    .pwa-nav-btn svg,
    .pwa-nav-btn::before,
    .pwa-nav-btn::after,
    .pwa-sheet,
    .pwa-sheet-icon,
    .pwa-step,
    .pwa-success-card {
        animation: none !important;
    }
}
