/* ============================================================================
 * Confirm Dialog — premium, app-native confirmation modal (window.ConfirmDialog)
 * ----------------------------------------------------------------------------
 * Shared, dependency-free component for service.html and food.html — same
 * architectural pattern as css/spin-win.css + js/spin-win.js (a single
 * lazily-built overlay, cached and reused, themed per-call via options
 * rather than hardcoded page-specific CSS variables). Currently used to
 * replace the native confirm() shown by .rv-action-btn.danger ("Delete
 * review?"), but the icon/title/message/variant are fully parameterised so
 * any future destructive or neutral confirmation can reuse it without a
 * redesign.
 *
 * Deliberately self-contained: does NOT read --sv-* (service.html) or
 * --fp-* (food.html) custom properties. Both pages already define the same
 * base palette under different prefixes (#00C896 brand, #0D1B2A navy,
 * #E11D48 danger — the last one lifted straight from each page's existing
 * .rv-action-btn.danger rule), so this file hardcodes that shared palette
 * once instead of depending on whichever host page happens to load it.
 * ========================================================================== */

.cd-overlay {
    position: fixed;
    inset: 0;
    z-index: 2147483000; /* above every offcanvas/sheet (~10000-10050), below
                             SpinWin's reserved 2147483600 — the two never
                             open at the same time in practice, but this
                             keeps the ordering intentional if that changes */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .22s ease, visibility 0s linear .22s;
}

.cd-overlay.cd-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity .22s ease, visibility 0s linear 0s;
}

.cd-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(13, 27, 42, .58);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.cd-card {
    position: relative;
    width: 100%;
    max-width: 360px;
    background: #ffffff;
    border-radius: 24px;
    padding: 30px 26px 24px;
    box-shadow: 0 24px 60px rgba(2, 6, 23, .28), 0 0 0 1px rgba(2, 6, 23, .04);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transform: scale(.92) translateY(10px);
    opacity: 0;
    transition: transform .32s cubic-bezier(0.16, 1, 0.3, 1),
                opacity .28s cubic-bezier(0.16, 1, 0.3, 1);
}

.cd-overlay.cd-open .cd-card {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* ── Icon ── */
.cd-icon-wrap {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
    flex-shrink: 0;
}

.cd-icon-wrap i { font-size: 28px; line-height: 1; }

.cd-icon-danger  { background: rgba(225, 29, 72, .12); }
.cd-icon-danger i { color: #E11D48; }

.cd-icon-default  { background: rgba(0, 200, 150, .12); }
.cd-icon-default i { color: #009E78; }

/* ── Copy ── */
.cd-title {
    margin: 0 0 8px;
    font: 700 1.15rem/1.3 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: #0D1B2A;
    letter-spacing: -.01em;
}

.cd-message {
    margin: 0 0 24px;
    font: 400 .92rem/1.5 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: #64748B;
    max-width: 30ch;
}

/* ── Actions ── */
.cd-actions {
    display: flex;
    gap: 10px;
    width: 100%;
}

.cd-btn {
    flex: 1;
    min-height: 48px; /* WCAG-comfortable touch target */
    border: none;
    border-radius: 14px;
    font: 700 .92rem/1 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.cd-btn-cancel {
    background: #F1F5F9;
    color: #334155;
}
.cd-btn-cancel:hover  { background: #E2E8F0; }
.cd-btn-cancel:active { background: #CBD5E1; transform: scale(.97); }

.cd-btn-danger {
    background: #E11D48;
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(225, 29, 72, .32);
}
.cd-btn-danger:hover  { background: #C81440; }
.cd-btn-danger:active { transform: scale(.97); box-shadow: 0 4px 10px rgba(225, 29, 72, .4); }

.cd-btn-default {
    background: #00C896;
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(0, 200, 150, .32);
}
.cd-btn-default:hover  { background: #009E78; }
.cd-btn-default:active { transform: scale(.97); box-shadow: 0 4px 10px rgba(0, 200, 150, .4); }

.cd-btn:focus-visible {
    outline: 3px solid #0D1B2A;
    outline-offset: 2px;
}

/* ── Small screens: keep the card off the viewport edges, tighten padding ── */
@media (max-width: 360px) {
    .cd-card { padding: 26px 20px 20px; }
    .cd-message { max-width: 26ch; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    .cd-overlay, .cd-card, .cd-btn { transition: none !important; }
}
