/* ─────────────────────────────── */
/* CARRITO FLOTANTE                */
/* ─────────────────────────────── */

.carrito-contenedor {
  position: fixed;
  right: 20px;
  bottom: 80px;
  width: 380px;
  background: var(--color-primario, #111);
  border: 1px solid var(--color-borde, #2e2e2e);
  border-radius: var(--radio-md, 12px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
  color: var(--color-texto);
  font-family: var(--fuente-base);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(0);
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
}

.carrito-contenedor.oculto {
  opacity: 0;
  pointer-events: none;
  transform: translateY(30px);
}

/* HEADER */
.carrito-header {
  background: var(--color-superficie, #222);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--color-borde, #2e2e2e);
}

.carrito-header h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.btn-cerrar {
  background: none;
  border: none;
  color: var(--color-texto-suave, #999);
  cursor: pointer;
  font-size: 1.3rem;
  transition: all 0.2s ease;
  padding: 4px;
  border-radius: 50%;
}

.btn-cerrar:hover {
  transform: rotate(90deg);
  color: var(--color-acento);
}

/* ITEMS */
.carrito-items {
  max-height: 320px;
  overflow-y: auto;
  padding: 10px;
  position: relative;
  scroll-behavior: smooth;
}

.carrito-item {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  gap: 10px;
  background: var(--color-superficie, #222);
  padding: 10px;
  border-radius: var(--radio-sm, 8px);
  border: 1px solid var(--color-borde, #2e2e2e);
  transition: border-color 0.2s ease;
}

.carrito-item:hover {
  border-color: rgba(255, 116, 0, 0.2);
}

.carrito-item img {
  width: 48px;
  height: 48px;
  border-radius: var(--radio-sm, 8px);
  object-fit: cover;
  flex-shrink: 0;
  background: #fff;
}

.carrito-item h4 {
  font-size: 0.85rem;
  margin: 0 0 4px;
  font-weight: 500;
  color: var(--color-texto);
}

.carrito-item .acciones {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-cantidad {
  background: var(--color-acento);
  border: none;
  color: #fff;
  border-radius: 6px;
  width: 24px;
  height: 24px;
  cursor: pointer;
  font-weight: bold;
  font-size: 0.85rem;
  transition: 0.2s;
}

.btn-cantidad:hover {
  opacity: 0.85;
  transform: scale(1.08);
}

.precio-unitario {
  color: var(--color-texto-suave, #999);
  font-size: 0.8rem;
  margin-bottom: 2px;
}

.subtotal {
  font-size: 0.85rem;
  color: var(--color-acento);
  font-weight: 600;
  margin-top: 2px;
}

.carrito-vacio {
  text-align: center;
  color: var(--color-texto-suave, #999);
  padding: 30px 10px;
  font-size: 0.9rem;
}

/* FOOTER */
.carrito-footer {
  background: var(--color-superficie, #222);
  padding: 12px 16px;
  border-top: 1px solid var(--color-borde, #2e2e2e);
  text-align: center;
}

.carrito-total {
  font-weight: 700;
  text-align: right;
  color: var(--color-texto);
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.btn-comprar {
  background: var(--color-acento);
  color: #fff;
  border: none;
  border-radius: var(--radio-sm, 8px);
  padding: 10px 0;
  width: 100%;
  font-size: 0.95rem;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.25s ease;
}

.btn-comprar:hover {
  background: var(--color-acento-hover, #ff8c2a);
  transform: translateY(-1px);
}

/* SCROLL CUSTOM */
#carritoItems {
  scrollbar-width: thin;
  scrollbar-color: var(--color-acento) var(--color-primario, #111);
}

#carritoItems::-webkit-scrollbar {
  width: 8px;
}

#carritoItems::-webkit-scrollbar-track {
  background: var(--color-primario, #111);
  border-radius: 8px;
}

#carritoItems::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--color-acento), #ff9640);
  border-radius: 8px;
  border: 2px solid var(--color-primario, #111);
}

#carritoItems::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #ff9640, var(--color-acento));
}

/* FADE SCROLL */
.carrito-items::before,
.carrito-items::after {
  content: "";
  position: sticky;
  left: 0;
  right: 0;
  height: 20px;
  z-index: 3;
  pointer-events: none;
}

.carrito-items::before {
  top: 0;
  background: linear-gradient(to bottom, rgba(17, 17, 17, 1) 0%, transparent 100%);
}

.carrito-items::after {
  bottom: 0;
  background: linear-gradient(to top, rgba(17, 17, 17, 1) 0%, transparent 100%);
}

#carritoItems:not(:has(.carrito-item:nth-child(3)))::before,
#carritoItems:not(:has(.carrito-item:nth-child(3)))::after {
  display: none;
}
