/* ============================================================
   CHECKOUT.CSS — Modal, Steps, Forms & Success Screen
   ============================================================ */

/* ── Overlay ──────────────────────────────────────────────── */
#checkout-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1300;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-normal);
}

#checkout-overlay.checkout-open { opacity: 1; pointer-events: auto; }

/* ── Modal ────────────────────────────────────────────────── */
#checkout-modal {
  position: fixed;
  inset: var(--space-lg);
  z-index: 1400;
  background: var(--bg-surface);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-xl);
  display: grid;
  grid-template-columns: 1fr 360px;
  overflow: hidden;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(124,58,237,0.15);
  transform: scale(0.95) translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: all var(--duration-normal) var(--ease-smooth);
  max-height: calc(100vh - 2 * var(--space-lg));
}

#checkout-modal.checkout-open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* ── Left Column (Form) ───────────────────────────────────── */
.checkout-left {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.checkout-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-xl);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.checkout-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.checkout-logo-mark {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  color: #fff;
}

.checkout-logo-text {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

#checkout-close {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text-secondary);
  font-size: 1.1rem;
  transition: all var(--duration-fast);
}

#checkout-close:hover {
  background: rgba(239,68,68,0.1);
  color: #fca5a5;
}

/* ── Step Progress ────────────────────────────────────────── */
.step-progress {
  display: flex;
  align-items: center;
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.step-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  position: relative;
}

.step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--bg-card);
  transition: all var(--duration-normal) var(--ease-smooth);
  position: relative;
  z-index: 1;
}

.step-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 0.04em;
  white-space: nowrap;
  transition: color var(--duration-normal);
}

.step-indicator.active .step-circle {
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  box-shadow: 0 0 20px var(--primary-glow);
}

.step-indicator.active .step-label { color: var(--primary-light); }

.step-indicator.completed .step-circle {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}
.step-indicator.completed .step-circle::after {
  content: '✓';
}

.step-indicator.completed .step-label { color: var(--success); }

/* Connector line between steps */
.step-line {
  flex: 1;
  height: 2px;
  background: rgba(255,255,255,0.08);
  margin: 0 var(--space-sm);
  margin-bottom: 22px;
  transition: background var(--duration-normal);
}

.step-line.completed { background: var(--success); }

/* ── Step Content ─────────────────────────────────────────── */
.checkout-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-xl);
  scrollbar-width: thin;
  scrollbar-color: var(--primary) transparent;
}

.checkout-step-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.checkout-step-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: var(--space-xl);
  line-height: 1.5;
}

.step-content {
  display: none;
}

.step-content.active { display: block; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.form-row.full { grid-template-columns: 1fr; }

.checkout-form { display: flex; flex-direction: column; gap: var(--space-md); }

/* ── Coupon Hint ──────────────────────────────────────────── */
.coupon-hint {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.2);
  border-radius: var(--radius-md);
  margin-top: var(--space-sm);
}

.coupon-hint-icon { font-size: 1.2rem; flex-shrink: 0; }

.coupon-hint-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.coupon-hint-text strong { color: var(--gold-light); }

/* ── Step Error ───────────────────────────────────────────── */
.step-error {
  color: #fca5a5;
  font-size: 0.85rem;
  padding: var(--space-sm) var(--space-md);
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  animation: card-enter 0.3s var(--ease-smooth);
}

/* ── Payment Tabs ─────────────────────────────────────────── */
.payment-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
}

[data-payment] {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  border: 2px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--duration-fast);
  min-height: 56px;
}

[data-payment]:hover { border-color: rgba(124,58,237,0.3); color: var(--text-primary); }

[data-payment].active {
  border-color: var(--primary);
  color: var(--primary-light);
  background: var(--primary-subtle);
  box-shadow: 0 0 0 1px var(--primary);
}

.payment-panel { display: none; }
.payment-panel.active { display: block; }

/* ── PIX Panel ────────────────────────────────────────────── */
.pix-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);
  padding: var(--space-xl);
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-xl);
  text-align: center;
}

.pix-qr {
  width: 160px;
  height: 160px;
  background: #fff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  box-shadow: 0 0 40px rgba(0,0,0,0.3);
}

.pix-key {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-muted);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-align: center;
  word-break: break-all;
  cursor: pointer;
}

.pix-timer {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.85rem;
  color: var(--warning);
}

/* ── Checkout Footer ──────────────────────────────────────── */
.checkout-footer {
  padding: var(--space-lg) var(--space-xl);
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  flex-shrink: 0;
}

#btn-prev-step {
  display: none;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-full);
  border: 1.5px solid rgba(255,255,255,0.12);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all var(--duration-fast);
  min-height: 48px;
}

#btn-prev-step:hover {
  border-color: rgba(255,255,255,0.3);
  color: var(--text-primary);
}

#btn-next-step,
#btn-finish-order {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.875rem 2rem;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
  transition: all var(--duration-normal) var(--ease-smooth);
  box-shadow: var(--shadow-purple);
  min-height: 48px;
  margin-left: auto;
}

#btn-next-step:hover,
#btn-finish-order:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(124,58,237,0.5);
}

#btn-finish-order {
  background: linear-gradient(135deg, var(--success), #059669);
  box-shadow: 0 8px 24px rgba(16,185,129,0.3);
}

#btn-finish-order:hover { box-shadow: 0 12px 40px rgba(16,185,129,0.4); }

.checkout-security {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ── Right Column (Order Summary) ────────────────────────── */
.checkout-right {
  background: var(--bg-card);
  border-left: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.summary-header {
  padding: var(--space-xl);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.summary-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.summary-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-lg) var(--space-xl);
  scrollbar-width: thin;
  scrollbar-color: var(--primary) transparent;
}

#checkout-summary-items {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.summary-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.summary-item-img {
  width: 52px;
  height: 36px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.summary-item-info {
  flex: 1;
  min-width: 0;
}

.summary-item-info p {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-item-info span {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.summary-item strong {
  font-size: 0.875rem;
  font-weight: 700;
  flex-shrink: 0;
}

#checkout-summary-total {
  border-top: 1px solid rgba(255,255,255,0.06);
  padding-top: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.summary-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.summary-line.saving span:last-child { color: var(--success); font-weight: 600; }
.summary-line.saving span:first-child { color: var(--success); }

.summary-line.total {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: var(--space-sm);
  margin-top: var(--space-xs);
}

.summary-line.total span:first-child { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.summary-line.total span:last-child  { font-size: 1.2rem; font-weight: 800; font-family: var(--font-heading); color: var(--primary-light); }

/* ── Summary Footer ───────────────────────────────────────── */
.summary-footer {
  padding: var(--space-lg) var(--space-xl);
  border-top: 1px solid rgba(255,255,255,0.06);
}

.summary-guarantee {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: rgba(16,185,129,0.08);
  border: 1px solid rgba(16,185,129,0.2);
  border-radius: var(--radius-md);
}

.summary-guarantee-icon { font-size: 1.5rem; }

.summary-guarantee-text { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.4; }
.summary-guarantee-text strong { color: var(--success); display: block; font-size: 0.85rem; }

/* ── Success Screen ───────────────────────────────────────── */
#success-screen {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  padding: var(--space-xl);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-normal);
}

#success-screen.success-open { opacity: 1; pointer-events: auto; }

.success-icon-wrapper {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--success), #059669);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  margin-bottom: var(--space-xl);
  box-shadow: 0 0 60px rgba(16,185,129,0.4);
  animation: float 3s ease-in-out infinite;
}

.success-headline {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 800;
  margin-bottom: var(--space-md);
}

.success-sub {
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-2xl);
  max-width: 420px;
  line-height: 1.6;
}

.success-details {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-xl);
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 380px;
  margin-bottom: var(--space-xl);
}

.success-detail-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.success-detail-item svg { color: var(--success); flex-shrink: 0; }

.success-close {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.875rem 2rem;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: var(--shadow-purple);
  transition: all var(--duration-normal) var(--ease-smooth);
  min-height: 52px;
}

.success-close:hover { transform: translateY(-2px); box-shadow: 0 12px 40px rgba(124,58,237,0.5); }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  #checkout-modal {
    inset: 0;
    border-radius: 0;
    grid-template-columns: 1fr;
  }
  .checkout-right { display: none; }
  .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .checkout-footer { flex-direction: column-reverse; }
  #btn-next-step, #btn-finish-order { width: 100%; justify-content: center; }
  #btn-prev-step { width: 100%; justify-content: center; }
}
