/* Twara checkout: post-exam plans, number form and payment pop-ups.
   Same look as /ishyura/ (templates/payments/retry.html). Loaded after the
   page's own styles, so selectors are prefixed with body to win. Behaviour
   lives in static/js/checkout.js; payment logic stays in script.js. */

:root {
  --ck-wine: #702852;
  --ck-wine-deep: #4c1838;
  --ck-wine-wash: #fbf3f7;
  --ck-wine-line: #ecd3e0;
  --ck-ink: #0f1320;
  --ck-text: #2a3142;
  --ck-muted: #667085;
  --ck-line: #e6e8ee;
  --ck-green: #067a5f;
  --ck-green-wash: #e7f6f1;
  --ck-amber: #9a5b00;
  --ck-amber-wash: #fff5df;
  --ck-red: #b42318;
  --ck-red-wash: #fdeeec;
  --ck-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px rgba(16, 24, 40, .06);
  --ck-font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

/* ---------- Focus mode: no site footer during the exam and results ---------- */
body.ck-focus footer,
body.ck-focus .bg-images { display: none !important; }

/* ---------- Plan cards after the exam ---------- */
body .post-pricing-cards { display: grid; gap: 12px; max-width: 520px; margin: 0 auto; }
body .post-plan-card {
  position: relative;
  background: #fff !important;
  border: 1.5px solid var(--ck-line) !important;
  border-radius: 18px;
  padding: 18px 18px 16px;
  box-shadow: var(--ck-shadow);
  font-family: var(--ck-font);
  transition: border-color .15s, box-shadow .15s, transform .1s;
}
body .post-plan-card:active { transform: scale(.99); }
body .post-plan-card.post-selected {
  background: #fff !important;
  border: 1.5px solid var(--ck-wine) !important;
  box-shadow: 0 0 0 3px rgba(112, 40, 82, .12), var(--ck-shadow);
}
body .post-plan-badge {
  background: var(--ck-wine);
  border-radius: 99px;
  padding: 4px 10px;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .02em;
}
body .post-plan-benefit { color: var(--ck-muted); font-size: .85rem; font-weight: 700; text-transform: none; }
body .post-plan-name { color: var(--ck-ink); font-size: 1.1rem; font-weight: 800; }
body .post-plan-meta { color: var(--ck-muted); }
body .post-plan-price { color: var(--ck-ink); font-size: 1.6rem; letter-spacing: -.01em; }
body .post-plan-features li { color: var(--ck-text); }
body .post-plan-btn {
  min-height: 52px;
  border-radius: 14px;
  font-family: var(--ck-font);
  font-weight: 800;
}
body .post-plan-btn.post-plan-primary { background: var(--ck-wine); color: #fff; }
body .post-plan-btn.post-plan-outline { background: #fff; color: var(--ck-wine); border: 1.5px solid var(--ck-wine-line); }
body .post-plan-text-btn {
  min-height: 46px;
  border-radius: 12px;
  border: 1.5px solid var(--ck-wine-line);
  font-family: var(--ck-font);
  font-weight: 800;
  padding: 0 18px;
}
body .post-payment-guide {
  max-width: 520px;
  border-radius: 18px;
  background: var(--ck-wine-wash);
  border: 1px solid var(--ck-wine-line);
  font-family: var(--ck-font);
}

/* ---------- Number form ---------- */
body .post-payment-input {
  display: block;
  max-width: 520px;
  margin: 8px auto 0;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--ck-line);
  border-radius: 18px;
  box-shadow: var(--ck-shadow);
  text-align: left;
  font-family: var(--ck-font);
  scroll-margin-top: 80px;
}
body .post-payment-input.hidden { display: none !important; }
body .post-payment-label { margin: 0 0 4px; color: var(--ck-ink); font-weight: 800; font-size: 1rem; text-align: left; }
body .post-selected-amount,
body #post-selected-amount {
  margin: 0 0 12px;
  color: var(--ck-muted);
  font-size: .9rem;
  font-weight: 700;
}
body .post-selected-amount b { color: var(--ck-ink); }
body .post-momo-logo { display: none; }
.ck-field {
  display: flex;
  align-items: center;
  background: #fff;
  border: 1.5px solid var(--ck-line);
  border-radius: 16px;
  transition: border-color .15s, box-shadow .15s;
}
.ck-field:focus-within { border-color: var(--ck-wine); box-shadow: 0 0 0 3px rgba(112, 40, 82, .12); }
.ck-field.ck-invalid { border-color: var(--ck-red); }
.ck-field .ck-ico { padding-left: 14px; color: var(--ck-muted); display: flex; }
.ck-field .ck-ico svg { width: 20px; height: 20px; }
body .ck-field .post-phone-field,
body .ck-field #post-phone-input {
  flex: 1;
  min-width: 0;
  width: auto;
  margin: 0;
  border: 0 !important;
  outline: none;
  box-shadow: none !important;
  background: transparent;
  padding: 16px 12px;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--ck-ink);
  text-align: left;
  height: auto;
  line-height: 1.2;
  border-radius: 0;
}
.ck-net { display: none; margin-right: 12px; padding: 5px 9px; border-radius: 8px; font-size: .75rem; font-weight: 900; }
.ck-net.mtn { display: inline-block; background: #ffcb05; color: #1a1a1a; }
.ck-net.airtel { display: inline-block; background: #e40000; color: #fff; }
.ck-hint { margin: 8px 2px 0; font-size: .85rem; color: var(--ck-muted); }
.ck-hint.tip { color: var(--ck-amber); }
body .post-phone-error { margin: 8px 2px 0; color: var(--ck-red); font-weight: 700; font-size: .88rem; text-align: left; }
body .post-phone-error:empty { display: none; }
body .post-pay-btn,
body #post-pay-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 54px;
  margin-top: 14px;
  border: 0;
  border-radius: 14px;
  background: var(--ck-wine);
  color: #fff;
  font-family: var(--ck-font);
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  height: auto;
}
body .post-pay-btn:hover { background: var(--ck-wine-deep); }
.ck-trust { margin: 12px 0 0; color: var(--ck-muted); font-size: .8rem; text-align: center; }
.ck-nudge { animation: ck-nudge 1.1s ease-out; }
@keyframes ck-nudge { 0% { box-shadow: 0 0 0 0 rgba(112, 40, 82, .4), var(--ck-shadow); } 100% { box-shadow: 0 0 0 14px rgba(112, 40, 82, 0), var(--ck-shadow); } }

/* ---------- Pop-ups as bottom sheets ---------- */
body .payment-modal {
  align-items: center;
  justify-content: flex-end;
  font-family: var(--ck-font);
}
body .payment-modal > .modal-bg { z-index: 1; background: rgba(15, 19, 32, .45); }
body .payment-modal > .modal-content,
body .payment-modal > .payment-fail,
body .payment-modal > .modal-almost,
body .payment-modal > .modal-success,
body .payment-modal > .modal-fail {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 560px;
  box-sizing: border-box;
  margin: 0;
  padding: 26px 22px calc(24px + env(safe-area-inset-bottom));
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -10px 40px rgba(15, 19, 32, .18);
  text-align: center;
  animation: ck-up .22s ease-out;
}
@media (min-width: 640px) {
  body .payment-modal { justify-content: center; }
  body .payment-modal > .modal-content,
  body .payment-modal > .payment-fail,
  body .payment-modal > .modal-almost,
  body .payment-modal > .modal-success,
  body .payment-modal > .modal-fail { border-radius: 24px; }
}
@keyframes ck-up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
body .payment-modal #modal-heading { font-size: 1.35rem; font-weight: 800; color: var(--ck-ink); margin: 10px 0 6px; }
body .payment-modal #modal-header,
body .payment-modal #payAlert { font-size: .98rem; font-weight: 500; color: var(--ck-muted); margin: 6px auto; max-width: 400px; }
body .payment-modal .payment-success { margin: 0; }
body .payment-modal .payment-success svg { width: 56px; height: 56px; }

/* Waiting: checkout.js adds .ck-wait and hides the old spinner text */
body .modal-content.ck-has-wait > :not(.ck-wait):not(.modal-close-btn) { display: none !important; }
.ck-ring { position: relative; width: 112px; height: 112px; margin: 4px auto 0; }
.ck-ring svg.ck-ring-svg { width: 112px; height: 112px; transform: rotate(-90deg); }
.ck-ring circle { fill: none; stroke-width: 8; }
.ck-ring .ck-track { stroke: var(--ck-wine-wash); }
.ck-ring .ck-bar { stroke: var(--ck-wine); stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.ck-ring .ck-phone { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ck-wine); }
.ck-ring .ck-phone svg { width: 40px; height: 40px; animation: ck-buzz 1.6s ease-in-out infinite; }
@keyframes ck-buzz { 0%, 70%, 100% { transform: rotate(0); } 75% { transform: rotate(-9deg); } 80% { transform: rotate(9deg); } 85% { transform: rotate(-6deg); } 90% { transform: rotate(6deg); } }
.ck-count { margin-top: 10px; font-weight: 900; color: var(--ck-wine); font-variant-numeric: tabular-nums; }
.ck-wait h2 { margin: 12px 0 6px; font-size: 1.35rem; color: var(--ck-ink); }
.ck-wait p { margin: 0 auto; max-width: 380px; color: var(--ck-muted); }
.ck-late { display: none; margin-top: 14px; padding: 12px 14px; border-radius: 14px; background: var(--ck-amber-wash); color: var(--ck-amber); font-size: .9rem; text-align: left; }
.ck-late.on { display: block; }
body .modal-content .modal-close-btn { top: 12px; right: 14px; color: var(--ck-muted); font-size: 1.8rem; }

/* Failed */
.ck-reasons { list-style: none; margin: 14px auto 0; padding: 0; max-width: 380px; text-align: left; }
.ck-reasons li { display: flex; gap: 10px; padding: 7px 0; color: var(--ck-text); font-size: .93rem; }
.ck-reasons li::before { content: ""; flex: 0 0 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: var(--ck-red); }
body .payment-fail.ck-has-help > #modal-header { display: none; }
.ck-actions { display: grid; gap: 10px; margin-top: 18px; }
.ck-btn {
  display: flex; align-items: center; justify-content: center;
  min-height: 52px; width: 100%; padding: 0 18px;
  border: 0; border-radius: 14px;
  background: var(--ck-wine); color: #fff;
  font-family: var(--ck-font); font-size: 1rem; font-weight: 800;
  text-decoration: none; cursor: pointer;
}
.ck-btn.ghost { background: #fff; color: var(--ck-wine); border: 1.5px solid var(--ck-wine-line); }
.ck-help { margin: 14px 0 0; font-size: .85rem; color: var(--ck-muted); }
.ck-help a { color: var(--ck-wine); font-weight: 700; }
body .ck-fail-close {
  margin-top: 12px; min-height: 46px; width: 100%; border-radius: 14px;
  border: 1.5px solid var(--ck-line); background: #fff; color: var(--ck-muted);
  font-family: var(--ck-font); font-weight: 800; cursor: pointer;
}
body .payment-fail.ck-has-help .ck-fail-close { border: 0; background: none; min-height: 40px; margin-top: 4px; }

/* Success after paying from the results page */
body .post-success-detail { color: var(--ck-muted); font-size: .95rem; }
body .post-success-code {
  display: block;
  margin: 14px auto 10px;
  max-width: 320px;
  padding: 12px 16px;
  border: 1.5px dashed var(--ck-green);
  border-radius: 14px;
  background: var(--ck-green-wash);
  color: var(--ck-ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: .12em;
}
body #post-payment-success-actions { display: grid; gap: 10px; margin-top: 16px; }
body #post-payment-success-actions.hidden { display: none; }
body .post-copy-code-btn,
body .post-success-start-btn {
  min-height: 52px; width: 100%; border-radius: 14px;
  font-family: var(--ck-font); font-size: 1rem; font-weight: 800; cursor: pointer;
}
body .post-success-start-btn { order: -1; border: 0; background: var(--ck-green); color: #fff; }
body .post-copy-code-btn { border: 1.5px solid var(--ck-line); background: #fff; color: var(--ck-text); }

@media (prefers-reduced-motion: reduce) {
  .ck-ring .ck-phone svg, .ck-nudge,
  body .payment-modal > * { animation: none !important; }
}

/* The floating WhatsApp button covers the bottom sheet text; hide it while a pop-up is open. */
body:has(.payment-modal:not(.hidden)) .twara-whatsapp-float { display: none !important; }
