/* ============================================
   CARRITO LATERAL — Entrega 2
   Agregar al final de styles.css
   ============================================ */

/* Overlay oscuro detrás del panel */
.carrito-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1500;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
}

.carrito-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Panel lateral */
.carrito-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 420px;
  height: 100vh;
  background: var(--white);
  z-index: 1600;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s ease;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.15);
}

.carrito-panel.active {
  transform: translateX(0);
}

/* Header */
.carrito-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  border-bottom: 1px solid var(--gray-border);
  background: var(--white);
  flex-shrink: 0;
}

.carrito-header h3 {
  font-size: 1.25rem;
  margin: 0;
}

.carrito-close {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--gray-bg);
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--gray-text);
  transition: all var(--transition);
}

.carrito-close:hover {
  background: var(--navy);
  color: var(--white);
}

/* Body — scrolleable */
.carrito-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.5rem;
}

/* Carrito vacío */
.carrito-vacio {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1rem;
  color: var(--gray-text);
}

.carrito-vacio-icono {
  color: var(--gray-border);
  margin-bottom: 1.25rem;
}

.carrito-vacio p {
  font-family: 'Barlow', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--black);
  margin-bottom: 0.4rem;
}

.carrito-vacio span {
  font-size: 0.88rem;
  color: var(--gray-text);
}

/* Items del carrito */
.carrito-item {
  display: flex;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--gray-border);
}

.carrito-item:last-child {
  border-bottom: none;
}

.carrito-item-img {
  width: 80px;
  height: 80px;
  background: var(--gray-bg);
  border-radius: var(--radius);
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
}

.carrito-item-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.carrito-item-info {
  flex: 1;
  min-width: 0;
}

.carrito-item-info h4 {
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
  line-height: 1.3;
}

.carrito-item-precio {
  font-family: 'Barlow', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 0.6rem;
}

.carrito-item-controles {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

/* Versión pequeña del selector de cantidad */
.cantidad-selector-sm .cantidad-btn {
  width: 30px;
  height: 30px;
  font-size: 1rem;
}

.cantidad-selector-sm input {
  width: 36px;
  height: 30px;
  font-size: 0.85rem;
}

.carrito-item-eliminar {
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: var(--gray-text);
  cursor: pointer;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.carrito-item-eliminar:hover {
  background: #fee;
  color: #c00;
}

/* Footer del carrito */
.carrito-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--gray-border);
  background: var(--white);
  flex-shrink: 0;
}

.carrito-footer:empty {
  display: none;
}

.carrito-resumen {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  font-family: 'Barlow', sans-serif;
}

.carrito-resumen span {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--gray-text);
}

.carrito-resumen strong {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--navy);
}

.carrito-nota {
  font-size: 0.8rem;
  color: var(--gray-text);
  margin-bottom: 1rem;
  line-height: 1.4;
}

.carrito-footer .btn {
  width: 100%;
  justify-content: center;
}

.btn-link {
  background: transparent;
  color: var(--gray-text);
  border: none;
  font-size: 0.82rem;
  padding: 0.6rem;
  margin-top: 0.5rem;
  text-decoration: underline;
}

.btn-link:hover {
  color: #c00;
}

.btn-success {
  background: #16a34a !important;
}

.btn-success:hover {
  background: #15803d !important;
}

/* Responsive */
@media (max-width: 480px) {
  .carrito-panel {
    max-width: 100%;
  }

  .carrito-item-img {
    width: 64px;
    height: 64px;
  }
}
