/**
 * Checkout Santa Apolônia - Design Lovable
 * Compatível com sap_new.css e carrinho.css
 * Escopo: .chk-page (checkout container)
 */

/* Variáveis do Checkout Lovable-style */
.chk-page {
  --chk-primary: hsl(216, 81%, 39%);
  --chk-primary-foreground: #fff;
  --chk-primary-hover: hsl(216, 81%, 35%);
  --chk-border: hsl(220, 13%, 91%);
  --chk-muted: hsl(220, 14%, 96%);
  --chk-muted-foreground: hsl(220, 9%, 46%);
  --chk-foreground: hsl(220, 13%, 18%);
  --chk-success: hsl(142, 71%, 45%);
  --chk-radius: 0.5rem;
  --chk-radius-lg: 0.75rem;
  --chk-radius-xl: 1rem;
  --chk-shadow: 0 1px 3px rgba(0,0,0,0.1);
  --chk-font: 'Montserrat', 'Outfit', 'Inter', 'Open Sans', sans-serif;
}

/* Container principal */
.chk-page {
  font-family: var(--chk-font);
  color: var(--chk-foreground);
  background: #fff;
  min-height: 100vh;
  padding-bottom: 2rem;
}

.chk-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Stepper - 3 etapas */
.chk-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 1.5rem 0 2rem;
  border-bottom: 1px solid var(--chk-border);
}

.chk-stepper-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 0 auto;
}

.chk-stepper-num {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.3s;
}

.chk-stepper-item.active .chk-stepper-num {
  background: var(--chk-primary);
  color: var(--chk-primary-foreground);
  box-shadow: 0 0 0 4px rgba(9, 127, 176, 0.2);
}

.chk-stepper-item:not(.active) .chk-stepper-num {
  background: var(--chk-muted);
  color: var(--chk-muted-foreground);
}

.chk-stepper-label {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
}

.chk-stepper-item.active .chk-stepper-label {
  color: var(--chk-primary);
}

.chk-stepper-item:not(.active) .chk-stepper-label {
  color: var(--chk-muted-foreground);
}

.chk-stepper-connector {
  width: 3rem;
  height: 2px;
  background: var(--chk-border);
  margin: 0 0.5rem;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .chk-stepper-connector {
    width: 6rem;
    margin: 0 1rem;
  }
}

@media (max-width: 767px) {
  .chk-stepper-num {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.75rem;
  }
  .chk-stepper-label {
    font-size: 0.65rem;
  }
  .chk-stepper-connector {
    width: 2rem;
    margin: 0 0.25rem;
  }
}

/* Ocultar stepper antigo (seq-cadastro) - usamos chk-stepper */
.chk-old-stepper {
  display: none !important;
}

/* Trust banner */
.chk-trust-banner {
  background: var(--chk-primary);
  color: var(--chk-primary-foreground);
  padding: 0.75rem 0;
  text-align: center;
  font-size: 0.875rem;
}

.chk-trust-banner strong {
  font-weight: 700;
}

/* Grid principal - 2 colunas (formulário + sidebar) */
.chk-main {
  padding: 1.5rem 0 2.5rem;
}

.chk-main .container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.chk-main .chk-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-left: -0.5rem;
  margin-right: -0.5rem;
}

.chk-main .chk-row > form,
.chk-main .chk-row > .chk-sidebar {
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

@media (min-width: 992px) {
  .chk-main .chk-row {
    flex-wrap: nowrap;
  }
  .chk-main .chk-row > form {
    flex: 1;
    min-width: 0;
    max-width: 58.333%;
  }
  .chk-main .chk-row > .chk-sidebar {
    flex: 0 0 41.666%;
    max-width: 41.666%;
    position: sticky;
    top: 6rem;
    align-self: flex-start;
  }
}

.chk-form-col {
  width: 100%;
}

.chk-sidebar {
  width: 100%;
  margin-top: 1.5rem;
}

@media (min-width: 992px) {
  .chk-sidebar {
    margin-top: 0;
  }
}

/* Card do resumo - branco, cantos arredondados */
.chk-summary-card {
  background: #fff;
  border-radius: var(--chk-radius-xl);
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border: 1px solid var(--chk-border);
}

.chk-summary-card .chk-summary-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--chk-foreground);
  margin: 0 0 1.25rem;
  padding: 0;
  border: none;
}

.chk-summary-card .chk-summary-icon {
  color: var(--chk-primary);
  font-size: 1.25rem;
}

/* Produtos - layout compacto com badge de quantidade */
.chk-summary-produtos {
  margin-bottom: 1rem;
}

.chk-summary-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--chk-border);
}

.chk-summary-item:last-child {
  border-bottom: none;
}

.chk-summary-item-img {
  position: relative;
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: var(--chk-radius);
  overflow: hidden;
  background: var(--chk-muted);
}

.chk-summary-item-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chk-qty-badge {
  position: absolute;
  top: -4px;
  left: -4px;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.25rem;
  background: var(--chk-primary);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chk-summary-item-info {
  flex: 1;
  min-width: 0;
}

.chk-summary-item-nome {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--chk-foreground);
  margin: 0 0 0.125rem;
  line-height: 1.3;
}

.chk-summary-item-ref {
  font-size: 0.75rem;
  color: var(--chk-muted-foreground);
  margin: 0 0 0.25rem;
}

.chk-summary-item-preco {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--chk-primary);
  margin: 0;
}

/* Order bump - compacto, borda tracejada */
.chk-order-bump {
  border: 2px dashed rgba(9, 127, 176, 0.5);
  border-radius: var(--chk-radius-lg);
  padding: 1rem;
  margin: 1rem 0;
  background: rgba(9, 127, 176, 0.03);
}

.chk-order-bump-badge {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.375rem 0.5rem;
  border-radius: 0.25rem;
  margin-bottom: 0.75rem;
}

.chk-order-bump-badge .fa-gift {
  font-size: 0.875rem;
}

.chk-order-bump-inner {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.chk-order-bump-checkbox {
  flex-shrink: 0;
  margin: 0;
  cursor: pointer;
}

.chk-order-bump-checkbox input {
  width: 1rem;
  height: 1rem;
  margin: 0;
}

.chk-order-bump-img {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: var(--chk-radius);
  overflow: hidden;
  background: var(--chk-muted);
}

.chk-order-bump-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chk-order-bump-info {
  flex: 1;
  min-width: 0;
}

.chk-order-bump-nome {
  font-size: 0.8125rem;
  font-weight: 500;
  margin: 0 0 0.125rem;
}

.chk-order-bump-desc {
  font-size: 0.75rem;
  color: var(--chk-muted-foreground);
  margin: 0 0 0.25rem;
}

.chk-order-bump-precos {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chk-order-bump-original {
  font-size: 0.75rem;
  color: var(--chk-muted-foreground);
  text-decoration: line-through;
}

.chk-order-bump-atual {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--chk-success);
}

.chk-order-bump-qty {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.5rem;
}

.chk-order-bump-qty input {
  width: 2.5rem;
  height: 1.75rem;
  text-align: center;
  border: 1px solid var(--chk-border);
  border-radius: 0.25rem;
}

.chk-ob-less,
.chk-ob-more {
  width: 1.75rem;
  height: 1.75rem;
  border: 1px solid var(--chk-border);
  background: #fff;
  border-radius: 0.25rem;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.chk-ob-less:hover,
.chk-ob-more:hover {
  background: var(--chk-muted);
}

/* Cupom no resumo */
.chk-summary-cupom {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0;
}

.chk-cupom-input-wrap {
  flex: 1;
  position: relative;
}

.chk-cupom-icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--chk-muted-foreground);
  font-size: 0.9375rem;
}

.chk-cupom-input-wrap input {
  width: 100%;
  height: 2.5rem;
  padding-left: 2.25rem;
  padding-right: 0.75rem;
  border: 1px solid var(--chk-border);
  border-radius: var(--chk-radius);
  font-size: 0.875rem;
}

.chk-cupom-aplicar {
  padding: 0 1rem;
  height: 2.5rem;
  background: rgba(9, 127, 176, 0.12);
  color: var(--chk-primary);
  border: 1px solid rgba(9, 127, 176, 0.3);
  border-radius: var(--chk-radius);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  flex-shrink: 0;
}

.chk-cupom-aplicar:hover {
  background: rgba(9, 127, 176, 0.2);
}

/* Garantir que o stepper use as variáveis */
.chk-page .chk-stepper-num {
  background: var(--chk-muted);
  color: var(--chk-muted-foreground);
}
.chk-page .chk-stepper-item.active .chk-stepper-num {
  background: var(--chk-primary);
  color: var(--chk-primary-foreground);
}

/* Barra editar / sair */
.chk-edit-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding: 0.5rem 0;
}

.chk-edit-btn {
  background: transparent;
  border: 1px solid var(--chk-border);
  padding: 0.5rem 0.75rem;
  border-radius: var(--chk-radius);
  font-size: 0.875rem;
  cursor: pointer;
  color: var(--chk-foreground);
  font-family: inherit;
}

.chk-edit-btn:hover {
  border-color: var(--chk-primary);
  color: var(--chk-primary);
}

.chk-logout-link {
  font-size: 0.875rem;
  color: var(--chk-muted-foreground);
  text-decoration: none;
}

.chk-logout-link:hover {
  color: var(--chk-primary);
}

/* Cabeçalho de seção */
.chk-section-header {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--chk-foreground);
  margin-bottom: 1rem;
}

/* Seção "Como deseja realizar a compra?" */
.chk-section-question {
  font-size: 1rem;
  font-weight: 600;
  color: var(--chk-foreground);
  margin-bottom: 1rem;
}

/* Cards Pessoa Física/Jurídica - estilo mockup */
.chk-pessoa-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.chk-pessoa-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.25rem 1.5rem;
  border-radius: var(--chk-radius-xl);
  border: 2px solid var(--chk-border);
  background: #fff;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  position: relative;
}

.chk-pessoa-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chk-pessoa-btn:hover {
  border-color: rgba(9, 127, 176, 0.5);
  background: var(--chk-muted);
}

.chk-pessoa-btn:has(.chk-pessoa-input:checked),
.chk-pessoa-btn.active {
  border-color: var(--chk-primary);
  background: rgba(9, 127, 176, 0.06);
}

.chk-pessoa-icon {
  width: 2rem;
  height: 2rem;
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--chk-muted-foreground);
}

.chk-pessoa-btn:has(.chk-pessoa-input:checked) .chk-pessoa-icon,
.chk-pessoa-btn.active .chk-pessoa-icon {
  color: var(--chk-primary);
}

.chk-pessoa-text {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--chk-foreground);
}

/* Divisor "ou preencha manualmente" */
.chk-divider-text {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0 1.25rem;
  font-size: 0.875rem;
  color: var(--chk-muted-foreground);
}

.chk-divider-text::before,
.chk-divider-text::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--chk-border);
}

.chk-pessoa-btn svg,
.chk-pessoa-btn .chk-icon {
  width: 1.5rem;
  height: 1.5rem;
  margin-bottom: 0.5rem;
}

.chk-pessoa-btn.active .chk-icon,
.chk-pessoa-btn.selected .chk-icon {
  color: var(--chk-primary);
}

/* Inputs */
.chk-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--chk-foreground);
}

.chk-input {
  width: 100%;
  height: 2.75rem;
  padding: 0 1rem;
  border: 1px solid var(--chk-border);
  border-radius: var(--chk-radius);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

.chk-input:focus {
  outline: none;
  border-color: var(--chk-primary);
  box-shadow: 0 0 0 2px rgba(9, 127, 176, 0.2);
}

.chk-input::placeholder {
  color: var(--chk-muted-foreground);
}

.chk-microcopy {
  font-size: 0.75rem;
  color: var(--chk-muted-foreground);
  margin-top: 0.25rem;
}

/* Campos do formulário - estilo mockup */
.chk-form-fields {
  margin-top: 1rem;
}

.chk-field {
  margin-bottom: 1rem;
}

.chk-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (max-width: 575px) {
  .chk-field-row {
    grid-template-columns: 1fr;
  }
}

.chk-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.chk-input-wrap .chk-input-icon {
  position: absolute;
  left: 0.875rem;
  font-size: 1rem;
  color: var(--chk-muted-foreground);
  pointer-events: none;
}

.chk-input-wrap .chk-input,
.chk-input-wrap .form-control {
  width: 100%;
  height: 2.75rem;
  padding-left: 2.5rem;
  padding-right: 1rem;
  border: 1px solid var(--chk-border);
  border-radius: var(--chk-radius);
  font-size: 0.9375rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.chk-input-wrap .form-control:focus {
  outline: none;
  border-color: var(--chk-primary);
  box-shadow: 0 0 0 2px rgba(9, 127, 176, 0.15);
}

.chk-btn-wrap {
  margin-top: 1.5rem;
}

.chk-btn-continue {
  width: 100%;
  height: 3.25rem;
  border-radius: var(--chk-radius-xl);
  font-size: 1rem;
  font-weight: 600;
  background: var(--chk-primary);
  color: var(--chk-primary-foreground);
  border: none;
  cursor: pointer;
  transition: background 0.2s;
  font-family: inherit;
}

.chk-btn-continue:hover:not(:disabled) {
  background: var(--chk-primary-hover);
}

.chk-btn-continue:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Sidebar - Resumo do pedido (estilos globais do card já definidos acima) */

/* Order bump Lovable-style */
.chk-order-bump {
  border: 2px dashed rgba(9, 127, 176, 0.5);
  border-radius: var(--chk-radius-xl);
  padding: 1rem;
  margin: 1rem 0;
  background: rgba(9, 127, 176, 0.04);
  transition: all 0.3s;
}

.chk-order-bump:hover {
  border-color: rgba(9, 127, 176, 0.6);
  background: rgba(9, 127, 176, 0.08);
}

.chk-order-bump-badge {
  display: inline-block;
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  margin-bottom: 0.5rem;
  letter-spacing: 0.5px;
}

/* Cupom - estilo mockup */
.chk-cupom-section {
  margin: 1rem 0;
}

.chk-cupom-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.chk-cupom-row .chk-input-wrap {
  flex: 1;
  min-width: 0;
}

.chk-cupom-row .chk-input-wrap .form-control {
  height: 2.5rem;
}

.chk-cupom-btn {
  padding: 0 1.25rem;
  height: 2.5rem;
  border-radius: var(--chk-radius);
  font-weight: 600;
  font-size: 0.875rem;
  background: var(--chk-primary);
  color: var(--chk-primary-foreground);
  border: none;
  cursor: pointer;
  transition: opacity 0.2s;
  flex-shrink: 0;
}

.chk-cupom-btn:hover:not(:disabled) {
  opacity: 0.9;
}

.chk-cupom-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Totais - estilo mockup */
.chk-totals {
  border-top: 1px solid var(--chk-border);
  padding-top: 1rem;
  margin-top: 1rem;
}

.chk-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9375rem;
  margin-bottom: 0.5rem;
  color: var(--chk-foreground);
}

.chk-total-row.final {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--chk-border);
  font-size: 1.125rem;
  font-weight: 600;
}

.chk-total-row.final .chk-total-val {
  font-weight: 700;
  color: var(--chk-primary);
  font-size: 1.25rem;
}

.chk-frete-val {
  font-weight: 500;
}

.chk-frete-gratis {
  color: var(--chk-success) !important;
}

.chk-servico-row {
  font-size: 0.8125rem;
  color: var(--chk-muted-foreground);
}

.chk-servico-row .chk-muted {
  color: var(--chk-muted-foreground);
  font-weight: 400;
}

/* Botão Continuar */
.chk-btn-continue {
  width: 100%;
  height: 3.5rem;
  border-radius: var(--chk-radius-xl);
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--chk-primary);
  color: var(--chk-primary-foreground);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  margin-top: 1rem;
}

.chk-btn-continue:hover:not(:disabled) {
  background: var(--chk-primary-hover);
}

.chk-btn-continue:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Endereço de entrega */
.chk-section-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--chk-foreground);
}

.chk-form-grid {
  display: grid;
  gap: 1rem;
}

.chk-form-grid.cols-2 {
  grid-template-columns: 1fr 1fr;
}

.chk-form-grid.cols-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

@media (max-width: 767px) {
  .chk-form-grid.cols-2,
  .chk-form-grid.cols-3 {
    grid-template-columns: 1fr;
  }
}

/* Utilitários */
.chk-field-error {
  border-color: #dc3545 !important;
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

.chk-field-success {
  border-color: var(--chk-success) !important;
  box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25) !important;
}

.chk-frete-gratis {
  color: var(--chk-success);
  font-weight: 500;
}
