/* ═══════════════════════════════════════════════════════════════════
   Velo — Checkout
   Design: split layout (summary rail left / form right), editorial warm
   ═══════════════════════════════════════════════════════════════════ */

/* ─── Page shell ─────────────────────────────────────────────────── */
.checkout-page {
  min-height: 100vh;
  background: var(--beige);
}

/* ─── Slim nav ───────────────────────────────────────────────────── */
.checkout-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(245, 239, 230, 0.92);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.checkout-nav-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.checkout-nav .logo {
  font-size: 1.5rem;
  margin-right: auto;
}

.checkout-nav-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.checkout-nav-step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sage);
  flex-shrink: 0;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.checkout-nav-back {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: var(--r-sm);
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
  text-decoration: none;
}
.checkout-nav-back:hover { color: var(--sage); background: rgba(74,124,111,0.07); }
.checkout-nav-back:focus-visible { outline: 2px solid var(--sage); outline-offset: 2px; }

/* ─── Layout ─────────────────────────────────────────────────────── */
.checkout-main {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 40px 20px 80px;
  /* Evita overflow horizontal causado pelo ::before/-::after decorativos do
     .checkout-summary (right:-40px / bottom:-60px) que escapam do overflow:hidden
     do próprio elemento em alguns browsers — clip (não hidden) mantém position:sticky
     funcional no desktop enquanto elimina o scroll horizontal. */
  overflow-x: clip;
}

.checkout-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 48px;
  align-items: start;
}

/* ─── Summary rail ───────────────────────────────────────────────── */
.checkout-summary {
  background: var(--sage);
  border-radius: var(--r-lg);
  color: var(--white);
  position: sticky;
  top: calc(60px + 24px);
  overflow: hidden;
}

.checkout-summary::before {
  content: "";
  position: absolute;
  top: -40px;
  right: -40px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  pointer-events: none;
}

.checkout-summary::after {
  content: "";
  position: absolute;
  bottom: -60px;
  left: -30px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  pointer-events: none;
}

.summary-inner {
  padding: 36px 32px;
  position: relative;
  z-index: 1;
}

.summary-mascot {
  width: 48px;
  height: 48px;
  border-radius: var(--r-sm);
  margin-bottom: 24px;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.2));
}

.summary-eyebrow {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 8px;
}

.summary-price {
  display: flex;
  align-items: baseline;
  gap: 2px;
  margin-bottom: 6px;
  line-height: 1;
}

.summary-currency {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 500;
  color: rgba(255,255,255,0.7);
  margin-right: 2px;
}

.summary-amount {
  font-family: var(--font-display);
  font-size: 3.2rem;
  font-weight: 700;
  color: var(--white);
  line-height: 1;
}

.summary-period {
  font-size: 1rem;
  color: rgba(255,255,255,0.6);
  font-weight: 500;
}

.summary-cycle-detail {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.55);
  margin-bottom: 24px;
  line-height: 1.4;
}

.summary-divider {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.12);
  margin: 0 0 20px;
}

.summary-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.summary-features li {
  font-size: 0.88rem;
  color: rgba(255,255,255,0.8);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.4;
}

.summary-features li::before {
  content: "✓";
  font-weight: 700;
  color: rgba(255,255,255,0.5);
  flex-shrink: 0;
  margin-top: 0.05em;
}

.summary-lock {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.9);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  margin-bottom: 20px;
}

/* Hidden for regular plan (no "travado") */
.summary-lock[hidden] { display: none; }

.summary-trust {
  display: flex;
  gap: 6px;
  align-items: center;
  color: rgba(255,255,255,0.4);
  font-size: 0.75rem;
}

/* ─── Form column ────────────────────────────────────────────────── */
.checkout-form-wrap {
  max-width: 480px;
}

.checkout-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.checkout-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 28px;
  line-height: 1.5;
}

/* ─── Alert ──────────────────────────────────────────────────────── */
.checkout-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #b91c1c;
  padding: 12px 16px;
  border-radius: var(--r-sm);
  font-size: 0.88rem;
  margin-bottom: 20px;
  line-height: 1.45;
}

.checkout-alert svg { flex-shrink: 0; margin-top: 1px; }
.checkout-alert--info { background: #eff6ff; border-color: #93c5fd; color: #1e40af; }
.checkout-alert--warn { background: #fffbeb; border-color: #fcd34d; color: #92400e; }

/* ─── Google button ──────────────────────────────────────────────── */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 13px 20px;
  background: var(--white);
  border: 1.5px solid var(--beige-dark);
  border-radius: var(--r-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.btn-google:hover {
  border-color: var(--sage-soft);
  box-shadow: 0 4px 16px rgba(74, 124, 111, 0.12);
  transform: translateY(-1px);
}

.btn-google:active { transform: translateY(0); }

.btn-google:focus-visible {
  outline: 2px solid var(--sage);
  outline-offset: 2px;
}

/* Hide google button when user already authenticated via Google */
.btn-google[hidden] { display: none; }

/* ─── Divider ────────────────────────────────────────────────────── */
.form-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.form-divider-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.form-divider-text {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ─── Field groups ───────────────────────────────────────────────── */
.field-group {
  margin-bottom: 18px;
}

.field-label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.field-hint {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text-muted);
}

.field-input {
  width: 100%;
  padding: 12px 14px;
  min-height: 44px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text);
  background: var(--white);
  border: 1.5px solid var(--beige-dark);
  border-radius: var(--r-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  line-height: 1.4;
  -webkit-appearance: none;
  appearance: none;
}

.field-input::placeholder { color: var(--text-muted); opacity: 0.7; }

.field-input:hover { border-color: var(--sage-soft); }

.field-input:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(74, 124, 111, 0.12);
}

.field-input.has-error {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.field-input.is-valid {
  border-color: #16a34a;
}

.field-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%236B5D52' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

/* Prefix wrap for phone field */
.field-prefix-wrap {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--beige-dark);
  border-radius: var(--r-sm);
  background: var(--white);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field-prefix-wrap:focus-within {
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(74, 124, 111, 0.12);
}

.field-prefix-wrap.has-error { border-color: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1); }
.field-prefix-wrap.is-valid { border-color: #16a34a; }

.field-prefix {
  padding: 11px 10px 11px 14px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  border-right: 1px solid var(--border);
  white-space: nowrap;
  background: var(--beige-light);
  user-select: none;
}

.field-input--prefixed {
  border: none;
  border-radius: 0;
  box-shadow: none !important;
  padding-left: 10px;
}

.field-input--prefixed:focus { box-shadow: none; }
.field-prefix-wrap:focus-within .field-input--prefixed { outline: none; }

/* Password wrap */
.field-pw-wrap {
  position: relative;
}

.field-pw-wrap .field-input {
  padding-right: 44px;
}

.field-pw-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  padding: 10px;
  width: 44px;
  height: 44px;
  color: var(--text-muted);
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  background: transparent;
  border: none;
  cursor: pointer;
  line-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.field-pw-toggle:hover { color: var(--sage); }
.field-pw-toggle:focus-visible { outline: 2px solid var(--sage); outline-offset: 1px; }

/* Strength bars */
.pw-strength-bars {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
}

.pw-bar {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--border);
  transition: background 0.2s;
}

.pw-strength-label {
  font-size: 0.72rem;
  font-weight: 600;
  margin-left: 8px;
  min-width: 60px;
  transition: color 0.2s;
}

/* Field errors */
.field-error {
  display: block;
  font-size: 0.78rem;
  color: #b91c1c;
  margin-top: 5px;
  min-height: 1.2em;
  line-height: 1.3;
}

/* ─── Plan readout ───────────────────────────────────────────────── */
.plan-readout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--beige-light);
  border: 1.5px solid var(--beige-dark);
  border-radius: var(--r-sm);
}

.plan-readout-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.plan-readout-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.plan-readout-price {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.plan-readout-change {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--sage);
  white-space: nowrap;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  transition: background 0.15s;
}

.plan-readout-change:hover { background: rgba(74,124,111,0.08); }
.plan-readout-change:focus-visible { outline: 2px solid var(--sage); outline-offset: 2px; }

/* ─── Payment pills ──────────────────────────────────────────────── */
.payment-pills {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.payment-pill {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 14px;
  min-height: 44px;
  background: var(--white);
  border: 1.5px solid var(--beige-dark);
  border-radius: var(--r-sm);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-soft);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
}

.payment-pill:hover {
  border-color: var(--sage-soft);
  color: var(--sage);
}

.payment-pill:focus-visible {
  outline: 2px solid var(--sage);
  outline-offset: 2px;
}

.payment-pill--active {
  background: rgba(74, 124, 111, 0.07);
  border-color: var(--sage);
  color: var(--sage-dark);
  font-weight: 600;
  box-shadow: 0 0 0 1px var(--sage);
}

.payment-detail {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ─── Submit button ──────────────────────────────────────────────── */
.btn-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 15px 24px;
  background: var(--sage);
  color: var(--white);
  border: none;
  border-radius: var(--r-sm);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.12s, box-shadow 0.15s;
  box-shadow: 0 4px 16px rgba(74, 124, 111, 0.28);
  margin-top: 24px;
  margin-bottom: 16px;
  letter-spacing: 0.01em;
}

.btn-submit:hover:not(:disabled) {
  background: var(--sage-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(74, 124, 111, 0.36);
}

.btn-submit:active:not(:disabled) { transform: translateY(0); }

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

.btn-submit:focus-visible {
  outline: 2px solid var(--sage);
  outline-offset: 3px;
}

.btn-submit-spinner { line-height: 0; }

.spinner-svg {
  animation: spin 0.8s linear infinite;
}

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

/* ─── Legal text ─────────────────────────────────────────────────── */
.checkout-legal {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
}

.checkout-legal a {
  color: var(--sage);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.checkout-legal a:focus-visible {
  outline: 2px solid var(--sage);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ─── Google-authed state ────────────────────────────────────────── */
/* Banner shown after Google completes, before user submits */
.google-authed-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(74, 124, 111, 0.07);
  border: 1px solid var(--sage-soft);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  font-size: 0.85rem;
  color: var(--sage-dark);
  font-weight: 500;
  margin-bottom: 20px;
}

.google-authed-banner svg { flex-shrink: 0; }

/* ─── Password criteria checklist ───────────────────────────────── */
.pw-criteria {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 8px;
  padding: 0;
}

.pw-criterion {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  transition: color 0.15s;
}

.pw-criterion::before {
  content: "○";
  font-size: 0.65rem;
  flex-shrink: 0;
  transition: color 0.15s;
}

.pw-criterion.ok {
  color: #16a34a;
}

.pw-criterion.ok::before {
  content: "✓";
  font-weight: 700;
}

/* ─── Modal ──────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 500;
}

.modal-backdrop[hidden] { display: none; }

.modal-box {
  background: var(--white);
  border-radius: var(--r-lg);
  padding: 32px 28px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}

.modal-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-modal-primary {
  flex: 1;
  min-width: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 11px 16px;
  background: var(--sage);
  color: var(--white);
  border-radius: var(--r-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s;
}

.btn-modal-primary:hover { background: var(--sage-dark); }
.btn-modal-primary:focus-visible { outline: 2px solid var(--sage); outline-offset: 2px; }

.btn-modal-secondary {
  flex: 1;
  min-width: 120px;
  padding: 11px 16px;
  background: transparent;
  border: 1.5px solid var(--beige-dark);
  border-radius: var(--r-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s;
}

.btn-modal-secondary:hover { border-color: var(--sage-soft); }
.btn-modal-secondary:focus-visible { outline: 2px solid var(--sage); outline-offset: 2px; }

/* ─── Reduced motion ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .checkout-nav-step-dot,
  .spinner-svg,
  .pulse-dot { animation: none; }
  .btn-google,
  .btn-submit,
  .payment-pill,
  .field-input { transition: none; }
}

/* ─── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .checkout-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .checkout-summary {
    position: static;
    border-radius: var(--r);
    /* Esconde os círculos decorativos no mobile para evitar overflow horizontal
       (right:-40px e bottom:-60px escapam do overflow:hidden em alguns browsers) */
    overflow: hidden;
  }

  .checkout-summary::before,
  .checkout-summary::after {
    display: none;
  }

  .summary-inner {
    padding: 24px 24px;
  }

  .summary-logo-wrap { display: none; }

  .summary-price { margin-bottom: 4px; }
  .summary-amount { font-size: 2.4rem; }

  .summary-features { display: none; } /* condensed on mobile — trust list below */

  .checkout-main { padding: 24px 16px 60px; }
}

@media (max-width: 480px) {
  .checkout-nav-step { display: none; }

  .checkout-layout { gap: 16px; }

  .payment-pills { flex-direction: column; }

  .checkout-title { font-size: 1.8rem; }
}
