/* نزول بطاقة الدفع من تحت ببطء، ثم حالات الدفع: جارٍ / نجاح (صح أخضر) / فشل */
#modalWrap.is-entering{opacity:0!important}
#modalWrap.is-entering .modal{transform:translateY(calc(100% + 32px))!important;opacity:.75!important;visibility:hidden!important}
#modalWrap.payment-sheet-mode.is-leaving{opacity:0!important;transition:opacity .3s ease!important}
#modalWrap.payment-sheet-mode.is-leaving .modal{transform:translateY(calc(100% + 32px))!important;opacity:.75!important;transition:transform .3s ease-in,opacity .3s ease!important}
#modalWrap.payment-sheet-mode{transition:opacity .3s ease!important}
#modalWrap.payment-sheet-mode .modal{transition:transform .5s cubic-bezier(.2,.9,.3,1),opacity .35s ease,visibility 0s!important}

.payfx{position:fixed;inset:0;z-index:2147483200;display:grid;align-items:end;justify-items:center;font-family:"IBM Plex Sans Arabic","Tajawal",system-ui,sans-serif;direction:rtl}
.payfx-backdrop{position:absolute;inset:0;background:rgba(5,4,10,.62);backdrop-filter:blur(2px)}
.payfx-card{position:relative;width:min(520px,100%);display:grid;justify-items:center;gap:8px;padding:34px 22px calc(34px + env(safe-area-inset-bottom,0px));border:1px solid rgba(191,166,255,.16);border-bottom:0;border-radius:30px 30px 0 0;background:linear-gradient(160deg,#201a30 0%,#15121f 75%);box-shadow:0 -22px 70px #0008;text-align:center;color:#f4f1e8}
.payfx.is-leaving .payfx-backdrop{opacity:0;transition:opacity .3s ease}
.payfx.is-leaving .payfx-card{transform:translateY(calc(100% + 32px));transition:transform .3s ease-in}
.payfx h3{margin:6px 0 0;font-size:20px;font-weight:800;color:#f6e9c0}
.payfx-amount{font-size:34px;font-weight:800;font-variant-numeric:tabular-nums;color:#fff}
.payfx-amount small{font-size:18px;color:#c9b8ff}
.payfx-product{margin:0;font-size:14px;color:#cfc8e3}
.payfx-sub{margin:6px 0 0;font-size:12.5px;color:#9a93b3}
.payfx-sub.is-ok{color:#7ee6a8;font-weight:700}.payfx-sub.is-bad{color:#ff9a92;line-height:1.7}

.payfx-spinner{width:64px;height:64px;border-radius:50%;border:4px solid rgba(194,176,247,.2);border-top-color:#b7a2f5;animation:payfx-spin .9s linear infinite}
@keyframes payfx-spin{to{transform:rotate(360deg)}}

.payfx-ok,.payfx-bad{position:relative;width:84px;height:84px;display:grid;place-items:center}
.payfx-ok svg,.payfx-bad svg{width:84px;height:84px;overflow:visible}
.payfx-ok-ring{fill:rgba(38,201,120,.16);stroke:#2bd67b;stroke-width:3.5;stroke-dasharray:183;stroke-dashoffset:183;animation:payfx-draw .22s ease-out forwards,payfx-pop .2s cubic-bezier(.3,1.6,.5,1) both;transform-origin:center}
.payfx-ok-check{fill:none;stroke:#2bd67b;stroke-width:5.5;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:46;stroke-dashoffset:46;animation:payfx-draw .16s .14s ease-out forwards}
.payfx-ripple{position:absolute;inset:0;border-radius:50%;border:2px solid #2bd67b;opacity:0;animation:payfx-ripple 1.3s .5s ease-out infinite}
.payfx-ripple.is-late{animation-delay:1.05s}
@keyframes payfx-ripple{0%{transform:scale(.8);opacity:.7}100%{transform:scale(1.9);opacity:0}}
@keyframes payfx-draw{to{stroke-dashoffset:0}}
@keyframes payfx-pop{0%{transform:scale(.5)}100%{transform:scale(1)}}
.payfx-bad-ring{fill:rgba(255,92,82,.14);stroke:#ff6b62;stroke-width:3.5;stroke-dasharray:183;stroke-dashoffset:183;animation:payfx-draw .6s ease-out forwards}
.payfx-bad-x{fill:none;stroke:#ff6b62;stroke-width:5.5;stroke-linecap:round;stroke-dasharray:60;stroke-dashoffset:60;animation:payfx-draw .4s .5s ease-out forwards}
.payfx-close{margin-top:14px;min-height:46px;width:100%;border:1px solid rgba(255,255,255,.18);border-radius:14px;background:rgba(255,255,255,.06);color:#f4f1e8;font:inherit;font-size:15px;font-weight:700;cursor:pointer}
.payfx:is(.is-processing, .is-success) .payfx-card {
  width: min(460px, 100%);
  max-height: 92dvh;
  overflow-y: auto;
  justify-items: stretch;
  gap: 16px;
  padding: 12px 22px calc(18px + env(safe-area-inset-bottom, 0px));
  border-color: #4d6a73;
  background: linear-gradient(155deg, #1a2a33, #0f191f 62%);
  color: #f4fafb;
  text-align: start;
}
.payfx.is-processing .payfx-card { animation: payfx-rise .28s cubic-bezier(.22,.72,.2,1); }
@keyframes payfx-rise { from { transform: translateY(100%); } to { transform: translateY(0); } }
.payfx:is(.is-processing, .is-success) .payfx-backdrop { background: #02080dd1; backdrop-filter: blur(7px); }
.payfx-receipt-head { display: grid; justify-items: center; gap: 12px; padding: 8px 0 4px; text-align: center; }
.payfx-receipt-head h3 { margin: 0; color: #f4fafb; font-size: clamp(21px, 5vw, 26px); }
.payfx-receipt-head p { margin: 4px 0 0; color: #b2c3ca; font-size: 13px; }
.payfx-receipt-mark {
  display: grid;
  width: 68px;
  height: 68px;
  place-items: center;
  border: 1px solid #508d79;
  border-radius: 50%;
  background: #23483e;
  color: #a2efd9;
  font-size: 34px;
  transition: background-color .2s, border-color .2s;
}
.payfx.is-processing .payfx-receipt-mark { background: #182b34; border-color: #385862; }
.payfx.is-processing .payfx-receipt-mark span { display: none; }
.payfx.is-processing .payfx-receipt-mark::before {
  content: '';
  width: 23px;
  height: 23px;
  border: 2px solid #4d6a73;
  border-top-color: #a2efd9;
  border-radius: 50%;
  animation: payfx-spin .75s linear infinite;
}
.payfx.is-success .payfx-receipt-mark span { animation: payfx-pop .22s ease-out both; }
.payfx-receipt-details { margin: 0; border: 1px solid #385862; border-radius: 16px; background: #182b34; }
.payfx-receipt-details > div { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: baseline; gap: 12px; padding: 12px 14px; }
.payfx-receipt-details > div + div { border-top: 1px solid #385862; }
.payfx-receipt-details dt { color: #b2c3ca; font-size: 13px; }
.payfx-receipt-details dd { margin: 0; text-align: end; overflow-wrap: anywhere; }
.payfx-receipt-amount { color: #a2efd9; font-weight: 850; font-size: clamp(19px, 6vw, 27px); font-variant-numeric: tabular-nums; }
.payfx-receipt-amount small { font-size: .65em; }
.payfx-receipt-done { min-height: 48px; border: 0; border-radius: 15px; background: #a2efd9; color: #0c2b25; font: inherit; font-weight: 850; cursor: pointer; }
.payfx.is-processing .payfx-receipt-done { visibility: hidden; }
.payfx-receipt-done:focus-visible { outline: 2px solid #a2efd9; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
  .payfx.is-processing .payfx-card,
  .payfx.is-processing .payfx-receipt-mark::before,
  .payfx.is-success .payfx-receipt-mark span { animation: none; }
}
body.payfx-open .floating-home{opacity:0!important;visibility:hidden!important;pointer-events:none!important}
@media(prefers-reduced-motion:reduce){.payfx-ripple{display:none}.payfx-spinner{animation-duration:1.6s}}

#modalWrap.payment-sheet-mode {
  z-index: 2147483100;
  align-items: flex-end;
  justify-content: center;
  padding: 0 !important;
  background: #02080dd1;
  backdrop-filter: blur(7px);
}
:is(#modalWrap.payment-sheet-mode .modal, #wm2-overlay .wm2-sheet, #cs-overlay .cs-sheet) {
  width: min(460px, 100%);
  max-height: 92dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid #4d6a73;
  border-bottom: 0;
  border-radius: 30px 30px 0 0;
  padding: 12px 22px calc(18px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(155deg, #1a2a33, #0f191f 62%);
  box-shadow: 0 -18px 60px #0009;
}
.payment-sheet-mode .payment-summary {
  display: grid;
  gap: 12px;
  max-height: none;
  overflow: visible;
  color: #f4fafb;
}
.payment-sheet-handle {
  width: 36px;
  height: 4px;
  margin: 0 auto;
  border-radius: 5px;
  background: #78888e;
}
.payment-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.payment-sheet-head h2 { margin: 0; font-size: 17px; color: #f4fafb; }
.payment-sheet-close {
  flex: 0 0 44px;
  min-height: 44px;
  border: 1px solid #41545c;
  border-radius: 50%;
  background: #23343e;
  color: #f4fafb;
  font: 24px/1 system-ui, sans-serif;
}
.payment-total { display: grid; justify-items: center; gap: 4px; margin: 6px 0 0; }
.payment-total > span, .payment-product-name { color: #b2c3ca; font-size: 13px; }
.payment-amount {
  font-size: clamp(29px, 8vw, 48px);
  font-weight: 850;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  text-align: center;
}
.payment-amount small { color: #91ebd3; font-size: .48em; }
.payment-product-name { margin: 0 0 4px; text-align: center; text-wrap: balance; }
.payment-wallet {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px;
  border: 1px solid #385862;
  border-radius: 18px;
  background: #182b34;
}
.payment-wallet-card {
  display: flex;
  flex: 0 0 76px;
  height: 48px;
  align-items: center;
  justify-content: space-between;
  padding: 0 9px;
  border: 1px solid #91cdb5;
  border-radius: 9px;
  background: linear-gradient(145deg, #65ac9c, #174150 65%);
  box-shadow: inset 0 1px #f0fffd55, 0 4px 9px #071215;
  color: #f5dba0;
}
.payment-wallet-card i {
  width: 13px;
  height: 11px;
  border: 1px solid #fbebb5;
  border-radius: 3px;
  background: linear-gradient(130deg,#f5e2a9,#8e7243);
}
.payment-wallet-card b { font-size: 20px; }
.payment-account-copy { min-width: 0; display: grid; gap: 3px; }
.payment-account-copy b { font-size: 15px; }
.payment-account-copy small { color: #b0c0c7; font-size: 12px; overflow-wrap: anywhere; }
.payment-balance-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding-inline: 4px;
  color: #b0c0c7;
  font-size: 13px;
}
.payment-balance-row bdi { color: #f4fafb; font-weight: 700; font-variant-numeric: tabular-nums; }
.payment-shortfall {
  padding: 9px 12px;
  border: 1px solid #a85e60;
  border-radius: 12px;
  background: #382327;
  color: #ffd2d0;
  font-size: 13px;
}
.payment-actions { display: grid; gap: 7px; text-align: center; padding-top: 4px; }
:is(#modal, #wm2-overlay, #cs-overlay) .payment-actions .payment-confirm {
  min-height: 52px;
  border: 0 !important;
  border-radius: 15px;
  background: #a2efd9 !important;
  color: #0c2b25;
  box-shadow: none;
  text-shadow: none;
  font: inherit;
  font-weight: 850;
}
:is(#modal, #wm2-overlay, #cs-overlay) .payment-actions .payment-confirm:disabled {
  background: #304048 !important;
  color: #b2bfc4;
  cursor: default;
}
.payment-actions small { color: #b0c0c7; font-size: 11px; }
:is(.payment-sheet-mode, .wm2-overlay, .cs-overlay) button:focus-visible { outline: 2px solid #a2efd9; outline-offset: 3px; }
@media (max-width: 380px) {
  :is(#modalWrap.payment-sheet-mode .modal, #wm2-overlay .wm2-sheet, #cs-overlay .cs-sheet) { padding-inline: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  #modalWrap.payment-sheet-mode,
  #modalWrap.payment-sheet-mode .modal { transition: none !important; }
}
