/* ============================================================
   Payment page — builds on the tokens defined in style.css
   (--accent teal, --surface, --border, radii, shadows, .btn, .field …)
   ============================================================ */

/* Clean-white local palette — scoped so the dashboard is untouched */
.pay-body {
  --bg: #ffffff;
  --border: #eef0f2;
  --border-strong: #e3e6e9;
  --shadow: 0 1px 2px rgba(16,24,40,.03);
  --shadow-lg: 0 8px 30px rgba(16,24,40,.08);
  background: #ffffff; min-height: 100vh;
}

/* ---------- Top nav ---------- */
.pay-nav {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 32px;
  background: rgba(255,255,255,.82); backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.pay-nav .brand { text-decoration: none; padding: 0; color: var(--text); }
.pay-nav .brand-mark {
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  box-shadow: none;
}

/* the [hidden] attribute must win over display:flex on these rows */
[hidden] { display: none !important; }
.pay-nav-secure {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 600; color: var(--text-muted);
}
.pay-nav-secure svg { width: 15px; height: 15px; color: var(--accent); }

/* ---------- Layout ---------- */
.pay-wrap {
  max-width: 1040px; margin: 0 auto;
  padding: 36px 32px 80px;
  display: grid; grid-template-columns: 1.35fr 1fr; gap: 48px; align-items: start;
}

/* ---------- Left column ---------- */
.pay-back {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; font-weight: 600; color: var(--text-muted);
  text-decoration: none; margin-bottom: 18px;
}
.pay-back:hover { color: var(--text); }
.pay-back svg { width: 15px; height: 15px; }

.pay-title { font-size: 24px; font-weight: 680; letter-spacing: -.02em; }
.pay-lede { font-size: 13.5px; color: var(--text-muted); margin: 4px 0 22px; max-width: 46ch; }

/* Plan toggle */
.plan-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 28px; }
.plan-opt {
  text-align: left; background: var(--surface);
  border: 1.5px solid var(--border-strong); border-radius: var(--radius);
  padding: 14px 15px; transition: border-color .12s, box-shadow .12s, background .12s;
  position: relative;
}
.plan-opt:hover { border-color: var(--accent); }
.plan-opt.active { border-color: var(--accent); background: #ffffff; box-shadow: 0 0 0 3px var(--accent-soft); }
.plan-opt-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.plan-opt-name { font-size: 13.5px; font-weight: 650; }
.plan-save { font-size: 10.5px; font-weight: 700; color: var(--good); background: var(--good-soft); padding: 2px 7px; border-radius: 20px; }
.plan-opt-price { font-size: 14px; color: var(--text-muted); }
.plan-opt-price b { font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -.02em; }
.plan-opt-sub { font-size: 11.5px; color: var(--text-faint); margin-top: 3px; }

/* Section headings within the form */
.pay-sec {
  font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-faint); font-weight: 700; margin: 22px 0 12px;
}
.pay-sec:first-of-type { margin-top: 4px; }

/* form spacing */
#payForm .field, #payForm .field-row2 { margin-bottom: 14px; }
.field-err { font-size: 11.5px; color: #c0392b; min-height: 0; display: none; }
.field.invalid input, .field.invalid select { border-color: #e0a4a4; box-shadow: 0 0 0 3px #fdeaea; }
.field.invalid .field-err { display: block; }

/* Card input with brand marks */
.card-input { position: relative; }
.card-input input { padding-right: 110px; }
.card-brands { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); display: flex; gap: 5px; pointer-events: none; }
.card-brands .cb { width: 30px; height: 20px; border-radius: 4px; opacity: .32; transition: opacity .15s; }
.card-brands.detect-visa .cb-visa,
.card-brands.detect-mc   .cb-mc,
.card-brands.detect-amex .cb-amex { opacity: 1; }
/* when a brand is detected, dim the others further */
.card-brands.detect-visa .cb:not(.cb-visa),
.card-brands.detect-mc   .cb:not(.cb-mc),
.card-brands.detect-amex .cb:not(.cb-amex) { opacity: .16; }

/* Stripe handoff note (replaces raw card fields) */
.stripe-handoff {
  display: flex; gap: 11px; align-items: flex-start;
  background: var(--accent-soft); color: var(--accent-ink);
  border-radius: var(--radius-sm); padding: 13px 14px; margin-bottom: 18px;
  font-size: 12.5px; line-height: 1.5;
}
.stripe-handoff b { display: block; font-size: 13px; margin-bottom: 2px; }
.stripe-handoff-ico {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  background: #fff; color: var(--accent); display: grid; place-items: center;
}
.stripe-handoff-ico svg { width: 16px; height: 16px; }

/* Inline submit error */
.pay-error {
  font-size: 12.5px; color: #c0392b; background: #fdeaea;
  border: 1px solid #f3dada; border-radius: var(--radius-sm);
  padding: 9px 12px; margin-top: 12px;
}

/* Submit */
.pay-submit {
  width: 100%; justify-content: center; padding: 13px;
  font-size: 14px; border-radius: var(--radius-sm); margin-top: 8px;
}
.pay-submit svg { width: 16px; height: 16px; }
.pay-submit[disabled] { opacity: .6; cursor: not-allowed; }
.pay-submit[disabled]:hover { background: var(--accent); }
.pay-submit.loading { color: transparent; position: relative; }
.pay-submit.loading::after {
  content: ""; position: absolute; width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,.45); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite;
}
.pay-fineprint { font-size: 11px; color: var(--text-faint); margin-top: 14px; line-height: 1.5; }

/* ---------- Right column / summary ---------- */
.pay-aside { position: sticky; top: 96px; }
.summary {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.summary-head { padding: 18px 18px 14px; border-bottom: 1px solid var(--border); }
.summary-plan { display: flex; align-items: center; gap: 12px; }
.summary-badge {
  width: 42px; height: 42px; border-radius: 11px; flex-shrink: 0;
  background: var(--accent); color: #fff; display: grid; place-items: center;
  font-size: 12px; font-weight: 800; letter-spacing: .04em; box-shadow: var(--shadow);
}
.summary-name { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.summary-cycle { font-size: 12px; color: var(--text-faint); margin-top: 1px; }

.summary-feats { list-style: none; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--border); }
.summary-feats li { display: flex; gap: 9px; font-size: 12.8px; color: var(--text-muted); }
.summary-feats li svg { width: 15px; height: 15px; color: var(--good); flex-shrink: 0; margin-top: 1px; }

.summary-rows { padding: 14px 18px 4px; }
.summary-row { display: flex; align-items: center; justify-content: space-between; font-size: 13px; margin-bottom: 11px; }
.summary-row.muted { color: var(--text-muted); }
.summary-row.discount { color: var(--good); font-weight: 600; }
.promo-row { display: block; }
.promo-toggle { font-size: 12.5px; font-weight: 600; color: var(--accent); padding: 0; }
.promo-toggle:hover { text-decoration: underline; }
.promo-input { display: flex; gap: 8px; margin-top: 4px; }
.promo-input input {
  flex: 1; font-family: inherit; font-size: 13px; color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 9px; padding: 8px 11px; outline: none;
  text-transform: uppercase; transition: border-color .12s, box-shadow .12s;
}
.promo-input input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.promo-apply { padding: 8px 14px; font-size: 12.5px; }

.summary-total {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-top: 1px solid var(--border);
  font-size: 15px; font-weight: 700; letter-spacing: -.01em;
}
.summary-renew { padding: 0 18px 16px; font-size: 11.5px; color: var(--text-faint); }

.summary-trust {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--accent-soft); color: var(--accent-ink);
  margin: 0 14px 16px; padding: 12px 13px; border-radius: var(--radius-sm);
  font-size: 11.8px; line-height: 1.5;
}
.summary-trust svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; }
.summary-trust b { display: block; font-size: 12.5px; margin-bottom: 2px; }

.aside-disclaimer { font-size: 11px; color: var(--text-faint); margin-top: 14px; line-height: 1.5; padding: 0 2px; }

/* ---------- Success page ---------- */
.success-wrap { max-width: 520px; margin: 0 auto; padding: 60px 24px 80px; }
.success-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 40px 34px; text-align: center;
}
.success-ico {
  width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 18px;
  background: var(--good-soft); color: var(--good); display: grid; place-items: center;
}
.success-ico svg { width: 28px; height: 28px; }
.success-card h1 { font-size: 22px; font-weight: 680; letter-spacing: -.02em; }
.success-card p { font-size: 13.5px; color: var(--text-muted); margin: 10px auto 0; max-width: 42ch; }
.success-ref { font-size: 12px; color: var(--text-faint); margin-top: 14px; }
.success-cta { margin-top: 22px; padding: 12px 22px; }
.success-fine { font-size: 11.5px; color: var(--text-faint); margin-top: 18px; }

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
  .pay-wrap { grid-template-columns: 1fr; gap: 32px; max-width: 560px; }
  .pay-aside { position: static; order: -1; }
}
@media (max-width: 560px) {
  .pay-nav, .pay-wrap { padding-left: 18px; padding-right: 18px; }
  .plan-toggle { grid-template-columns: 1fr; }
  .card-input input { padding-right: 14px; }
  .card-brands { display: none; }
}
