/* ====================================================
   NOVAMIA — Carrito lateral deslizable (slide-out)
   ==================================================== */

/* Overlay oscuro */
.cart-sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(44, 32, 37, 0.5);
  backdrop-filter: blur(3px);
  z-index: 3999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}
.cart-sidebar-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* Panel lateral */
.cart-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  max-width: 100vw;
  height: 100vh;
  background: #fff;
  z-index: 4000;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -8px 0 40px rgba(44,32,37,0.18);
}
.cart-sidebar.open {
  transform: translateX(0);
}

/* Header del carrito */
.cart-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 24px 20px;
  border-bottom: 1px solid var(--gray-light);
  background: var(--cream);
}
.cart-sidebar-header h3 {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 500;
  color: var(--dark);
  display: flex;
  align-items: center;
  gap: 10px;
}
.cart-sidebar-close {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray);
  font-size: 1rem;
  transition: var(--transition);
  border: 1.5px solid var(--gray-light);
}
.cart-sidebar-close:hover {
  background: var(--rose-light);
  border-color: var(--rose-dark);
  color: var(--rose-dark);
}

/* Lista de ítems */
.cart-sidebar-items {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  scroll-behavior: smooth;
}
.cart-sidebar-items::-webkit-scrollbar {
  width: 4px;
}
.cart-sidebar-items::-webkit-scrollbar-thumb {
  background: var(--gray-light);
  border-radius: 2px;
}
.cart-sidebar-items::-webkit-scrollbar-thumb:hover {
  background: var(--purple-light);
}

/* Vacío */
.cart-sidebar-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 16px;
  text-align: center;
  padding: 40px 24px;
}
.cart-empty-icon {
  font-size: 3rem;
  opacity: 0.5;
}
.cart-sidebar-empty p {
  color: var(--gray);
  font-size: 0.95rem;
}
.cart-sidebar-empty .btn-primary {
  margin-top: 8px;
}

/* Ítem del carrito */
.cart-sidebar-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 12px;
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  background: var(--cream);
  transition: var(--transition);
  animation: slideInItem 0.3s ease;
}
@keyframes slideInItem {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
.cart-sidebar-item:hover {
  background: var(--purple-pale);
}
.cart-item-thumb {
  width: 60px; height: 60px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  border: 1px solid var(--gray-light);
}
.cart-item-info {
  flex: 1;
  min-width: 0;
}
.cart-item-name {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}
.cart-item-price {
  display: block;
  font-size: 0.82rem;
  color: var(--rose-dark);
  font-weight: 500;
  margin-bottom: 8px;
}
.cart-item-qty {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1.5px solid var(--gray-light);
  border-radius: 6px;
  overflow: hidden;
  width: fit-content;
  background: #fff;
}
.qty-btn {
  width: 28px; height: 28px;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--purple-dark);
  background: var(--purple-pale);
  transition: var(--transition);
  flex-shrink: 0;
}
.qty-btn:hover {
  background: var(--purple);
  color: #fff;
}
.qty-num {
  min-width: 28px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--dark);
  padding: 0 4px;
  border-left: 1.5px solid var(--gray-light);
  border-right: 1.5px solid var(--gray-light);
}
.cart-item-remove {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--gray);
  border: 1.5px solid var(--gray-light);
  flex-shrink: 0;
  transition: var(--transition);
}
.cart-item-remove:hover {
  background: var(--rose-light);
  border-color: var(--rose-dark);
  color: var(--rose-dark);
}

/* Footer del carrito */
.cart-sidebar-footer {
  padding: 20px 20px 28px;
  border-top: 1px solid var(--gray-light);
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cart-sidebar-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1rem;
  font-weight: 600;
  color: var(--dark);
  padding-bottom: 14px;
  border-bottom: 1px solid var(--gray-light);
  margin-bottom: 4px;
}
.cart-total-price {
  color: var(--purple-dark);
  font-size: 1.1rem;
}

/* Animación bounce al agregar */
@keyframes cartBounce {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.4); }
  60%  { transform: scale(0.9); }
  80%  { transform: scale(1.1); }
  100% { transform: scale(1); }
}
.cart-count.bounce {
  animation: cartBounce 0.5s ease;
}

/* Previene scroll del body cuando el carrito está abierto */
body.cart-open {
  overflow: hidden;
}

/* ====================================================
   RESPONSIVE
   ==================================================== */
@media (max-width: 480px) {
  .cart-sidebar {
    width: 100vw;
  }
}
