/* ===== CARRINHO — DRAWER LATERAL ===== */

/* ---------- OVERLAY (fundo escuro) ---------- */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  z-index: 400;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
}
.cart-overlay.show {
  opacity: 1;
  pointer-events: all;
}

/* ---------- DRAWER ---------- */
.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100dvh;
  width: 420px;
  max-width: 100vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 401;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .32s cubic-bezier(.4,0,.2,1);
  will-change: transform;
}
.cart-drawer.open {
  transform: translateX(0);
}

/* ---------- HEADER ---------- */
.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.cart-header-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.cart-header h3 {
  font-size: 1rem;
  font-weight: 700;
}
.cart-header-icon {
  color: var(--green);
}
.cart-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, transform .15s;
}
.cart-close:hover {
  background: var(--border);
  transform: rotate(90deg);
}

/* ---------- BODY (scroll) ---------- */
.cart-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0;
}
.cart-body::-webkit-scrollbar { width: 4px; }
.cart-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ---------- ITEM ---------- */
.cart-item {
  display: flex;
  gap: 0.9rem;
  padding: 0.9rem 1.4rem;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  transition: background .15s;
}
.cart-item:hover { background: rgba(0,0,0,0.02); }

.cart-item-img {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.cart-item-body {
  flex: 1;
  min-width: 0;
}
.cart-item-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cart-item-ticket {
  font-size: 0.8rem;
  color: var(--green);
  margin-bottom: 0.2rem;
}
.cart-item-date {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: var(--text-sec);
  margin-bottom: 0.6rem;
}

.cart-item-bottom {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Qty selector */
.cart-qty-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.15rem 0.4rem;
}
.cart-qty-btn {
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .15s;
}
.cart-qty-btn:hover { color: var(--green); }
.cart-qty-num {
  font-size: 0.85rem;
  font-weight: 600;
  min-width: 16px;
  text-align: center;
}

.cart-item-price {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  margin-left: auto;
}
.cart-remove-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-sec);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .15s, border-color .15s, background .15s;
}
.cart-remove-btn:hover {
  color: #f44336;
  border-color: rgba(244,67,54,0.3);
  background: rgba(244,67,54,0.08);
}

/* ---------- VAZIO ---------- */
.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 4rem 2rem;
  color: var(--text-sec);
  text-align: center;
}
.cart-empty p {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 0.5rem;
}
.cart-empty span {
  font-size: 0.82rem;
}

/* ---------- FOOTER ---------- */
.cart-footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 1.4rem;
  flex-shrink: 0;
  background: rgba(0,0,0,0.02);
}
.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.cart-total-row span:first-child {
  font-size: 0.9rem;
  color: var(--text-sec);
}
#cartTotal {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--green);
}
.cart-checkout-btn {
  width: 100%;
  padding: 0.875rem;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: opacity .2s, transform .1s;
  margin-bottom: 0.75rem;
}
.cart-checkout-btn:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
}
.cart-checkout-btn:disabled {
  background: var(--surface2);
  color: var(--text-sec);
  cursor: not-allowed;
  border: 1px solid var(--border);
  transform: none;
}
.cart-security {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-sec);
}

/* ---------- FAB (botão flutuante lateral) ---------- */
.cart-fab {
  position: fixed;
  right: 0;
  bottom: 5rem;
  z-index: 300;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 12px 0 0 12px;
  padding: 0.85rem 0.6rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  box-shadow: -4px 4px 20px rgba(0,230,118,0.25);
  transition: padding .2s, background .15s;
}
.cart-fab:hover {
  padding-right: 0.9rem;
  background: var(--green-dim);
}

/* Badge no FAB */
.cart-fab .cart-badge {
  background: var(--text);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* Badge no navbar */
.cart-nav-btn {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .15s, color .15s;
  flex-shrink: 0;
}
.cart-nav-btn:hover {
  border-color: var(--green);
  color: var(--green);
}
.cart-nav-btn .cart-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--green);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

/* ---------- TOAST ---------- */
.cart-toast {
  position: fixed;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: #fff;
  border: 1px solid var(--green);
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  font-size: 0.88rem;
  z-index: 9999;
  opacity: 0;
  transition: opacity .25s, transform .25s;
  white-space: nowrap;
  max-width: 90vw;
  text-align: center;
}
.cart-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- BODY LOCK ---------- */
body.cart-open {
  overflow: hidden;
}

/* ---------- RESPONSIVO ---------- */
@media (max-width: 480px) {
  .cart-drawer {
    width: 100vw;
    border-left: none;
  }
  .cart-fab {
    bottom: 5.5rem; /* acima da mobile bar do evento */
  }
}
