*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: hidden; }

/* ==========================================================================
   RivalDigest — Checkout Page
   ========================================================================== */

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

.checkout-body {
  background: #F8FAFF;
  min-height: 100vh;
}

.co-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── Header ── */
.co-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 0 28px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}

.co-secure-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #16A34A;
}

/* ── Page headline ── */
.co-page-headline {
  text-align: center;
  padding: 36px 0 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}

.co-page-headline h1 {
  font-size: clamp(1.3rem, 3vw, 1.75rem);
  font-weight: 800;
  color: var(--text-dark);
  letter-spacing: -0.025em;
  margin-bottom: 8px;
  line-height: 1.2;
}

.co-page-headline p {
  font-size: 0.92rem;
  color: var(--text-muted);
}

/* ── Main layout ── */
.co-main { flex: 1; }

.co-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 40px;
  align-items: start;
}

/* ── Sections ── */
.co-section { margin-bottom: 32px; }

.co-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

.co-section-divider {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  margin-bottom: 16px;
}

.co-section-divider .co-section-title { margin-bottom: 4px; }

/* ── Plan selector ── */
.plan-selector {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.plan-option {
  cursor: pointer;
  display: block;
  position: relative;
}

.plan-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
}

.plan-option-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: all 0.15s;
  position: relative;
}

.plan-option-inner:hover { border-color: #93C5FD; }

.plan-option input:checked + .plan-option-inner {
  border-color: var(--blue);
  background: #F0F7FF;
  box-shadow: 0 0 0 1px var(--blue);
}

.plan-option-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.plan-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-dark);
}

.plan-detail {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.plan-price {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-dark);
  white-space: nowrap;
}

.plan-price span {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text-muted);
}

.plan-pop-tag {
  position: absolute;
  top: -10px;
  right: 12px;
  background: var(--blue);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
}

/* ── Form fields ── */
.co-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.co-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.co-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-body);
}

.co-label-opt {
  font-weight: 400;
  color: var(--text-faint);
}

.co-input {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text-dark);
  outline: none;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.co-input::placeholder { color: var(--text-faint); }
.co-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.08);
}

.co-input.error { border-color: #EF4444; }

/* Card field with icons */
.co-card-field {
  position: relative;
}

.co-card-input { padding-right: 80px; }

.co-card-icons {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 4px;
  align-items: center;
}

/* CVC tooltip */
.co-tooltip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 700;
  cursor: help;
  margin-left: 4px;
  vertical-align: middle;
}

/* Payment note */
.co-payment-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  margin-bottom: 16px;
  line-height: 1.5;
}

.co-payment-note svg { flex-shrink: 0; margin-top: 1px; }
.co-payment-note strong { color: #15803D; }

/* ── Terms block ── */
.co-terms-block {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 20px 0 16px;
}

.co-terms-text {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.co-terms-text strong { color: var(--text-body); }

/* ── Submit ── */
.co-submit {
  font-size: 1rem;
  padding: 15px 28px;
  border-radius: var(--radius);
  margin-top: 4px;
  /* Reset <button> browser defaults */
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.co-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.co-cancel-promise {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 10px;
}

/* ── Trust row ── */
.co-trust-row {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.co-trust-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
  color: var(--text-faint);
  font-weight: 500;
}

/* ── Order summary ── */
.co-summary-card {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: sticky;
  top: 80px;
}

.co-summary-header h3 {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 16px;
}

.co-summary-plan-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}

.co-summary-label {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-dark);
}

.co-summary-price {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-dark);
  white-space: nowrap;
}

.co-summary-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.co-summary-divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* ── Timeline ── */
.co-timeline { }

.co-timeline-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 14px;
}

.co-timeline-items {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.co-tl-item {
  display: flex;
  gap: 12px;
  padding-bottom: 16px;
  position: relative;
}

.co-tl-item::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 18px;
  width: 1px;
  height: calc(100% - 10px);
  background: var(--border);
}

.co-tl-item:last-child::before { display: none; }

.co-tl-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
  margin-top: 3px;
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1.5px var(--border);
}

.co-tl-dot-active {
  background: var(--blue);
  box-shadow: 0 0 0 1.5px var(--blue);
}

.co-tl-dot-charge {
  background: #F59E0B;
  box-shadow: 0 0 0 1.5px #F59E0B;
}

.co-tl-content strong {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 2px;
}

.co-tl-content span {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.co-tl-charge-label {
  font-weight: 400;
  color: #D97706;
}

/* ── Summary total ── */
.co-summary-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 8px;
}

.co-summary-total {
  font-size: 1.1rem;
  color: #16A34A;
}

.co-summary-footnote {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.co-summary-footnote strong { color: var(--text-body); }

/* ── LS note ── */
.co-prefill-note {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.5;
}

.co-ls-note {
  font-size: 0.76rem;
  color: var(--text-faint);
  text-align: center;
  margin-top: 14px;
  line-height: 1.6;
  padding: 0 4px;
}

/* ── Footer ── */
.co-footer {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 20px 0 28px;
  margin-top: 40px;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-faint);
}

.co-footer a { color: var(--text-muted); text-decoration: underline; }
.co-footer a:hover { color: var(--text-dark); }

/* ── Success overlay ── */
.co-success-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.co-success-overlay[hidden] { display: none !important; }

.co-success-card {
  background: var(--bg);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: 0 32px 64px rgba(0,0,0,0.25);
  animation: popIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
  from { transform: scale(0.9); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.co-success-icon { margin-bottom: 20px; }

.co-success-card h2 {
  font-size: 1.5rem;
  color: var(--text-dark);
  margin-bottom: 12px;
  letter-spacing: -0.025em;
}

.co-success-card p {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 24px;
}

.co-success-cta { margin-bottom: 12px; }

.co-success-note {
  font-size: 0.78rem;
  color: var(--text-faint);
  margin: 0 !important;
}

/* ── Responsive ── */
@media (max-width: 820px) {
  .co-layout {
    grid-template-columns: 1fr;
  }

  .co-summary-col {
    order: -1; /* Show summary above form on mobile */
  }

  .co-summary-card {
    position: static;
  }
}

@media (max-width: 480px) {
  .co-field-row {
    grid-template-columns: 1fr;
  }

  .co-success-card {
    padding: 32px 24px;
  }
}
