/**
 * PDP instalments block — EgyGamer brand, played up.
 *
 * Brand tokens come from the storefront theme: blue #034ea2, deep navy
 * #053879 and the yellow #ffcd00 already used on the Pre-Order / Shop-Now
 * buttons; Cairo is the brand typeface (loaded for this block via layout).
 *
 * One bold idea, everything else quiet: arcade hardware. The teaser is a
 * chunky button with a hard offset shadow that physically presses down, the
 * coin shows how many payments you're making, and a row of pips shows one pip
 * per payment — so the playfulness also carries real information.
 *
 * The storefront is light-only, so this block is deliberately single-theme.
 * It uses logical properties throughout; the Arabic storefront flips through
 * `body { direction: rtl }` in the egygamer_rtl theme, not a [dir] attribute.
 */

.egygamer-bnpl,
.egygamer-bnpl-overlay {
    --bnpl-blue: #034ea2;
    --bnpl-navy: #053879;
    --bnpl-yellow: #ffcd00;
    --bnpl-sky: #f0f6fd;
    --bnpl-sky-2: #d6e5f8;
    --bnpl-ink: #0f2547;
    --bnpl-muted: #51648a;
    --bnpl-line: #c9d9ef;
    --bnpl-warm: #a35a00;

    font-family: 'Cairo', 'Segoe UI', Tahoma, Arial, sans-serif;
    font-variant-numeric: tabular-nums;
    color: var(--bnpl-ink);
    -webkit-font-smoothing: antialiased;
}

/* Arabic joins letters: tracking or forced uppercase would break the script. */
:lang(ar) .egygamer-bnpl *,
:lang(ar) .egygamer-bnpl-overlay * {
    letter-spacing: 0 !important;
    text-transform: none !important;
}

/* ============================== TEASER ============================== */

.egygamer-bnpl {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 22px 0 24px;
    padding: 14px 16px;
    background: var(--bnpl-sky);
    border: 2px solid var(--bnpl-navy);
    border-radius: 16px;
    box-shadow: 0 4px 0 var(--bnpl-navy);
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease;
    -webkit-tap-highlight-color: transparent;
}

.egygamer-bnpl:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 0 var(--bnpl-navy);
}

/* The press: it drops onto its own shadow. */
.egygamer-bnpl:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 var(--bnpl-navy);
}

.egygamer-bnpl:focus-visible {
    outline: 3px solid var(--bnpl-blue);
    outline-offset: 4px;
}

.egygamer-bnpl .bnpl-sticker {
    position: absolute;
    inset-block-start: -14px;
    inset-inline-end: 16px;
    padding: 4px 11px;
    background: #fff;
    border: 2px solid var(--bnpl-navy);
    border-radius: 999px;
    color: var(--bnpl-navy);
    font-size: 11.5px;
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: .02em;
    transform: rotate(2deg);
}

.egygamer-bnpl .bnpl-main {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* The coin: how many payments the advertised plan has. */
.egygamer-bnpl .bnpl-coin {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    background: var(--bnpl-yellow);
    border: 2px solid var(--bnpl-navy);
    border-radius: 50%;
    box-shadow: inset 0 -5px 0 rgba(5, 56, 121, .16);
    color: var(--bnpl-navy);
    transform: rotate(-6deg);
    animation: bnpl-coin-pop .6s cubic-bezier(.2, .9, .3, 1.25) both;
}

.egygamer-bnpl .bnpl-coin b {
    font-size: 24px;
    font-weight: 900;
    line-height: 1;
}

.egygamer-bnpl .bnpl-coin i {
    margin-block-start: 1px;
    font-size: 10px;
    font-style: normal;
    font-weight: 800;
    letter-spacing: .08em;
    line-height: 1;
    text-transform: uppercase;
}

.egygamer-bnpl .bnpl-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 2px;
}

.egygamer-bnpl .bnpl-headline {
    color: var(--bnpl-navy);
    font-size: 19px;
    font-weight: 900;
    line-height: 1.2;
}

.egygamer-bnpl .bnpl-subtext {
    color: var(--bnpl-muted);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
}

/* Pips: one per payment. Shared by the teaser and every plan in the sheet. */
.egygamer-bnpl .pips,
.egygamer-bnpl-overlay .pips {
    display: flex;
    gap: 2px;
    width: 100%;
    height: 10px;
}

.egygamer-bnpl .pips i,
.egygamer-bnpl-overlay .pips i {
    flex: 1 1 0;
    min-width: 3px;
    background: var(--bnpl-blue);
    border-radius: 3px;
    transform-origin: 50% 100%;
    animation: bnpl-pip-in .4s cubic-bezier(.2, .9, .3, 1.3) both;
    animation-delay: calc(var(--i) / var(--n) * 420ms);
}

.egygamer-bnpl .bnpl-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.egygamer-bnpl .bnpl-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.egygamer-bnpl .bnpl-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding-block: 3px;
    padding-inline: 8px 11px;
    background: #fff;
    border: 1.5px solid var(--bnpl-line);
    border-radius: 999px;
    color: var(--bnpl-navy);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
}

.egygamer-bnpl .bnpl-chip .dot {
    flex: 0 0 auto;
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.egygamer-bnpl .bnpl-chip-more {
    color: var(--bnpl-muted);
    font-size: 12px;
    font-weight: 700;
}

.egygamer-bnpl .bnpl-cta {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-inline-start: auto;
    padding: 6px 14px;
    background: var(--bnpl-yellow);
    border: 2px solid var(--bnpl-navy);
    border-radius: 999px;
    box-shadow: 0 2px 0 var(--bnpl-navy);
    color: var(--bnpl-navy);
    font-size: 13.5px;
    font-weight: 900;
    line-height: 1.3;
    white-space: nowrap;
}

.egygamer-bnpl .bnpl-cta .chevron-glyph {
    display: inline-block;
    flex: 0 0 auto;
}

/* ============================== SHEET =============================== */

.egygamer-bnpl-overlay {
    position: fixed;
    inset: 0;
    z-index: 900;
    display: none;
    align-items: flex-end;
    justify-content: center;
    background: rgba(5, 56, 121, .58);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
}

.egygamer-bnpl-overlay.open {
    display: flex;
    animation: bnpl-fade .22s ease both;
}

body.egygamer-bnpl-open {
    overflow: hidden;
}

.egygamer-bnpl-modal {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    background: #fff;
    border-radius: 26px 26px 0 0;
    overflow: hidden;
    animation: bnpl-sheet-up .42s cubic-bezier(.2, .9, .3, 1.1) both;
}

/* The yellow lip along the top edge. */
.egygamer-bnpl-modal::before {
    content: "";
    flex: 0 0 auto;
    height: 8px;
    background: var(--bnpl-yellow);
}

.egygamer-bnpl-modal .modal-handle {
    flex: 0 0 auto;
    width: 44px;
    height: 5px;
    margin: 10px auto 0;
    background: var(--bnpl-line);
    border-radius: 3px;
}

.egygamer-bnpl-modal .modal-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 20px 0;
}

.egygamer-bnpl-modal .modal-title {
    margin: 0;
    padding: 0;
    color: var(--bnpl-navy);
    font-family: inherit;
    font-size: 24px;
    font-weight: 900;
    line-height: 1.2;
}

.egygamer-bnpl-modal .modal-close {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    margin: 0;
    padding: 0;
    background: var(--bnpl-sky);
    border: 2px solid var(--bnpl-navy);
    border-radius: 50%;
    box-shadow: 0 2px 0 var(--bnpl-navy);
    color: var(--bnpl-navy);
    cursor: pointer;
    line-height: 1;
    transition: background-color .12s ease, transform .12s ease, box-shadow .12s ease;
}

.egygamer-bnpl-modal .modal-close:hover {
    background: var(--bnpl-yellow);
}

.egygamer-bnpl-modal .modal-close:active {
    transform: translateY(2px);
    box-shadow: none;
}

.egygamer-bnpl-modal .modal-close:focus-visible {
    outline: 3px solid var(--bnpl-blue);
    outline-offset: 2px;
}

.egygamer-bnpl-modal .modal-body {
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 6px 20px calc(26px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    overscroll-behavior: contain;
}

.egygamer-bnpl-modal .modal-sub {
    margin: 0;
    color: var(--bnpl-muted);
    font-size: 14px;
    font-weight: 600;
}

.egygamer-bnpl-modal .bnpl-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.egygamer-bnpl-modal .bnpl-section-title {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0;
    padding: 0;
    color: var(--bnpl-navy);
    font-family: inherit;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .09em;
    line-height: 1.2;
    text-transform: uppercase;
}

.egygamer-bnpl-modal .bnpl-section-title svg {
    flex: 0 0 auto;
    box-sizing: content-box;
    width: 14px;
    height: 14px;
    padding: 5px;
    background: var(--bnpl-navy);
    border-radius: 50%;
    color: #fff;
}

.egygamer-bnpl-modal .bnpl-section-title::after {
    content: "";
    flex: 1 1 auto;
    height: 2px;
    background: var(--bnpl-line);
    border-radius: 2px;
}

/* ===================== STEP 1 / 2: METHOD + PROVIDER ================ */

.egygamer-bnpl-modal .bnpl-step {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.egygamer-bnpl-modal .step-title {
    margin: 0;
    padding: 0;
    color: var(--bnpl-navy);
    font-family: inherit;
    font-size: 17px;
    font-weight: 900;
    line-height: 1.3;
}

.egygamer-bnpl-modal .step-hint {
    margin: 0 0 8px;
    color: var(--bnpl-muted);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
}

/* Tiles share one press language with the teaser: a hard shadow that drops. */
.egygamer-bnpl-modal .type-tile,
.egygamer-bnpl-modal .provider-tile {
    margin: 0;
    background: #fff;
    border: 2px solid var(--bnpl-line);
    border-radius: 16px;
    color: var(--bnpl-navy);
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0;
    text-transform: none;
    transition: background-color .12s ease, border-color .12s ease, box-shadow .12s ease, transform .12s ease;
    -webkit-tap-highlight-color: transparent;
}

.egygamer-bnpl-modal .type-tile:hover,
.egygamer-bnpl-modal .provider-tile:hover {
    border-color: var(--bnpl-blue);
}

.egygamer-bnpl-modal .type-tile.is-active,
.egygamer-bnpl-modal .provider-tile.is-active {
    background: var(--bnpl-sky);
    border-color: var(--bnpl-navy);
    box-shadow: 0 3px 0 var(--bnpl-navy);
}

.egygamer-bnpl-modal .type-tile:active,
.egygamer-bnpl-modal .provider-tile:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 var(--bnpl-navy);
}

.egygamer-bnpl-modal .type-tile:focus-visible,
.egygamer-bnpl-modal .provider-tile:focus-visible {
    outline: 3px solid var(--bnpl-blue);
    outline-offset: 3px;
}

.egygamer-bnpl-modal .type-tiles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.egygamer-bnpl-modal .type-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 98px;
    padding: 14px 10px;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.25;
    text-align: center;
}

.egygamer-bnpl-modal .type-tile svg {
    flex: 0 0 auto;
}

.egygamer-bnpl-modal .type-tile.is-active svg {
    color: var(--bnpl-blue);
}

/* Providers scroll sideways, like the bank row it is modelled on. */
.egygamer-bnpl-modal .provider-tiles {
    display: flex;
    gap: 10px;
    margin-inline: -20px;
    padding: 3px 20px 8px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scroll-padding-inline: 20px;
    scrollbar-width: none;
}

.egygamer-bnpl-modal .provider-tiles::-webkit-scrollbar {
    display: none;
}

.egygamer-bnpl-modal .provider-tile {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 116px;
    padding: 12px 12px 11px;
    scroll-snap-align: start;
}

/* Keycap: flat colour with a darker lower edge. */
.egygamer-bnpl-modal .provider-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 46px;
    height: 46px;
    padding: 0 3px;
    border-radius: 13px;
    box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .16);
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
    text-align: center;
    overflow: hidden;
}

/* An uploaded logo replaces the badge: same height, as wide as it needs. */
.egygamer-bnpl-modal .provider-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 46px;
    max-width: 92px;
    height: 46px;
    padding: 6px 9px;
    background: #fff;
    border: 2px solid var(--bnpl-line);
    border-radius: 13px;
    overflow: hidden;
}

.egygamer-bnpl-modal .provider-logo img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.egygamer-bnpl-modal .provider-name {
    color: var(--bnpl-navy);
    font-size: 14px;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
}

.egygamer-bnpl-modal .provider-from {
    color: var(--bnpl-muted);
    font-size: 11.5px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

/* =========================== STEP 3: PLANS ========================== */

.egygamer-bnpl-modal .type-panel,
.egygamer-bnpl-modal .provider-panel {
    display: none;
}

.egygamer-bnpl-modal .type-panel.is-active {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.egygamer-bnpl-modal .provider-panel.is-active {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.egygamer-bnpl-modal .provider-single {
    display: flex;
    align-items: center;
    gap: 12px;
}

.egygamer-bnpl-modal .provider-single .provider-name {
    font-size: 18px;
    text-align: start;
}

.egygamer-bnpl-modal .plan-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.egygamer-bnpl-modal .plan-row {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, auto) minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    margin: 0;
    padding: 14px 16px;
    background: #fff;
    border: 2px solid var(--bnpl-line);
    border-radius: 16px;
}

/* The lowest monthly across everything on offer earns the raised look. */
.egygamer-bnpl-modal .plan-row.is-best {
    margin-block-start: 8px;
    border-color: var(--bnpl-navy);
    box-shadow: 0 4px 0 var(--bnpl-navy);
}

.egygamer-bnpl-modal .plan-flag {
    position: absolute;
    inset-block-start: -13px;
    inset-inline-start: 14px;
    padding: 3px 11px;
    background: var(--bnpl-yellow);
    border: 2px solid var(--bnpl-navy);
    border-radius: 999px;
    color: var(--bnpl-navy);
    font-size: 11.5px;
    font-weight: 900;
    line-height: 1.25;
    transform: rotate(-2deg);
}

.egygamer-bnpl-modal .plan-term {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

/* The same coin as the teaser: how many payments. */
.egygamer-bnpl-modal .plan-coin {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--bnpl-yellow);
    border: 2px solid var(--bnpl-navy);
    border-radius: 50%;
    box-shadow: inset 0 -4px 0 rgba(5, 56, 121, .16);
    color: var(--bnpl-navy);
    transform: rotate(-6deg);
}

.egygamer-bnpl-modal .plan-coin b {
    font-size: 17px;
    font-weight: 900;
    line-height: 1;
}

.egygamer-bnpl-modal .plan-unit {
    color: var(--bnpl-navy);
    font-size: 14px;
    font-weight: 800;
    line-height: 1.2;
}

.egygamer-bnpl-modal .plan-terms {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.egygamer-bnpl-modal .plan-fee {
    color: var(--bnpl-muted);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
}

.egygamer-bnpl-modal .plan-rate {
    color: var(--bnpl-warm);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
}

.egygamer-bnpl-modal .plan-rate.is-free {
    color: var(--bnpl-muted);
}

.egygamer-bnpl-modal .plan-pay {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
    text-align: end;
}

.egygamer-bnpl-modal .plan-pay .num {
    color: var(--bnpl-navy);
    font-size: 19px;
    font-weight: 900;
    line-height: 1.15;
    white-space: nowrap;
}

.egygamer-bnpl-modal .plan-pay .per {
    color: var(--bnpl-muted);
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
}

.egygamer-bnpl-modal .modal-footnote {
    margin: 0;
    color: var(--bnpl-muted);
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.6;
}

/* ============================ MOTION ================================ */

@keyframes bnpl-coin-pop {
    0% {
        opacity: 0;
        transform: scale(.45) rotate(-28deg);
    }
    60% {
        opacity: 1;
        transform: scale(1.12) rotate(4deg);
    }
    100% {
        transform: scale(1) rotate(-6deg);
    }
}

@keyframes bnpl-pip-in {
    from {
        opacity: .2;
        transform: scaleY(.15);
    }
    to {
        opacity: 1;
        transform: scaleY(1);
    }
}

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

@keyframes bnpl-sheet-up {
    from {
        opacity: 0;
        transform: translateY(70px);
    }
    70% {
        opacity: 1;
        transform: translateY(-7px);
    }
    to {
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .egygamer-bnpl,
    .egygamer-bnpl *,
    .egygamer-bnpl-overlay,
    .egygamer-bnpl-overlay * {
        animation: none !important;
        transition: none !important;
    }

    .egygamer-bnpl:hover,
    .egygamer-bnpl:active {
        transform: none;
    }
}

/* ============================ SMALL SCREENS ========================= */

@media (max-width: 480px) {
    .egygamer-bnpl {
        padding: 13px 14px;
    }

    .egygamer-bnpl .bnpl-coin {
        width: 50px;
        height: 50px;
    }

    .egygamer-bnpl .bnpl-coin b {
        font-size: 21px;
    }

    .egygamer-bnpl .bnpl-headline {
        font-size: 17px;
    }

    .egygamer-bnpl .bnpl-foot {
        flex-direction: column;
        align-items: stretch;
    }

    .egygamer-bnpl .bnpl-cta {
        justify-content: center;
        margin-inline-start: 0;
    }

    .egygamer-bnpl-modal {
        max-height: 92vh;
    }

    .egygamer-bnpl-modal .modal-head {
        padding-inline: 16px;
    }

    .egygamer-bnpl-modal .modal-body {
        padding-inline: 16px;
    }

    .egygamer-bnpl-modal .provider-tiles {
        margin-inline: -16px;
        padding-inline: 16px;
        scroll-padding-inline: 16px;
    }

    .egygamer-bnpl-modal .plan-row {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px 12px;
        padding: 13px 14px;
    }

    /* The rate and fee drop under the term so the amount keeps its room. */
    .egygamer-bnpl-modal .plan-terms {
        grid-column: 1;
        grid-row: 2;
    }

    .egygamer-bnpl-modal .plan-pay {
        grid-column: 2;
        grid-row: 1 / span 2;
    }
}
