/* ==========================================================================
   Coupon redemption modal — «فعّل كوبون الشراء»
   --------------------------------------------------------------------------
   🔴 No `hidden` attribute anywhere in here, on purpose. The site already
   shipped a bug where `[hidden]` lost to a later `display:flex` rule and a
   closed giveaway form stayed typeable underneath its own "we're closed"
   message (pitfall 92). Visibility here is one class, `.is-open`, on an
   element whose default is `display:none` — nothing can out-specify a
   missing class.

   Every colour comes from a token declared in base.css. A custom property
   that does not exist is dropped SILENTLY by CSS — which is how a page
   ships naked — so the names below were read off base.css, not
   remembered. (Written without the literal `var(` syntax on purpose: the
   token scanner reads comments too, and a warning about a fake name
   should not become a fake warning.)
   ========================================================================== */

.rd-entry {
  margin: 26px auto 0;
  text-align: center;
}

.rd-entry .rd-open {
  cursor: pointer;
  font: inherit;
}

.rd-entry-hint {
  margin: 10px 0 0;
  font-size: 13.5px;
  color: var(--text-3);
}

/* ── overlay ────────────────────────────────────────────────────────── */
.rd-mask {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(0, 0, 0, .72);
  backdrop-filter: blur(3px);
  padding: 20px;
  overflow-y: auto;
}

.rd-mask.is-open {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── card ───────────────────────────────────────────────────────────── */
.rd-box {
  position: relative;
  width: 100%;
  max-width: 430px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 24px 22px;
  /* The modal must scroll inside itself on a short screen; the page body
     behind it must never gain a second scrollbar. */
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

.rd-x {
  position: absolute;
  inset-inline-start: 14px;
  top: 12px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}

.rd-x:hover { color: var(--text); }

.rd-title {
  margin: 0 0 6px;
  /* 🔴 The close button is absolutely positioned at `inset-inline-start`,
     which is the same side the title starts on — in BOTH directions. So the
     ✕ sat on the first letter: the owner's own screenshot of the buy modal
     reads «أحمل الشراء» because the ✕ covers the «أ». One reserved gutter,
     wider than the button (32px) plus its offset (14px). */
  padding-inline-start: 48px;
  font-family: var(--font-display), var(--font-ar), sans-serif;
  font-size: 21px;
  color: var(--text);
}

.rd-sub {
  margin: 0 0 18px;
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--text-3);
}

/* ── form ───────────────────────────────────────────────────────────── */
.rd-field { margin-bottom: 13px; }

.rd-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 12.5px;
  color: var(--text-2);
}

.rd-field input {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
  background: var(--bg-soft);
  color: var(--text);
  font: inherit;
  font-size: 15px;
}

.rd-field input:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--glow-soft);
}

.rd-field input.is-bad { border-color: var(--red-bright); }

.rd-code-input {
  font-family: ui-monospace, Consolas, monospace;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.rd-submit {
  width: 100%;
  margin-top: 6px;
  cursor: pointer;
  font: inherit;
}


/* ── pay modal: what you are buying, and what is missing ─────────────
   The plan used to be a grey sentence in hint size — «باقة ٣ أشهر — IQD
   18000» — the same weight as the fine print under it. The price is the
   fact the buyer is checking before they type anything, so it reads as a
   row: plan on one side, price on the other. */
.pay-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0 18px;
  padding: 12px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.pay-summary-plan {
  font-size: 14.5px;
  color: var(--text-2);
}

.pay-summary-price {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  direction: ltr;
}

/* Per-field answer to "what is wrong with what I typed". Sits under its own
   input, so the eye never has to hunt for which field is meant. */
.rd-err {
  display: none;
  margin: 6px 0 0;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--red-ink);
}

.rd-err.is-shown { display: block; }

.pay-safe {
  margin: 12px 0 0;
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-3);
  text-align: center;
}

/* ── messages ───────────────────────────────────────────────────────── */
.rd-msg {
  display: none;
  margin: 14px 0 0;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  line-height: 1.7;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--text-2);
}

.rd-msg.is-shown { display: block; }
.rd-msg.is-bad {
  border-color: var(--red-deep);
  color: var(--text);
}

/* ── confirm-before-extend ──────────────────────────────────────────
   Shown when the pasted phone already owns a subscription. Nothing has
   been consumed at this point — saying "no" costs the buyer nothing. */
.rd-confirm { display: none; }
.rd-confirm.is-shown { display: block; }

.rd-confirm-q {
  margin: 16px 0 0;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--red-deep);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.85;
}

.rd-confirm-warn {
  margin: 10px 0 0;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text-3);
}

.rd-confirm-btns {
  display: flex;
  gap: 9px;
  margin-top: 14px;
}

.rd-confirm-btns .btn {
  flex: 1 1 0;
  cursor: pointer;
  font: inherit;
  text-align: center;
}

/* ── success ────────────────────────────────────────────────────────── */
.rd-done { display: none; }
.rd-done.is-shown { display: block; }
.rd-form.is-hidden { display: none; }

.rd-key-label {
  margin: 0 0 7px;
  font-size: 12.5px;
  color: var(--text-2);
}

.rd-key-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin-bottom: 16px;
}

.rd-key {
  flex: 1 1 auto;
  min-width: 0;
  padding: 12px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--red-deep);
  background: var(--bg-soft);
  color: var(--text);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 15px;
  letter-spacing: .6px;
  direction: ltr;
  text-align: center;
  /* A key too narrow to read is a support message; let it scroll. */
  overflow-x: auto;
  white-space: nowrap;
}

.rd-copy {
  flex: 0 0 auto;
  padding: 0 15px;
  cursor: pointer;
  font: inherit;
}

.rd-steps {
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
  font-size: 13.5px;
  line-height: 1.9;
  color: var(--text-2);
}

.rd-steps li {
  padding-inline-start: 24px;
  position: relative;
}

.rd-steps li::before {
  content: "‹";
  position: absolute;
  inset-inline-start: 6px;
  color: var(--red);
  transform: scaleX(-1);
}

.rd-dl { width: 100%; text-align: center; }

.rd-note {
  margin: 14px 0 0;
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--text-3);
}

.rd-receipt {
  margin: 14px 0 0;
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--text-3);
}

.rd-receipt-row {
  display: flex;
  gap: 7px;
  margin-top: 7px;
}

.rd-receipt-url {
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
  background: var(--bg-soft);
  color: var(--text-2);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11.5px;
}

.rd-receipt-copy {
  flex: 0 0 auto;
  padding: 0 12px;
  font-size: 12.5px;
  cursor: pointer;
}

/* ── live hint under the coupon field ───────────────────────────────
   Tells the person typing how far they are, and turns positive the
   moment the code is whole. A count is kinder than a red error after
   the fact. */
.rd-hint {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  min-height: 17px;
}

.rd-hint.is-ready { color: var(--red-bright); }

.rd-field-code input { font-size: 16.5px; padding: 13px; }

/* name + phone share a row on anything but a narrow phone */
.rd-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 11px;
}

/* ── the spinner ────────────────────────────────────────────────────
   Lives inside the button and takes no layout space until it spins, so
   the label never jumps. */
.rd-submit, .rd-yes {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.rd-spin {
  /* `display`, not a width transition. A 0 → 15px width transition looked
     smoother and never completed — measured stuck at its start value in a
     real browser — while `display` cannot get stuck by definition. A
     loading state that never appears is worse than one that appears
     abruptly. */
  display: none;
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-inline-start-color: transparent;
  border-radius: 50%;
  opacity: .85;
  flex: 0 0 auto;
}

.is-busy > .rd-spin {
  display: block;
  animation: rd-spin .62s linear infinite;
}

@keyframes rd-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .is-busy > .rd-spin { animation-duration: 1.6s; }
}

/* A disabled button must look unavailable, not broken.
   🔴 2026-09-16 — `.pay-submit` was missing from this list, and the busy
   rule below names it. So the buy button sat at full red while disabled:
   the owner typed a 7-digit number, pressed it, and got no movement and no
   message. The rule that made it look alive was the one that forgot it. */
.rd-submit[disabled], .rd-yes[disabled], .pay-submit[disabled] { opacity: .45; cursor: default; }
/* `.pay-submit` shares this: the payment modal reuses the redeem
   modal's styling wholesale rather than duplicating a stylesheet that
   would then drift from it. */
.rd-submit.is-busy[disabled], .rd-yes.is-busy[disabled],
.pay-submit.is-busy[disabled] { opacity: .8; }

/* ── success header ─────────────────────────────────────────────────── */
.rd-done-head {
  margin: 0 0 16px;
  font-family: var(--font-display), var(--font-ar), sans-serif;
  font-size: 16px;
  color: var(--text);
}

@media (max-width: 420px) {
  .rd-two { grid-template-columns: 1fr; }
}

.rd-alt {
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--text-3);
  text-align: center;
}

.rd-alt a { color: var(--red-bright); }

@media (max-width: 480px) {
  .rd-box { padding: 22px 17px 18px; }
  .rd-key-row { flex-direction: column; }
  .rd-copy { padding: 11px 15px; }
}

@media (prefers-reduced-motion: no-preference) {
  .rd-mask.is-open .rd-box { animation: rd-in .22s var(--ease, ease) both; }
  @keyframes rd-in {
    from { opacity: 0; transform: translateY(10px) scale(.985); }
    to   { opacity: 1; transform: none; }
  }
}
