/* ============================================
   ARF Brindes — Carrinho de Compras
   ============================================ */

/* ---------- Ícone do carrinho no header ---------- */
.cart-icon-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 8px;
  color: rgba(255,255,255,0.85);
  background: none;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}
.cart-icon-btn:hover { background: rgba(255,255,255,0.08); }
.cart-icon-btn svg { width: 22px; height: 22px; }

#cart-badge {
  position: absolute;
  top: 2px; right: 2px;
  width: 18px; height: 18px;
  background: #f9db6f;
  color: #1a1206;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  pointer-events: none;
}

/* ---------- Overlay + Drawer ---------- */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(2px);
}
.cart-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.cart-drawer {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 100%;
  max-width: 460px;
  background: #FAFAF8;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -8px 0 40px rgba(0,0,0,0.2);
}
.cart-overlay.open .cart-drawer {
  transform: translateX(0);
}

.cart-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #E8E4DE;
  background: #FFFFFF;
  flex-shrink: 0;
}
.cart-drawer-title {
  font-size: 18px;
  font-weight: 700;
  color: #141412;
  letter-spacing: -0.02em;
}
.cart-close-btn {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #6B6560;
  cursor: pointer;
  background: none; border: none;
  transition: background 0.2s;
}
.cart-close-btn:hover { background: #F0EBE0; }
.cart-close-btn svg { width: 20px; height: 20px; }

/* ---------- Cart view ---------- */
#cart-view { display: flex; flex-direction: column; flex: 1; overflow: hidden; }

#cart-items-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Cart-specific hidden override (prevents specificity conflict with display:flex) */
#cart-empty[hidden]    { display: none !important; }
#cart-footer[hidden]   { display: none !important; }
#cart-view[hidden]     { display: none !important; }
#checkout-view[hidden] { display: none !important; }

.cart-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 24px;
  color: #A39E98;
  text-align: center;
}
.cart-empty p { font-size: 15px; color: #6B6560; }

.cart-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  background: #FFFFFF;
  border: 1px solid #E8E4DE;
  border-radius: 12px;
}
.cart-item-thumb {
  width: 64px; height: 64px;
  border-radius: 8px;
  background: #F0EBE0;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #A39E98;
  overflow: hidden;
}
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-nome {
  font-size: 14px;
  font-weight: 600;
  color: #141412;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cart-item-details { font-size: 12px; color: #6B6560; margin-bottom: 2px; }
.cart-item-arte { font-size: 11px; color: #A39E98; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.cart-item-preco { font-size: 15px; font-weight: 700; color: #9C5115; }
.cart-item-remove {
  width: 32px; height: 32px; flex-shrink: 0;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: #A39E98; cursor: pointer;
  background: none; border: none;
  transition: background 0.2s, color 0.2s;
}
.cart-item-remove:hover { background: #FEE2E2; color: #C0392B; }
.cart-item-remove svg { width: 16px; height: 16px; }

.cart-footer {
  padding: 16px 24px 24px;
  border-top: 1px solid #E8E4DE;
  background: #FFFFFF;
  flex-shrink: 0;
}
.cart-subtotal {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 15px;
  color: #141412;
}
.cart-subtotal strong { font-size: 20px; font-weight: 700; }

/* ---------- Checkout view ---------- */
#checkout-view {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 32px;
}
.checkout-flow { max-width: 100%; }

.ck-tipo-bar {
  display: flex;
  gap: 6px;
  background: #F0EBE0;
  border-radius: 10px;
  padding: 4px;
}
.ck-tipo-btn {
  flex: 1;
  padding: 9px 12px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  color: #6B6560;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.ck-tipo-btn.active {
  background: #FFFFFF;
  color: #141412;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.ck-resumo-mini-inner {
  background: #F0EBE0;
  border: 1px solid #D4C8B4;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 20px;
}

.ck-frete-opcao {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1.5px solid #E8E4DE;
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.2s;
}
.ck-frete-opcao:has(input:checked) { border-color: #9C5115; background: #FDF1E3; }
.ck-frete-opcao input[type="radio"] { flex-shrink: 0; accent-color: #9C5115; }
.ck-frete-info { flex: 1; }
.ck-frete-nome { font-size: 13px; font-weight: 600; color: #141412; display: block; }
.ck-frete-prazo { font-size: 12px; color: #6B6560; display: block; margin-top: 2px; }
.ck-frete-preco { font-size: 14px; font-weight: 700; color: #141412; white-space: nowrap; }

/* ---------- Barra de ação no produto ---------- */
.cart-product-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 800;
  background: #FFFFFF;
  border-top: 1px solid #E8E4DE;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.1);
  padding: 12px 20px;
}
.cart-product-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1200px;
  margin: 0 auto;
}
.cart-product-bar-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.cart-product-bar-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
@media (max-width: 600px) {
  .cart-product-bar-inner { flex-direction: column; gap: 8px; }
  .cart-product-bar-actions { width: 100%; }
  .cart-product-bar-actions .btn { flex: 1; justify-content: center; }
}

/* ---------- Toast de confirmação ---------- */
.cart-toast {
  position: fixed;
  bottom: 100px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #141412;
  color: #FFF;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  z-index: 1200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
}
.cart-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Botão "Adicionar ao carrinho" no price-panel ---------- */
.btn-cart-add {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: var(--radius-full, 999px);
  font-size: 13px;
  font-weight: 600;
  color: #9C5115;
  background: #FDF1E3;
  border: 1.5px solid #B6D9C2;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  white-space: nowrap;
}
.btn-cart-add:hover { background: #D4EDDA; border-color: #9C5115; }

/* When cart-add-btn present: let actions wrap to 3 buttons */
.price-panel-actions:has(#cart-add-btn) {
  flex-wrap: wrap;
}
.price-panel-actions #cart-add-btn {
  order: 10;
  flex-basis: 100%;
  justify-content: center;
}

/* ---------- Payment info block ---------- */
.ck-pagamento-info {
  background: #F0EBE0;
  border: 1px solid #D4C8B4;
  border-radius: 10px;
  padding: 14px 16px;
  margin: 0 0 4px;
}
.ck-pag-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: #FFFFFF;
  border: 1px solid #D4C8B4;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: #141412;
}

/* ---------- Payment method selection (clickable) ---------- */
.ck-pag-opcoes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.ck-pag-btn-cart {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #FFFFFF;
  border: 1.5px solid #D4C8B4;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  color: #141412;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  text-align: left;
}
.ck-pag-btn-cart:hover { border-color: #9C5115; }
.ck-pag-btn-cart.active { border-color: #9C5115; background: #FDF1E3; }
.ck-pag-btn-cart .ck-pag-icone { font-size: 18px; line-height: 1; flex-shrink: 0; }
.ck-pag-btn-cart .ck-pag-icone img { width: 22px; height: 22px; object-fit: contain; display: block; }

/* ---------- Aviso de desconto Pix no carrinho ---------- */
.ck-pix-aviso-cart {
  background: #DCFCE7;
  border: 1px solid #86EFAC;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 12px;
  color: #166534;
  margin-top: 10px;
  line-height: 1.5;
}

/* ---------- Frete: aviso manual (sem cálculo automático) ---------- */
.ck-frete-nota {
  background: #F0EBE0;
  border: 1px solid #D4C8B4;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 12px;
  color: #6B6560;
  margin: 0 0 4px;
  line-height: 1.5;
}

/* ---------- Back button in checkout ---------- */
.ck-back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #6B6560;
  margin-bottom: 18px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.2s;
}
.ck-back-btn:hover { color: #141412; }

/* ---------- Ajuste: FAB fica acima quando barra está ativa ---------- */
body.has-product-bar .whatsapp-fab { bottom: 88px; }

/* ===== MOBILE — carrinho ===== */
@media (max-width: 768px) {
  /* Drawer ocupa a tela toda */
  .cart-drawer { max-width: 100%; width: 100%; }

  .cart-drawer-header { padding: 14px 16px; }
  .cart-footer { padding: 14px 16px 20px; }

  /* Itens: nome/detalhes longos não podem empurrar o preço para fora */
  .cart-item { gap: 10px; padding: 12px; }
  .cart-item-thumb { width: 52px; height: 52px; flex-shrink: 0; }
  .cart-item-info { flex: 1; min-width: 0; overflow: hidden; }
  .cart-item-nome {
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .cart-item-details,
  .cart-item-arte {
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
  }
  .cart-item-preco { font-size: 15px; white-space: nowrap; }

  .cart-subtotal { flex-wrap: wrap; gap: 4px; }
  .cart-subtotal strong { font-size: 18px; }

  /* Botões do rodapé em coluna, largura total */
  .cart-footer .btn { width: 100%; justify-content: center; font-size: 15px; padding: 14px; }

  /* Formulário de checkout dentro do drawer */
  .ck-pag-opcoes { grid-template-columns: 1fr; }
  .cart-checkout-form .form-input { font-size: 16px; } /* 16px evita zoom automático no iOS */
}
