/* ============================= */
/* CARRITO DE COMPRAS            */
/* ============================= */

/* Badge sobre el ícono */
.carrito-icono-wrap {
  position: relative;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.carrito-badge {
  position: absolute;
  top: -8px;
  right: -9px;
  min-width: 18px;
  height: 18px;
  background: var(--celeste-acento);
  color: white;
  font-size: 10px;
  font-weight: 800;
  border-radius: 50px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid white;
  line-height: 1;
}

.carrito-badge.visible {
  display: flex;
}

.navbar.scrolled .carrito-badge {
  border-color: white;
}

/* Overlay */
.carrito-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1100;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.carrito-overlay.active {
  display: block;
  opacity: 1;
}

/* Panel lateral */
.carrito-panel {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  max-width: 100vw;
  height: 100vh;
  background: white;
  z-index: 1101;
  display: flex;
  flex-direction: column;
  transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.18);
}

.carrito-panel.active {
  right: 0;
}

/* Header */
.carrito-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  background: linear-gradient(135deg, #07152f, #0a1f44);
  color: white;
  flex-shrink: 0;
}

.carrito-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.carrito-header-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--celeste-acento);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.carrito-header-icon svg {
  width: 22px;
  height: 22px;
  stroke: white;
}

.carrito-header-titulo {
  font-weight: 700;
  font-size: 15px;
}

.carrito-header-conteo {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.65);
  margin-top: 2px;
}

.carrito-close {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}

.carrito-close:hover {
  background: rgba(255, 255, 255, 0.22);
}

.carrito-close svg {
  width: 18px;
  height: 18px;
  stroke: white;
}

/* Área de items */
.carrito-items {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Carrito vacío */
.carrito-vacio {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 40px 20px;
  text-align: center;
}

.carrito-vacio svg {
  width: 62px;
  height: 62px;
  stroke: rgba(10, 31, 68, 0.15);
}

.carrito-vacio p {
  font-size: 14px;
  color: rgba(10, 31, 68, 0.4);
  line-height: 1.7;
}

/* Item */
.carrito-item {
  display: flex;
  gap: 12px;
  align-items: center;
  background: #f8fbff;
  border-radius: 12px;
  padding: 12px;
  border: 1px solid rgba(10, 31, 68, 0.07);
  animation: itemSlideIn 0.25s ease;
}

@keyframes itemSlideIn {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: translateX(0); }
}

.carrito-item-img {
  width: 62px;
  height: 62px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

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

.carrito-item-nombre {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--azul-principal);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.carrito-item-precio {
  font-size: 13px;
  color: var(--celeste-acento);
  font-weight: 600;
  margin-top: 3px;
}

.carrito-item-controles {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 9px;
}

.ctrl-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1.5px solid rgba(10, 31, 68, 0.18);
  background: white;
  color: var(--azul-principal);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.2s;
  line-height: 1;
}

.ctrl-btn:hover {
  background: var(--azul-principal);
  color: white;
  border-color: var(--azul-principal);
}

.ctrl-cantidad {
  font-size: 14px;
  font-weight: 700;
  color: var(--azul-principal);
  min-width: 22px;
  text-align: center;
}

.carrito-item-eliminar {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(10, 31, 68, 0.28);
  padding: 5px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  transition: color 0.2s, background 0.2s;
  flex-shrink: 0;
}

.carrito-item-eliminar:hover {
  color: #ff4d4d;
  background: rgba(255, 77, 77, 0.09);
}

.carrito-item-eliminar svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
}

/* Footer */
.carrito-footer {
  border-top: 1px solid #e8edf4;
  padding: 16px 20px 22px;
  background: white;
  flex-shrink: 0;
}

.carrito-total-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.carrito-total-label {
  font-size: 14px;
  color: var(--gris-texto);
}

.carrito-total-valor {
  font-size: 22px;
  font-weight: 800;
  color: var(--azul-principal);
}

.carrito-btn-checkout {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, #00c2ff, #009ed6);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.2s, transform 0.2s;
  margin-bottom: 8px;
  box-shadow: 0 4px 16px rgba(0, 194, 255, 0.25);
}

.carrito-btn-checkout:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.carrito-btn-checkout svg {
  width: 18px;
  height: 18px;
  stroke: white;
}

.carrito-btn-vaciar {
  width: 100%;
  padding: 9px;
  background: transparent;
  border: 1.5px solid rgba(10, 31, 68, 0.14);
  color: rgba(10, 31, 68, 0.45);
  border-radius: 10px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.carrito-btn-vaciar:hover {
  border-color: #ff4d4d;
  color: #ff4d4d;
}

/* Feedback visual al agregar */
.btn-carrito.agregado {
  background: #2ed573 !important;
}

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