/* ============================================================
   EDITORA ESPERANÇA SOLIDÁRIA — Checkout Flow Styles
   Product detail, checkout, confirmation
   ============================================================ */

/* ---------- CHECKOUT HEADER (simplified) ---------- */
.checkout-header {
  position: sticky;
  top: 0;
  background-color: rgba(253, 251, 247, 0.97);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-light);
  z-index: 50;
  height: var(--header-h);
}

.checkout-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-width);
  margin: 0 auto;
  height: 100%;
  padding: 0 1.25rem;
}

@media (min-width: 768px) {
  .checkout-header-inner { padding: 0 2rem; }
}

.checkout-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--duration) var(--ease);
  cursor: pointer;
}

.checkout-back:hover {
  color: var(--gold);
}

.checkout-back svg {
  width: 16px;
  height: 16px;
}

.checkout-step-indicator {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-light);
  letter-spacing: 0.04em;
}

/* ============================================================
   PRODUCT DETAIL PAGE
   ============================================================ */
.product-page {
  padding-top: var(--space-2xl);
  padding-bottom: var(--space-3xl);
}

.product-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2xl);
}

@media (min-width: 768px) {
  .product-layout {
    grid-template-columns: 1fr 1.2fr;
    gap: var(--space-3xl);
    align-items: start;
  }
}

/* Product cover */
.product-cover-wrap {
  position: relative;
}

@media (min-width: 768px) {
  .product-cover-wrap {
    position: sticky;
    top: calc(var(--header-h) + var(--space-xl));
  }
}

.product-cover {
  aspect-ratio: 3 / 4;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1), 0 4px 12px rgba(0, 0, 0, 0.06);
  max-width: 380px;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .product-cover {
    max-width: none;
  }
}

.product-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-cover .book-cover-placeholder {
  border-radius: 0;
  font-size: 1.25rem;
  padding: 1.5rem;
}

.product-cover .book-cover-title {
  font-size: 1.375rem;
}

/* Product info */
.product-info {
  padding-top: var(--space-sm);
}

.product-category {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: var(--space-sm);
}

.product-title {
  font-family: var(--font-heading);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 600;
  line-height: 1.15;
  margin-bottom: var(--space-sm);
}

.product-subtitle {
  font-size: 1.0625rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: var(--space-xl);
}

.product-description {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid var(--border-light);
}

/* Price block */
.product-price-block {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.product-price {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.product-price-original {
  font-size: 0.9375rem;
  color: var(--text-light);
  text-decoration: line-through;
}

.product-price-tag {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.625rem;
  border-radius: 3px;
  background-color: var(--green-pale);
  color: var(--green-soft);
}

/* Product actions */
.product-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.product-actions .btn {
  flex: 1;
  min-width: 180px;
}

/* Product meta (format, pages, etc.) */
.product-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm) var(--space-lg);
  padding: var(--space-lg);
  background: var(--bg-section-alt);
  border-radius: 8px;
  margin-bottom: var(--space-2xl);
}

.product-meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.product-meta-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-light);
}

.product-meta-value {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
}

/* ---------- Product sections ---------- */
.product-section {
  padding: var(--space-3xl) 0;
}

.product-section-alt {
  background: var(--bg-section-alt);
}

.product-section-title {
  font-family: var(--font-heading);
  font-size: clamp(1.375rem, 3vw, 1.75rem);
  font-weight: 600;
  margin-bottom: var(--space-xl);
  text-align: center;
}

/* "O que você vai encontrar" */
.product-topics {
  max-width: 720px;
  margin: 0 auto;
}

.product-topic {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border-light);
}

.product-topic:last-child {
  border-bottom: none;
}

.product-topic-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  color: var(--gold);
  margin-top: 2px;
}

.product-topic-text {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* "Ideal para quem busca" */
.product-profiles {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
  max-width: 800px;
  margin: 0 auto;
}

@media (min-width: 600px) {
  .product-profiles {
    grid-template-columns: 1fr 1fr;
  }
}

.product-profile {
  padding: var(--space-lg);
  background: var(--white-warm);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  text-align: center;
}

.product-profile-title {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.product-profile-desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Trust badges */
.trust-badges {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  max-width: 800px;
  margin: 0 auto;
}

@media (min-width: 600px) {
  .trust-badges {
    grid-template-columns: repeat(4, 1fr);
  }
}

.trust-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-sm);
  padding: var(--space-lg) var(--space-sm);
}

.trust-badge-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--gold-wash);
  color: var(--gold);
}

.trust-badge-icon svg {
  width: 20px;
  height: 20px;
}

.trust-badge-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ============================================================
   CHECKOUT PAGE
   ============================================================ */
.checkout-page {
  padding: var(--space-xl) 0 var(--space-3xl);
  min-height: calc(100vh - var(--header-h));
}

.checkout-page-title {
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 600;
  margin-bottom: var(--space-xl);
}

.checkout-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2xl);
}

@media (min-width: 768px) {
  .checkout-layout {
    grid-template-columns: 1.3fr 1fr;
    gap: var(--space-3xl);
    align-items: start;
  }
}

/* ---------- Order summary sidebar ---------- */
.order-summary {
  order: -1;
}

@media (min-width: 768px) {
  .order-summary {
    order: 1;
    position: sticky;
    top: calc(var(--header-h) + var(--space-xl));
  }
}

.order-summary-card {
  background: var(--bg-section-alt);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: var(--space-xl);
}

.order-summary-header {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-light);
  margin-bottom: var(--space-lg);
}

.order-product {
  display: flex;
  gap: var(--space-md);
  padding-bottom: var(--space-lg);
  margin-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border-light);
}

.order-product-cover {
  width: 64px;
  height: 85px;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.order-product-cover .book-cover-placeholder {
  border-radius: 0;
  padding: 0.5rem;
}

.order-product-cover .book-cover-title {
  font-size: 0.5rem;
}

.order-product-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.25rem;
}

.order-product-category {
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
}

.order-product-name {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
}

.order-product-type {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Price lines */
.order-lines {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border-light);
}

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

.order-line-discount {
  color: var(--green-soft);
}

.order-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--space-lg);
}

.order-total-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.order-total-value {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Mini trust */
.order-trust {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

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

.order-trust-item svg {
  width: 14px;
  height: 14px;
  color: var(--gold);
  flex-shrink: 0;
}

/* ---------- Checkout form ---------- */
.checkout-form-section {
  margin-bottom: var(--space-2xl);
}

.checkout-form-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border-light);
}

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

@media (min-width: 480px) {
  .checkout-form-row.row-2 {
    grid-template-columns: 1fr 1fr;
  }
  .checkout-form-row.row-3 {
    grid-template-columns: 1fr 1fr 1fr;
  }
  .checkout-form-row.row-2-1 {
    grid-template-columns: 2fr 1fr;
  }
}

/* Form field with validation */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.field-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.field-label .optional {
  font-weight: 400;
  color: var(--text-light);
  font-size: 0.75rem;
}

.field-input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  color: var(--text-primary);
  background-color: var(--white-warm);
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: border-color var(--duration) var(--ease),
              box-shadow var(--duration) var(--ease);
}

.field-input::placeholder {
  color: var(--text-light);
}

.field-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184, 146, 62, 0.1);
}

.field-input:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

.field-input.error {
  border-color: #c0392b;
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.08);
}

.field-input.success {
  border-color: var(--green-soft);
}

.field-error {
  font-size: 0.75rem;
  color: #c0392b;
  min-height: 1rem;
  opacity: 0;
  transition: opacity var(--duration) var(--ease);
}

.field-error.visible {
  opacity: 1;
}

/* Select */
.field-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237a746b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
  cursor: pointer;
}

/* ---------- Payment tabs ---------- */
.payment-tabs {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: var(--space-xl);
}

.payment-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1rem;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--white-warm);
  border: none;
  border-right: 1px solid var(--border);
  cursor: pointer;
  transition: background-color var(--duration) var(--ease),
              color var(--duration) var(--ease);
}

.payment-tab:last-child {
  border-right: none;
}

.payment-tab:hover {
  background-color: var(--beige);
}

.payment-tab.active {
  background-color: var(--gold-wash);
  color: var(--gold);
  font-weight: 600;
}

.payment-tab svg {
  width: 18px;
  height: 18px;
}

/* Payment panels */
.payment-panel {
  display: none;
}

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

/* Pix area */
.pix-container {
  text-align: center;
}

.pix-qr-area {
  width: 200px;
  height: 200px;
  margin: 0 auto var(--space-lg);
  background: var(--white-warm);
  border: 2px dashed var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 0.8125rem;
}

.pix-code-area {
  background: var(--bg-section-alt);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: var(--space-md);
  margin-bottom: var(--space-md);
}

.pix-code-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}

.pix-code-value {
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  color: var(--text-secondary);
  word-break: break-all;
  line-height: 1.5;
  padding: var(--space-sm);
  background: var(--white-warm);
  border-radius: 4px;
  border: 1px solid var(--border-light);
  margin-bottom: var(--space-md);
}

.btn-copy {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-copy.copied {
  background-color: var(--green-soft);
  border-color: var(--green-soft);
}

.pix-notice {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-light);
}

/* Boleto area */
.boleto-container {
  text-align: center;
}

.boleto-bar-area {
  width: 100%;
  height: 80px;
  margin: 0 auto var(--space-lg);
  background: var(--white-warm);
  border: 2px dashed var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 0.8125rem;
}

/* Card fields */
.card-field-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* ---------- Finalize button ---------- */
.checkout-submit {
  margin-top: var(--space-xl);
}

.btn-finalize {
  width: 100%;
  padding: 1rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  position: relative;
}

.btn-finalize.loading {
  color: transparent;
  pointer-events: none;
}

.btn-finalize.loading::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  top: 50%;
  left: 50%;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ============================================================
   CONFIRMATION PAGE
   ============================================================ */
.confirmation-page {
  padding: var(--space-3xl) 0;
  min-height: calc(100vh - var(--header-h));
  display: flex;
  align-items: center;
}

.confirmation-inner {
  max-width: 560px;
  margin: 0 auto;
  text-align: center;
}

.confirmation-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-xl);
}

.confirmation-icon.success {
  background: var(--green-pale);
  color: var(--green-soft);
}

.confirmation-icon.pending {
  background: var(--gold-wash);
  color: var(--gold);
}

.confirmation-icon svg {
  width: 32px;
  height: 32px;
}

.confirmation-title {
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  font-weight: 600;
  margin-bottom: var(--space-md);
}

.confirmation-desc {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: var(--space-xl);
}

/* Confirmation product card */
.confirmation-product {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding: var(--space-lg);
  background: var(--bg-section-alt);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  margin-bottom: var(--space-xl);
  text-align: left;
}

.confirmation-product-cover {
  width: 72px;
  height: 96px;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.confirmation-product-cover .book-cover-placeholder {
  border-radius: 0;
  padding: 0.5rem;
}

.confirmation-product-cover .book-cover-title {
  font-size: 0.5rem;
}

.confirmation-product-info {
  flex: 1;
}

.confirmation-product-name {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.confirmation-product-price {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Instructions */
.confirmation-instructions {
  background: var(--white-warm);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: var(--space-lg);
  margin-bottom: var(--space-xl);
  text-align: left;
}

.confirmation-instructions-title {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-light);
  margin-bottom: var(--space-md);
}

.confirmation-instructions ol {
  list-style: decimal;
  padding-left: 1.25rem;
}

.confirmation-instructions li {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: var(--space-xs);
}

.confirmation-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-md);
}

/* Pix pending specific */
.confirmation-pix-area {
  margin-bottom: var(--space-xl);
}

/* ============================================================
   "WHY BUY" SECTION
   ============================================================ */
.why-buy {
  padding: var(--space-xl);
  background: var(--bg-section-alt);
  border-radius: 8px;
  margin-top: var(--space-xl);
}

.why-buy-title {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: var(--space-lg);
}

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

.why-buy-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
}

.why-buy-item svg {
  width: 18px;
  height: 18px;
  color: var(--gold);
  flex-shrink: 0;
  margin-top: 2px;
}

.why-buy-item span {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ============================================================
   RESPONSIVE REFINEMENTS
   ============================================================ */
@media (max-width: 479px) {
  .payment-tab {
    font-size: 0.75rem;
    padding: 0.75rem 0.5rem;
  }

  .payment-tab svg {
    display: none;
  }

  .checkout-form-row.row-2,
  .checkout-form-row.row-3,
  .checkout-form-row.row-2-1 {
    grid-template-columns: 1fr;
  }

  .why-buy-grid {
    grid-template-columns: 1fr;
  }

  .trust-badges {
    grid-template-columns: 1fr 1fr;
  }
}

/* Print */
@media print {
  .checkout-header,
  .checkout-submit,
  .payment-tabs,
  .payment-panel,
  .trust-badges,
  .why-buy {
    display: none;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .btn-finalize.loading::after {
    animation: none;
  }
}