/* ==========================================================================
   The store's confirmation (js/components/confirmation.js, ConfirmationPlugin.confirm / createBox), drawn flat
   --------------------------------------------------------------------------
   The plugin's own look (upi-confirmation.css, and theme-cart.css on the cart page) was a grey "بلی" slab beside an
   outlined "لغو" under a lone line of text, and outside the cart page it had no look at all. Here, on every page:
   a phone gets a bottom sheet - a grip, the question, then two equal buttons, the action in the store's colour and
   the way back in a soft grey - and a wide screen the same card centred. A quiet fade and rise, no shadow play.

   The markup is the plugin's (.upi-confirm > .upi-content > .upi-icon, .upi-description, .upi-footer with
   .upi-btn-decline and .upi-btn-confirm, both .km-btn): only drawn here, nothing in it is changed. `html body`
   puts these rules over the old sheets wherever those load.
   ========================================================================== */

html body .upi-confirm {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    padding: 16px;
    overflow: hidden;
    background: rgba(12, 12, 12, .42);
    cursor: default;
    animation: tc-confirm-fade .18s ease-out both;
    -webkit-tap-highlight-color: transparent;
}

html body .upi-confirm > .upi-content {
    position: relative;
    inset: auto;
    box-sizing: border-box;
    width: 400px;
    max-width: 100%;
    margin: 0;
    padding: 28px 24px 24px;
    border-radius: 20px;
    background: #FFFFFF;
    box-shadow: none;
    color: #0C0C0C;
    font-family: yekanbakh, tahoma, sans-serif;
    text-align: center;
    animation: tc-confirm-rise .22s cubic-bezier(.2, .8, .2, 1) both;
}

/* the plugin's Font Awesome glyph (an exclamation, a tick): a flat mark of the store's colour in its place */
html body .upi-confirm > .upi-content > .upi-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: rgba(var(--ryan-primary-rgb, 239, 64, 86), .1);
}

html body .upi-confirm > .upi-content > .upi-icon > i {
    display: none;
}

html body .upi-confirm > .upi-content > .upi-icon::before {
    content: "";
    width: 26px;
    height: 26px;
    background: rgb(var(--ryan-primary-rgb, 239, 64, 86));
    -webkit-mask: var(--tc-confirm-mark) center / contain no-repeat;
    mask: var(--tc-confirm-mark) center / contain no-repeat;
}

/* a question (confirm): a mark of attention; anything else the plugin tells: a tick */
html body .upi-confirm.upi-alert {
    --tc-confirm-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9.25'/%3E%3Cpath d='M12 7.5v5.5M12 16.5h.01'/%3E%3C/svg%3E");
}

html body .upi-confirm:not(.upi-alert) {
    --tc-confirm-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9.25'/%3E%3Cpath d='M8 12.3l2.7 2.7L16 9.7'/%3E%3C/svg%3E");
}

html body .upi-confirm > .upi-content > .upi-description {
    margin: 0 0 24px;
    color: #0C0C0C;
    font-size: var(--tc-fs-h4, 15px);
    font-weight: var(--tc-fw-strong, 600);
    line-height: 1.75;
}

html body .upi-confirm > .upi-content > .upi-footer {
    position: static;
    display: flex;
    gap: 12px;
}

html body .upi-confirm > .upi-content > .upi-footer .km-btn {
    flex: 1 1 0;
    float: none;
    width: auto;
    min-width: 0;
    height: 48px;
    margin: 0;
    padding: 0 16px;
    border: 0;
    border-radius: 12px;
    box-shadow: none;
    font-family: yekanbakh, tahoma, sans-serif;
    font-size: var(--tc-fs-h4, 15px);
    font-weight: var(--tc-fw-strong, 600);
    line-height: 48px;
    text-align: center;
    cursor: pointer;
    transition: background-color .15s ease, transform .1s ease;
}

html body .upi-confirm > .upi-content > .upi-footer .km-btn:active {
    transform: scale(.98);
}

html body .upi-confirm > .upi-content > .upi-footer .km-btn:focus-visible {
    outline: 2px solid rgb(var(--ryan-primary-rgb, 239, 64, 86));
    outline-offset: 2px;
}

/* the action first (on the right), in the store's colour */
html body .upi-confirm > .upi-content > .upi-footer .km-btn.upi-btn-confirm {
    order: -1;
    border-left: 0;
    background: rgb(var(--ryan-primary-rgb, 239, 64, 86));
    color: #FFFFFF;
}

html body .upi-confirm > .upi-content > .upi-footer .km-btn.upi-btn-confirm:hover {
    background: rgba(var(--ryan-primary-rgb, 239, 64, 86), .9);
    color: #FFFFFF;
}

html body .upi-confirm > .upi-content > .upi-footer .km-btn.upi-btn-decline {
    background: #F2F3F5;
    color: #3F4064;
}

html body .upi-confirm > .upi-content > .upi-footer .km-btn.upi-btn-decline:hover {
    background: #E8E9EC;
    color: #0C0C0C;
}

/* a phone: the same card as a bottom sheet, with a grip, over the bottom bar and the phone's own home bar */
@media only screen and (max-width: 959px) {
    html body .upi-confirm {
        display: flex;
        align-items: flex-end;
        padding: 0;
    }

    html body .upi-confirm > .upi-content {
        position: relative;
        width: 100%;
        padding: 28px 16px calc(16px + env(safe-area-inset-bottom, 0px));
        border-radius: 20px 20px 0 0;
        animation-name: tc-confirm-sheet;
        animation-duration: .26s;
    }

    html body .upi-confirm > .upi-content::before {
        content: "";
        position: absolute;
        top: 8px;
        left: 50%;
        width: 36px;
        height: 4px;
        margin-left: -18px;
        border-radius: 2px;
        background: #E0E0E2;
    }

    html body .upi-confirm > .upi-content > .upi-icon {
        display: flex;
        width: 48px;
        height: 48px;
        margin-bottom: 12px;
    }

    html body .upi-confirm > .upi-content > .upi-icon::before {
        width: 24px;
        height: 24px;
    }

    html body .upi-confirm > .upi-content > .upi-description {
        margin-bottom: 20px;
    }
}

@keyframes tc-confirm-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes tc-confirm-rise {
    from { opacity: 0; transform: translateY(8px) scale(.98); }
    to { opacity: 1; transform: none; }
}

@keyframes tc-confirm-sheet {
    from { transform: translateY(100%); }
    to { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    html body .upi-confirm,
    html body .upi-confirm > .upi-content {
        animation: none;
    }
}
