/**
 * ======================================================
 * ARCHIVO: cart.css
 * UBICACIÓN: frontend-public/css/
 * VERSIÓN: 1.2 — ESTILOS COMPLETOS DEL CARRITO
 * ÚLTIMA ACTUALIZACIÓN: 2026-05-31 09:00
 *
 * 🎯 PROPÓSITO:
 * Estilos del carrito flotante, modal de checkout y botones.
 *
 * ======================================================
 * 📋 REGLAS PARA PRODUCCIÓN:
 * ------------------------------------------------------
 * - Console.log marcados con // @strip se eliminan
 * - Esta cabecera se elimina en build para cliente
 *
 * ======================================================
 * 📋 HISTORIAL DE CAMBIOS:
 * ------------------------------------------------------
 * [1.2] - 2026-05-31 09:00
 *    ✅ MEJORAS: Botón flotante más atractivo
 *    ✅ MEJORAS: Modal con animación y scroll suave
 *    ✅ AÑADIDO: Responsive para móviles
 *
 * [1.1] - 2026-05-31 08:45
 *    ✅ Mejoras visuales generales
 *
 * [1.0] - 2026-05-30 20:30
 *    ✅ Versión inicial
 * ======================================================
 */

/* ======================================================
 * BOTÓN FLOTANTE DEL CARRITO
 * ====================================================== */

.cart-float {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #25D366, #128C7E);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  font-size: 28px;
}

.cart-float:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 25px rgba(37, 211, 102, 0.4);
}

.cart-float:active {
  transform: scale(0.95);
}

.cart-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  border-radius: 50%;
  min-width: 22px;
  height: 22px;
  font-size: 11px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* ======================================================
 * MODAL DE CHECKOUT
 * ====================================================== */

.checkout-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.checkout-modal[style*="display: flex"] {
  opacity: 1;
  visibility: visible;
}

.checkout-modal-content {
  background: var(--baby-white);
  width: 90%;
  max-width: 550px;
  max-height: 85vh;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-hover);
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.checkout-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--card-edge);
  background: linear-gradient(135deg, var(--theme-soft), var(--theme-strong));
}

.checkout-modal-header h3 {
  margin: 0;
  color: white;
  font-size: 1.2rem;
}

.checkout-modal-close {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: white;
  transition: all 0.2s;
  line-height: 1;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.checkout-modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

.checkout-modal-body {
  padding: 24px;
  max-height: calc(85vh - 70px);
  overflow-y: auto;
}

/* ======================================================
 * FORMULARIO DEL MODAL
 * ====================================================== */

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: var(--text);
  font-size: 0.9rem;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--card-edge);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  transition: all 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--theme-strong);
  box-shadow: 0 0 0 3px rgba(66, 165, 245, 0.1);
}

/* ======================================================
 * RESUMEN DEL CARRITO EN MODAL
 * ====================================================== */

.cart-summary {
  background: var(--baby-beige);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin: 20px 0;
}

.cart-summary h4 {
  margin: 0 0 12px;
  font-size: 1rem;
  color: var(--text);
}

.cart-items-list {
  max-height: 200px;
  overflow-y: auto;
}

.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  font-size: 0.9rem;
}

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

.cart-item span:first-child {
  flex: 2;
}

.cart-item span:last-child {
  font-weight: 600;
  color: var(--accent-price);
}

.cart-total {
  text-align: right;
  padding: 12px 0 0;
  margin-top: 8px;
  border-top: 2px solid var(--card-edge);
  font-size: 1.1rem;
}

.cart-total strong {
  font-size: 1.2rem;
  color: var(--accent-price);
}

/* ======================================================
 * BOTONES DEL MODAL
 * ====================================================== */

.modal-buttons {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.modal-buttons .btn-secondary {
  background: #e0e0e0;
  color: var(--text);
  border: none;
  padding: 12px 20px;
  border-radius: 30px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  flex: 1;
}

.modal-buttons .btn-secondary:hover {
  background: #c0c0c0;
  transform: translateY(-2px);
}

.modal-buttons .btn-primary {
  background: linear-gradient(135deg, var(--theme-soft), var(--theme-strong));
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 30px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  flex: 1;
}

.modal-buttons .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

/* ======================================================
 * BOTONES EN PRODUCTOS (AGREGAR AL CARRITO)
 * ====================================================== */

.btn-add-cart {
  background: linear-gradient(135deg, #25D366, #128C7E);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 30px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  margin: 0 18px 18px;
  width: calc(100% - 36px);
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-add-cart:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
}

.btn-add-cart:active {
  transform: scale(0.98);
}

.btn-remove-cart {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn-remove-cart:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

/* ======================================================
 * SCROLLBAR DEL MODAL
 * ====================================================== */

.checkout-modal-body::-webkit-scrollbar {
  width: 6px;
}

.checkout-modal-body::-webkit-scrollbar-track {
  background: var(--baby-beige);
  border-radius: 10px;
}

.checkout-modal-body::-webkit-scrollbar-thumb {
  background: var(--theme-soft);
  border-radius: 10px;
}

.checkout-modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--theme-strong);
}

/* ======================================================
 * RESPONSIVE: MÓVILES
 * ====================================================== */

@media (max-width: 520px) {
  .cart-float {
    bottom: 70px;
    right: 15px;
    width: 50px;
    height: 50px;
    font-size: 22px;
  }
  
  .checkout-modal-content {
    width: 95%;
    max-height: 90vh;
  }
  
  .checkout-modal-header {
    padding: 14px 18px;
  }
  
  .checkout-modal-body {
    padding: 18px;
  }
  
  .modal-buttons {
    flex-direction: column;
    gap: 10px;
  }
  
  .modal-buttons .btn-secondary,
  .modal-buttons .btn-primary {
    width: 100%;
  }
  
  .btn-add-cart {
    padding: 8px 14px;
    font-size: 13px;
  }
  
  .cart-item {
    font-size: 0.85rem;
    flex-wrap: wrap;
  }
  
  .cart-item span:first-child {
    flex: 1;
    margin-bottom: 4px;
  }
}

/* ======================================================
 * SEGURIDAD: Safe area para iOS
 * ====================================================== */

@supports (padding: max(0px)) {
  .cart-float {
    right: max(15px, env(safe-area-inset-right));
    bottom: max(70px, env(safe-area-inset-bottom));
  }
}