/* ===========================
   ====== MODAL CARRITO ======
   =========================== */

.modal-carrito {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 2000;
  overflow-y: auto;
}

.modal-carrito.activo {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.carrito-contenido {
  background-color: var(--color-secondary);
  border-radius: 12px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.carrito-header {
  padding: 1.5rem;
  border-bottom: 2px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background-color: var(--color-secondary);
  z-index: 10;
}

.carrito-header h2 {
  margin: 0;
  font-size: 1.75rem;
  color: var(--color-text);
  font-family: 'Playfair Display', serif;
  font-weight: 600;
}

.cerrar-carrito {
  font-size: 2rem;
  color: var(--color-text-light);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.cerrar-carrito:hover {
  color: var(--color-text);
  transform: scale(1.1);
}

.carrito-body {
  padding: 1.5rem;
}

.carrito-vacio {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--color-text-light);
}

.carrito-vacio svg {
  width: 80px;
  height: 80px;
  margin-bottom: 1rem;
  opacity: 0.3;
}

.carrito-items {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.carrito-item {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background-color: var(--color-light);
  border-radius: 8px;
  border: 1px solid var(--color-border);
  transition: var(--transition);
}

.carrito-item:hover {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-sm);
}

.item-imagen {
  width: 80px;
  height: 80px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}

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

.item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.item-nombre {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  margin: 0;
}

.item-medida {
  font-size: 0.85rem;
  color: var(--color-text-light);
}

.item-cantidad {
  font-size: 0.85rem;
  color: var(--color-text-light);
}

.item-derecha {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.5rem;
}

.item-precio {
  font-size: 1.35rem;
  font-weight: 400;
  color: var(--color-accent);
}

.btn-eliminar {
  background-color: #dc3545;
  color: white;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  font-size: 1.2rem;
  font-weight: 600;
}

.btn-eliminar:hover {
  background-color: #c82333;
  transform: scale(1.1);
}

.carrito-total {
  padding: 1rem;
  background-color: var(--color-light);
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  border: 2px solid var(--color-accent);
}

.carrito-total span {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text);
}

.carrito-total strong {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-accent);
  white-space: nowrap;
}

.nombre-input-container {
  margin-bottom: 1.5rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-direction: row;
}

.nombre-input-wrapper {
  flex: 1;
  position: relative;
}

.nombre-input {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid var(--color-border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: 'Montserrat', sans-serif;
  transition: var(--transition);
}

.nombre-input:focus {
  outline: none;
  border-color: var(--color-accent);
}

.btn-guardar-nombre {
  background-color: var(--color-accent);
  color: white;
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.btn-guardar-nombre:hover {
  background-color: #218838;
  transform: scale(1.05);
}

.btn-guardar-nombre svg {
  width: 20px;
  height: 20px;
}

.mensaje-guardado {
  position: absolute;
  top: -35px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #28a745;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.85rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.mensaje-guardado.mostrar {
  opacity: 1;
}

.carrito-footer {
  padding: 1.5rem;
  border-top: 2px solid var(--color-border);
  background-color: var(--color-secondary);
}

.info-whatsapp {
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--color-text-light);
  position: relative;
}

.btn-info {
  background: none;
  border: 1px solid var(--color-border);
  color: var(--color-text-light);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  transition: var(--transition);
  position: relative;
}

.btn-info:hover {
  background-color: var(--color-accent);
  color: white;
  border-color: var(--color-accent);
}

.tooltip-info {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #2a1f14;
  color: white;
  padding: 1rem;
  border-radius: 8px;
  width: 280px;
  max-width: calc(100vw - 2rem);
  font-size: 0.85rem;
  line-height: 1.5;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  display: none;
}

.tooltip-info::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 12px;
  height: 12px;
  background-color: #2a1f14;
}

.tooltip-info.mostrar {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.carrito-acciones {
  display: flex;
  gap: 1rem;
}

.btn-finalizar {
  flex: 1;
  padding: 1rem;
  background-color: var(--color-accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: var(--shadow-sm);
}

.btn-finalizar:hover {
  background-color: #ba943b;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-finalizar svg {
  width: 20px;
  height: 20px;
}

.btn-cancelar-carrito {
  padding: 1rem 1.5rem;
  background-color: var(--color-border);
  color: var(--color-text);
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-cancelar-carrito:hover {
  background-color: #a89279;
  transform: translateY(-2px);
}

/* Responsive */
@media (max-width: 768px) {
  .carrito-contenido {
    max-width: 100%;
    border-radius: 0;
    max-height: 100vh;
  }

  .carrito-header h2 {
    font-size: 1.5rem;
  }

  .item-imagen {
    width: 70px;
    height: 70px;
  }

  .item-nombre {
    font-size: 0.95rem;
  }

  .item-precio {
    font-size: 1.2rem;
  }

  .carrito-total span {
    font-size: 1.3rem;
  }

  .carrito-total strong {
    font-size: 1.3rem;
  }
}

@media (max-width: 480px) {
  .modal-carrito.activo {
    padding: 0;
  }

  .carrito-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .item-imagen {
    width: 100%;
    height: 180px;
  }

  .item-derecha {
    flex-direction: row;
    width: 100%;
    align-items: center;
    justify-content: space-between;
  }

  .carrito-acciones {
    flex-direction: column;
  }

  .btn-cancelar-carrito {
    width: 100%;
  }

  .nombre-input-container {
    flex-direction: row;
  }

  .info-whatsapp {
    justify-content: center;
  }

  .tooltip-info {
    position: absolute;
    bottom: 100%;
    margin-bottom: 10px;
    top: auto;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: calc(100vw - 3rem);
    max-width: 320px;
  }

  .tooltip-info::after {
    display: block;
    bottom: -6px;
    top: auto;
    left: 50%;
    right: auto;
    transform: translateX(-50%) rotate(45deg);
    margin-top: 0;
  }
}