/* ============================================================
   CART — Cleopatra Store
   Sistema de Carrinho Premium
   ============================================================ */

/* ---- Badge do carrinho no header ---- */
.cart-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: transparent;
  border: 1.5px solid rgba(23, 17, 15, 0.15);
  border-radius: 50%;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  flex-shrink: 0;
}

.cart-btn:hover {
  border-color: var(--gold-dark);
  background: rgba(229, 178, 32, 0.08);
  transform: scale(1.05);
}

.cart-btn svg {
  width: 20px;
  height: 20px;
  stroke: var(--ink);
  transition: stroke 0.2s;
}

.cart-btn:hover svg {
  stroke: var(--gold-dark);
}

.cart-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: linear-gradient(135deg, var(--gold-main), var(--gold-dark));
  color: #fff;
  font-family: "Inter", sans-serif;
  font-size: 0.62rem;
  font-weight: 800;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0);
  transition: opacity 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
              transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(201, 155, 63, 0.45);
  border: 2px solid #fff;
}

.cart-badge.visible {
  opacity: 1;
  transform: scale(1);
}

.cart-badge.pop {
  animation: badgePop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes badgePop {
  0%  { transform: scale(0.7); }
  60% { transform: scale(1.25); }
  100%{ transform: scale(1); }
}

/* ---- Overlay / Backdrop ---- */
.cart-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(23, 17, 15, 0.52);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.cart-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* ---- Sidebar Drawer ---- */
.cart-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1200;
  width: min(440px, 100vw);
  display: flex;
  flex-direction: column;
  background: var(--cream);
  box-shadow: -8px 0 40px rgba(23, 17, 15, 0.18);
  transform: translateX(110%);
  transition: transform 0.42s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.cart-sidebar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: linear-gradient(to bottom, var(--gold-main), var(--gold-dark), transparent);
  opacity: 0.7;
}

.cart-sidebar.open {
  transform: translateX(0);
}

/* ---- Header do Sidebar ---- */
.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px 20px;
  border-bottom: 1px solid rgba(23, 17, 15, 0.08);
  flex-shrink: 0;
  background: var(--cream);
}

.cart-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cart-header-title h2 {
  font-family: "Cinzel", serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
  letter-spacing: 0.06em;
}

.cart-header-title svg {
  width: 22px;
  height: 22px;
  stroke: var(--gold-dark);
}

.cart-count-label {
  font-family: "Inter", sans-serif;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.04em;
}

.cart-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(23, 17, 15, 0.12);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.cart-close-btn:hover {
  background: rgba(23, 17, 15, 0.06);
  border-color: rgba(23, 17, 15, 0.22);
  transform: rotate(90deg);
}

.cart-close-btn svg {
  width: 18px;
  height: 18px;
  stroke: var(--ink);
}

/* ---- Lista de Itens ---- */
.cart-items-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
  scroll-behavior: smooth;
}

.cart-items-list::-webkit-scrollbar {
  width: 4px;
}

.cart-items-list::-webkit-scrollbar-track {
  background: transparent;
}

.cart-items-list::-webkit-scrollbar-thumb {
  background: rgba(201, 155, 63, 0.35);
  border-radius: 99px;
}

/* ---- Estado Vazio ---- */
.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 60px 24px;
  text-align: center;
}

.cart-empty svg {
  width: 64px;
  height: 64px;
  stroke: rgba(23, 17, 15, 0.18);
}

.cart-empty p {
  font-family: "Inter", sans-serif;
  font-size: 0.95rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

.cart-empty strong {
  display: block;
  font-family: "Cinzel", serif;
  font-size: 1rem;
  color: var(--ink);
  margin-bottom: 4px;
}

.cart-empty-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 26px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--gold-main), var(--gold-dark));
  color: #fff;
  font-family: "Inter", sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  transition: box-shadow 0.2s, transform 0.15s;
  margin-top: 8px;
}

.cart-empty-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(201, 155, 63, 0.38);
}

/* ---- Item do Carrinho ---- */
.cart-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 0;
  border-bottom: 1px solid rgba(23, 17, 15, 0.07);
  transition: opacity 0.3s ease, transform 0.3s ease, max-height 0.35s ease;
  overflow: hidden;
  max-height: 200px;
}

.cart-item.removing {
  opacity: 0;
  transform: translateX(40px);
  max-height: 0;
  padding: 0;
  border: none;
}

.cart-item-img {
  width: 76px;
  height: 76px;
  object-fit: contain;
  border-radius: 8px;
  background: #f5ecdf;
  flex-shrink: 0;
  border: 1px solid rgba(23, 17, 15, 0.06);
}

.cart-item-details {
  flex: 1;
  min-width: 0;
}

.cart-item-name {
  font-family: "Inter", sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
  margin: 0 0 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cart-item-price {
  font-family: "Inter", sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 10px;
}

.cart-item-installments {
  font-family: "Inter", sans-serif;
  font-size: 0.7rem;
  color: var(--muted);
  margin: 0 0 12px;
}

.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 0;
}

.cart-qty-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid rgba(23, 17, 15, 0.15);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  transition: border-color 0.2s, background 0.2s, transform 0.1s;
  line-height: 1;
  flex-shrink: 0;
}

.cart-qty-btn:hover {
  border-color: var(--gold-dark);
  background: rgba(229, 178, 32, 0.1);
  transform: scale(1.1);
}

.cart-qty-btn:active {
  transform: scale(0.95);
}

.cart-qty-value {
  font-family: "Inter", sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
  min-width: 32px;
  text-align: center;
}

.cart-item-remove {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-left: auto;
  transition: background 0.2s, transform 0.15s;
  flex-shrink: 0;
  align-self: flex-start;
}

.cart-item-remove:hover {
  background: rgba(220, 50, 50, 0.1);
  transform: scale(1.1);
}

.cart-item-remove svg {
  width: 15px;
  height: 15px;
  stroke: #cc4444;
}

/* ---- Rodapé do Carrinho (Totais + Ações) ---- */
.cart-footer {
  flex-shrink: 0;
  border-top: 1px solid rgba(23, 17, 15, 0.08);
  padding: 20px 24px 28px;
  background: var(--cream);
}

/* Campo de Cupom */
.cart-coupon {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.cart-coupon-input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid rgba(23, 17, 15, 0.14);
  border-radius: 8px;
  font-family: "Inter", sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.cart-coupon-input::placeholder {
  text-transform: none;
  letter-spacing: 0;
  color: #bbb;
  font-weight: 400;
}

.cart-coupon-input:focus {
  border-color: var(--gold-dark);
  box-shadow: 0 0 0 3px rgba(229, 178, 32, 0.12);
}

.cart-coupon-btn {
  padding: 10px 16px;
  border-radius: 8px;
  border: 1.5px solid rgba(23, 17, 15, 0.14);
  background: #fff;
  font-family: "Inter", sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: border-color 0.2s, background 0.2s;
  white-space: nowrap;
}

.cart-coupon-btn:hover {
  border-color: var(--gold-dark);
  background: rgba(229, 178, 32, 0.08);
}

.cart-coupon-msg {
  font-family: "Inter", sans-serif;
  font-size: 0.75rem;
  margin: -12px 0 14px;
  font-weight: 500;
  min-height: 18px;
}

.cart-coupon-msg.success { color: #2e7d32; }
.cart-coupon-msg.error   { color: #c62828; }

/* Linhas de Resumo */
.cart-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.cart-summary-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: "Inter", sans-serif;
  font-size: 0.85rem;
  color: var(--muted);
}

.cart-summary-line.discount {
  color: #2e7d32;
  font-weight: 600;
}

.cart-summary-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 14px;
  border-top: 1.5px solid rgba(23, 17, 15, 0.1);
  margin-bottom: 20px;
}

.cart-summary-total span:first-child {
  font-family: "Cinzel", serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.05em;
}

.cart-total-price {
  font-family: "Inter", sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--ink);
}

.cart-total-pix {
  font-family: "Inter", sans-serif;
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 500;
  text-align: right;
  margin-top: -18px;
  margin-bottom: 18px;
}

/* Botão WhatsApp */
.cart-whatsapp-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px 24px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, #25D366, #128C7E);
  color: #fff;
  font-family: "Inter", sans-serif;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  text-decoration: none;
  transition: box-shadow 0.25s, transform 0.15s;
  box-shadow: 0 6px 24px rgba(37, 211, 102, 0.3);
}

.cart-whatsapp-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 32px rgba(37, 211, 102, 0.42);
}

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

.cart-whatsapp-btn svg {
  width: 22px;
  height: 22px;
  fill: #fff;
  flex-shrink: 0;
}

.cart-continue-btn {
  display: block;
  width: 100%;
  padding: 12px;
  margin-top: 10px;
  border-radius: 10px;
  border: 1.5px solid rgba(23, 17, 15, 0.12);
  background: transparent;
  color: var(--muted);
  font-family: "Inter", sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.2s, color 0.2s;
}

.cart-continue-btn:hover {
  border-color: var(--gold-dark);
  color: var(--ink);
}

/* ---- Toast Notification ---- */
.cart-toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 2000;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 20px;
  background: var(--ink);
  color: #fff;
  border-radius: 50px;
  font-family: "Inter", sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 8px 32px rgba(23, 17, 15, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cart-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.cart-toast-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-main), var(--gold-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cart-toast-icon svg {
  width: 12px;
  height: 12px;
  stroke: #fff;
  stroke-width: 3;
}

/* Mobile adjustments */
@media (max-width: 560px) {
  .cart-sidebar {
    width: 100vw;
    border-radius: 20px 20px 0 0;
    top: auto;
    bottom: 0;
    height: 92dvh;
    transform: translateY(110%);
  }

  .cart-sidebar.open {
    transform: translateY(0);
  }

  .cart-sidebar::before {
    width: 100%;
    height: 3px;
    top: 0;
    left: 0;
    background: linear-gradient(to right, transparent, var(--gold-main), var(--gold-dark), transparent);
  }

  .cart-btn {
    display: none !important;
  }

  .cart-toast {
    bottom: 88px;
    font-size: 0.78rem;
    padding: 11px 18px;
  }

  /* Header: esconder "Comprar agora" e mostrar carrinho */
  .header-action {
    display: none;
  }
}

/* No mobile bottom nav: o botão central vira ícone de carrinho */
.nav-cart-center svg {
  stroke: var(--gold-dark);
}

/* Shake animation no badge ao adicionar */
@keyframes shake {
  0%, 100% { transform: scale(1) rotate(0deg); }
  25%       { transform: scale(1.2) rotate(-8deg); }
  50%       { transform: scale(1.1) rotate(8deg); }
  75%       { transform: scale(1.15) rotate(-4deg); }
}

.cart-btn.shake {
  animation: shake 0.4s ease;
}
