/* Popup dialogs and toasts used on every page (staff, POS, kitchen, driver app, customer pages). See js/popup.js. */
.pp-root {
    --pp-brand: var(--brand, #4a9b26);
    --pp-bg: #fff;
    --pp-text: #1d2433;
    --pp-muted: #6b7280;
    --pp-border: #e5e7eb;
    --pp-input: #f8fafc;
    --pp-shadow: 0 24px 60px -12px rgba(15, 23, 42, .35), 0 4px 14px rgba(15, 23, 42, .12);
    --pp-success: #16a34a;
    --pp-error: #dc2626;
    --pp-warning: #d97706;
    --pp-info: #2563eb;
    font-family: inherit;
}
[data-bs-theme="dark"] .pp-root {
    --pp-bg: #1c2230;
    --pp-text: #e8ebf2;
    --pp-muted: #9aa3b5;
    --pp-border: #2e3648;
    --pp-input: #151a25;
    --pp-shadow: 0 24px 60px -12px rgba(0, 0, 0, .7);
}

/* ---------------------------------------------------------------- dialog */
.pp-overlay {
    position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center;
    padding: 16px; background: rgba(15, 23, 42, .45); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
    opacity: 0; transition: opacity .18s ease;
}
.pp-overlay.show { opacity: 1; }
.pp-box {
    position: relative; width: 100%; max-width: 420px; max-height: calc(100vh - 32px); overflow: auto;
    background: var(--pp-bg); color: var(--pp-text); border-radius: 22px; box-shadow: var(--pp-shadow);
    padding: 28px 24px 20px; text-align: center; direction: rtl;
    transform: translateY(14px) scale(.94); transition: transform .24s cubic-bezier(.2, .9, .3, 1.25);
}
.pp-box.wide { max-width: 640px; }
.pp-box.has-form { text-align: right; }
.pp-overlay.show .pp-box { transform: none; }
.pp-overlay.shake .pp-box { animation: pp-shake .35s; }
.pp-x {
    position: absolute; top: 12px; left: 12px; width: 32px; height: 32px; border: 0; border-radius: 50%;
    background: transparent; color: var(--pp-muted); font-size: 1.3rem; line-height: 1; cursor: pointer;
}
.pp-x:hover { background: var(--pp-input); color: var(--pp-text); }

.pp-icon { width: 76px; height: 76px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; position: relative; }
.pp-icon::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: currentColor; opacity: .12; }
.pp-icon::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid currentColor; opacity: 0; animation: pp-ring 1.1s .15s ease-out; }
.pp-icon svg { width: 40px; height: 40px; position: relative; }
.pp-icon svg path, .pp-icon svg circle, .pp-icon svg line { fill: none; stroke: currentColor; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.pp-icon .draw { stroke-dasharray: 60; stroke-dashoffset: 60; animation: pp-draw .45s .12s ease-out forwards; }
.pp-icon .dot { fill: currentColor !important; stroke: none !important; }
.pp-success .pp-icon { color: var(--pp-success); }
.pp-error .pp-icon { color: var(--pp-error); }
.pp-warning .pp-icon { color: var(--pp-warning); }
.pp-info .pp-icon { color: var(--pp-info); }
.pp-question .pp-icon { color: var(--pp-brand); }
.pp-box.has-form .pp-icon { width: 56px; height: 56px; margin: 0 0 10px; }
.pp-box.has-form .pp-icon svg { width: 30px; height: 30px; }

.pp-title { font-size: 1.25rem; font-weight: 800; margin: 0 0 6px; }
.pp-msg { color: var(--pp-muted); font-size: .98rem; line-height: 1.7; margin: 0 0 4px; white-space: pre-line; }
.pp-msg b, .pp-msg strong { color: var(--pp-text); }

.pp-form { margin-top: 14px; text-align: right; }
.pp-field { margin-bottom: 12px; }
.pp-field label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 5px; }
.pp-field label .req { color: var(--pp-error); }
.pp-input {
    width: 100%; border: 1.5px solid var(--pp-border); background: var(--pp-input); color: var(--pp-text);
    border-radius: 12px; padding: 10px 12px; font: inherit; font-size: 1rem; outline: none; transition: border-color .15s, box-shadow .15s;
}
.pp-input:focus { border-color: var(--pp-brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pp-brand) 22%, transparent); background: var(--pp-bg); }
textarea.pp-input { min-height: 84px; resize: vertical; }
.pp-input.bad { border-color: var(--pp-error); }
.pp-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pp-chips button {
    border: 1px solid var(--pp-border); background: var(--pp-bg); color: var(--pp-text); border-radius: 999px;
    padding: 4px 12px; font: inherit; font-size: .85rem; cursor: pointer;
}
.pp-chips button:hover { border-color: var(--pp-brand); color: var(--pp-brand); }
.pp-err { color: var(--pp-error); font-size: .88rem; font-weight: 700; min-height: 1.2em; margin-top: 4px; }

.pp-actions { display: flex; gap: 10px; margin-top: 20px; }
.pp-actions .pp-btn { flex: 1; }
.pp-btn {
    border: 0; border-radius: 14px; padding: 12px 18px; font: inherit; font-weight: 800; font-size: 1rem; cursor: pointer;
    background: var(--pp-brand); color: #fff; transition: filter .15s, transform .1s; min-height: 48px;
}
.pp-btn:hover { filter: brightness(1.07); }
.pp-btn:active { transform: scale(.97); }
.pp-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--pp-brand) 40%, transparent); outline-offset: 2px; }
.pp-btn.danger { background: var(--pp-error); }
.pp-btn.success { background: var(--pp-success); }
.pp-btn.warning { background: var(--pp-warning); }
.pp-btn.ghost { background: var(--pp-input); color: var(--pp-text); border: 1px solid var(--pp-border); }
.pp-timer { position: absolute; bottom: 0; right: 0; height: 4px; background: currentColor; opacity: .45; border-radius: 0 0 22px 22px; animation: pp-shrink linear forwards; }
.pp-success .pp-timer { color: var(--pp-success); }
.pp-error .pp-timer { color: var(--pp-error); }
.pp-warning .pp-timer { color: var(--pp-warning); }
.pp-info .pp-timer { color: var(--pp-info); }

/* ---------------------------------------------------------------- toasts */
.pp-toasts {
    position: fixed; z-index: 2100; top: 16px; left: 50%; transform: translateX(-50%);
    display: flex; flex-direction: column; gap: 10px; width: min(440px, calc(100vw - 32px)); pointer-events: none;
}
.pp-toast {
    pointer-events: auto; position: relative; overflow: hidden; display: flex; align-items: flex-start; gap: 12px;
    background: var(--pp-bg); color: var(--pp-text); border-radius: 16px; box-shadow: var(--pp-shadow);
    padding: 14px 16px; direction: rtl; cursor: pointer; border-inline-start: 5px solid currentColor;
    opacity: 0; transform: translateY(-14px) scale(.97); transition: opacity .22s, transform .28s cubic-bezier(.2, .9, .3, 1.2);
}
.pp-toast.show { opacity: 1; transform: none; }
.pp-toast.hide { opacity: 0; transform: translateY(-10px) scale(.97); }
.pp-toast .ti { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; position: relative; }
.pp-toast .ti::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: currentColor; opacity: .14; }
.pp-toast .ti svg { width: 18px; height: 18px; position: relative; }
.pp-toast .ti svg path, .pp-toast .ti svg line, .pp-toast .ti svg circle { fill: none; stroke: currentColor; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.pp-toast .ti .dot { fill: currentColor !important; stroke: none !important; }
.pp-toast .tt { flex: 1; color: var(--pp-text); font-weight: 600; line-height: 1.55; padding-top: 3px; word-break: break-word; }
.pp-toast .bar { position: absolute; bottom: 0; right: 0; height: 3px; background: currentColor; opacity: .5; animation: pp-shrink linear forwards; }
.pp-toast.pp-success { color: var(--pp-success); }
.pp-toast.pp-error { color: var(--pp-error); }
.pp-toast.pp-warning { color: var(--pp-warning); }
.pp-toast.pp-info { color: var(--pp-info); }
.pp-toast:hover .bar { animation-play-state: paused; }

@media (max-width: 576px) {
    .pp-overlay { align-items: flex-end; padding: 0; }
    .pp-box { max-width: none; border-radius: 22px 22px 0 0; padding-bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateY(40px); }
    .pp-box.wide { max-width: none; }
    .pp-timer { border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .pp-overlay, .pp-box, .pp-toast { transition: none; }
    .pp-icon::after, .pp-icon .draw { animation: none; stroke-dashoffset: 0; }
}

@keyframes pp-draw { to { stroke-dashoffset: 0; } }
@keyframes pp-ring { 0% { opacity: .5; transform: scale(.85); } 100% { opacity: 0; transform: scale(1.25); } }
@keyframes pp-shrink { from { width: 100%; } to { width: 0; } }
@keyframes pp-shake { 0%, 100% { transform: none; } 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
