/* ==========================================================================
   Hamida Academy — payment method choice + payment result page

   1. .ppm  — the "طريقة الدفع" choice rendered by pixel-payment.js inside the
              existing purchase sheets (course, lesson, offer). It borrows the
              app's own --pa-* tokens (with the same values the offer page's
              --px-* set uses as fallbacks), so it inherits light and dark
              from whichever sheet it sits in and defines no palette of its own.
   2. .ppr  — the payment result page.
   ========================================================================== */

.ppm {
  margin: var(--pa-space-4, 16px) 0;
  text-align: start;
}

.ppm__title {
  margin: 0 0 var(--pa-space-3, 12px);
  font-weight: 800;
  font-size: 1rem;
  color: var(--pa-text, var(--px-ink, #0f2a26));
}

.ppm__group {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--pa-space-2, 8px);
}

@media (min-width: 480px) {
  .ppm__group {
    grid-template-columns: 1fr 1fr;
  }
}

/* Each option is a real button: keyboard reachable, no inline handler. */
.ppm__card {
  display: flex;
  align-items: center;
  gap: var(--pa-space-3, 12px);
  width: 100%;
  min-height: 64px;
  padding: var(--pa-space-3, 12px);
  border: 2px solid var(--pa-border, rgba(8, 82, 68, 0.13));
  border-radius: var(--pa-radius, 14px);
  background: var(--pa-surface, var(--px-surface, #ffffff));
  color: var(--pa-text, var(--px-ink, #0f2a26));
  font: inherit;
  text-align: start;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.ppm__card:hover:not(:disabled) {
  border-color: var(--pa-border-strong, rgba(8, 82, 68, 0.26));
  background: var(--pa-surface-2, #f4faf7);
}

.ppm__card:focus-visible {
  outline: 3px solid var(--pa-primary, #0f7c68);
  outline-offset: 2px;
}

.ppm__card:active:not(:disabled) {
  transform: translateY(1px);
}

.ppm__card:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.ppm__card.is-selected {
  border-color: var(--pa-primary, #0f7c68);
  background: var(--pa-primary-050, #e9f7f2);
  box-shadow: var(--pa-shadow-sm, 0 2px 10px rgba(6, 48, 42, 0.08));
}

.ppm__icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: var(--pa-radius-sm, 10px);
  background: var(--pa-surface-3, #e6f1ec);
  color: var(--pa-primary-ink, #0b6754);
  font-size: 1.05rem;
}

.ppm__card--code .ppm__icon {
  background: #fdf3e6;
  color: #b8732a;
}

.ppm__card.is-selected .ppm__icon {
  background: var(--pa-primary, #0f7c68);
  color: #ffffff;
}

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

.ppm__label {
  font-weight: 800;
  line-height: 1.3;
}

.ppm__hint {
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--pa-text-muted, var(--px-ink-3, #5e7f78));
}

.ppm__tick {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  margin-inline-start: auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--pa-primary, #0f7c68);
  color: #ffffff;
  font-size: 0.7rem;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 160ms ease, transform 160ms ease;
}

.ppm__card.is-selected .ppm__tick {
  opacity: 1;
  transform: scale(1);
}

.ppm__msg {
  min-height: 1.2em;
  margin: var(--pa-space-2, 8px) 0 0;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--pa-text-muted, var(--px-ink-3, #5e7f78));
}

.ppm__msg.is-error {
  color: var(--pa-danger, #c81340);
}

.ppm__msg.is-info {
  color: var(--pa-primary-ink, #0b6754);
}

.ppm.is-busy .ppm__group {
  opacity: 0.75;
}

/* Dark theme on the offer page uses the --px-* environment; the fallbacks
   above already resolve to the same dark values through --pa-* when the app
   theme is loaded. The offer page loads neither, so its dark surface is
   provided here from its own tokens. */
html[data-theme="dark"] body.px-body .ppm__card {
  background: var(--px-surface, #0f3029);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.14);
}

html[data-theme="dark"] body.px-body .ppm__card.is-selected {
  background: rgba(26, 155, 130, 0.16);
  border-color: #1a9b82;
}

html[data-theme="dark"] body.px-body .ppm__title,
html[data-theme="dark"] body.px-body .ppm__label {
  color: #ffffff;
}

html[data-theme="dark"] body.px-body .ppm__icon {
  background: #184a40;
  color: #9fe3d1;
}

/* Elements the pages hide until a method is chosen. */
[hidden].ppm-hidden,
.ppm-hidden[hidden] {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .ppm__card,
  .ppm__tick {
    transition: none;
  }
}

/* --------------------------------------------------------------------------
   2. Payment result page
   -------------------------------------------------------------------------- */
.ppr-main {
  min-height: calc(100vh - 64px);
  padding: 24px 16px 96px;
  padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
}

.ppr-card {
  position: relative;
  max-width: 520px;
  margin: 24px auto 0;
  padding: 28px 22px;
  text-align: center;
  color: var(--pa-text, #0f2a26);
  background: var(--pa-surface, #ffffff);
  border: 1px solid var(--pa-border, rgba(8, 82, 68, 0.13));
  border-radius: var(--pa-radius-lg, 18px);
  box-shadow: var(--pa-shadow-md, 0 6px 22px rgba(6, 48, 42, 0.1));
}

.ppr-card__icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  border-radius: 50%;
  font-size: 1.8rem;
  background: var(--pa-surface-3, #e6f1ec);
  color: var(--pa-primary-ink, #0b6754);
}

.ppr-card.is-checking .ppr-card__icon {
  animation: ppr-pulse 1.4s ease-in-out infinite;
}

.ppr-card.is-completed .ppr-card__icon {
  background: #e7f7ed;
  color: #147c3c;
}

.ppr-card.is-pending .ppr-card__icon {
  background: #fdf1e2;
  color: #a85c05;
}

.ppr-card.is-failed .ppr-card__icon {
  background: #fdeaf0;
  color: #c81340;
}

.ppr-card__title {
  margin: 0 0 8px;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.4;
}

.ppr-card__text {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.8;
  color: var(--pa-text-2, #3a5a54);
}

.ppr-card__item {
  margin: 12px 0 0;
  font-weight: 700;
  color: var(--pa-primary-ink, #0b6754);
}

.ppr-card__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 22px;
}

.ppr-card__actions .pa-btn {
  width: 100%;
}

.ppr-card__note {
  margin: 18px 0 0;
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--pa-text-muted, #5e7f78);
}

@keyframes ppr-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.06);
    opacity: 0.75;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ppr-card.is-checking .ppr-card__icon {
    animation: none;
  }
}

@media (min-width: 480px) {
  .ppr-card__actions {
    flex-direction: row;
    justify-content: center;
    flex-wrap: wrap;
  }

  .ppr-card__actions .pa-btn {
    width: auto;
    min-width: 200px;
  }
}
