/**
 * SUPERPRECIO - CART HEADER REDESIGN
 * Version: 3.0.0
 * Fecha: 2025-01-30
 *
 * REDISEÑO COMPLETO de la sección "Tu pedido"
 * Basado en análisis de UX/UI y simplificación de paleta de colores
 *
 * CAMBIOS PRINCIPALES:
 * - Eliminar tonos turquesa confusos
 * - Simplificar a verde de marca puro
 * - Mejorar jerarquía visual del header
 * - Más personalidad y menos genérico
 */

/* =============================================
   PALETA DE COLORES SIMPLIFICADA
   ============================================= */

:root {
  /* Verde SuperPrecio - ÚNICA fuente de verdad */
  --sp-green-primary: #136213;
  --sp-green-dark: #0d4a0d;
  --sp-green-light: #e8f5e8;
  --sp-green-extra-light: #f0fdf4;

  /* Amarillo/Ámbar - Mejor precio (mantener) */
  --sp-amber-primary: #f59e0b;
  --sp-amber-light: #fde68a;
  --sp-amber-pale: #fef3c7;
  --sp-amber-dark: #d97706;

  /* Gold para badges */
  --sp-gold-light: #fbbf24;
  --sp-gold-dark: #f59e0b;
}

/* =============================================
   CRITICAL: Eliminar tonos turquesa erróneos
   Reemplazar con verde de marca
   ============================================= */

/* Winner card - VERDE PURO en lugar de turquesa */
.sp-winner-card {
  background: linear-gradient(135deg, var(--sp-green-primary) 0%, var(--sp-green-dark) 100%) !important;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 32px rgba(19, 98, 19, 0.3),
              0 2px 8px rgba(0, 0, 0, 0.1);
}

.sp-winner-card::before {
  background: radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.15), transparent 50%);
}

/* =============================================
   REDISEÑO: Sección "Tu pedido"
   De genérico a premium con personalidad
   ============================================= */

.sp-cart-page__header {
  /* Background con gradiente suave verde */
  background: linear-gradient(135deg,
    var(--sp-green-extra-light) 0%,
    white 100%) !important;

  /* Border más prominente con verde de marca */
  border: 2px solid var(--sp-green-light) !important;
  border-left: 6px solid var(--sp-green-primary) !important; /* Borde izquierdo más grueso */

  /* Sombra más dramática para elevación */
  box-shadow: 0 4px 20px rgba(19, 98, 19, 0.08),
              0 1px 3px rgba(0, 0, 0, 0.05) !important;

  /* Espaciado generoso */
  padding: 1.75rem 1.5rem !important;
  border-radius: 16px !important;

  /* Transición suave */
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* Grid layout mejorado */
  display: flex !important;
  justify-content: space-between !important;
  align-items: flex-start !important;
  gap: 1.5rem !important;
}

.sp-cart-page__header:hover {
  box-shadow: 0 8px 32px rgba(19, 98, 19, 0.12),
              0 2px 8px rgba(0, 0, 0, 0.08) !important;
  border-left-width: 8px !important;
  transform: translateX(2px);
}

/* =============================================
   MEJORAS: Título y subtítulo
   Más prominente y con mejor jerarquía
   ============================================= */

.sp-cart-page__title-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Agregar icono de carrito antes del título */
.sp-cart-page__title-section::before {
  content: '🛒';
  font-size: 2.5rem;
  line-height: 1;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.sp-cart-page__title {
  font-size: clamp(1.75rem, 2vw + 1rem, 2.5rem) !important; /* 28px-40px */
  font-weight: 800 !important; /* Extra bold */
  letter-spacing: -0.03em !important;
  color: var(--sp-green-primary) !important;
  margin: 0 !important;
  line-height: 1.2 !important;

  /* Sutil text shadow para profundidad */
  text-shadow: 0 1px 2px rgba(19, 98, 19, 0.1);
}

.sp-cart-page__subtitle {
  font-size: clamp(0.95rem, 1vw + 0.75rem, 1.125rem) !important; /* 15px-18px */
  font-weight: 500 !important; /* Medium en lugar de normal */
  color: #6b7280 !important; /* Gris neutral más moderno */
  margin: 0 !important;
  line-height: 1.5 !important;
}

/* Badge de contador de productos */
#cart-count-text {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Número destacado dentro del subtítulo */
.sp-cart-page__subtitle strong,
.sp-cart-page__subtitle b {
  color: var(--sp-green-primary) !important;
  font-weight: 700 !important;
  font-variant-numeric: tabular-nums;
  padding: 0.125rem 0.375rem;
  background: var(--sp-green-extra-light);
  border-radius: 6px;
  border: 1px solid var(--sp-green-light);
}

/* =============================================
   MEJORAS: Botón "Vaciar carrito"
   Diseño más moderno y menos agresivo
   ============================================= */

.sp-cart-page__clear-btn {
  /* Layout mejorado */
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.5rem !important;

  /* Espaciado */
  padding: 0.75rem 1.25rem !important;
  min-height: 44px !important;

  /* Colores - rojo suave en lugar de outline-danger */
  background: white !important;
  border: 2px solid #ef4444 !important;
  color: #dc2626 !important;

  /* Tipografía */
  font-weight: 600 !important;
  font-size: 0.9375rem !important; /* 15px */

  /* Bordes */
  border-radius: 10px !important;

  /* Sombra sutil */
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.1) !important;

  /* Transición */
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;

  /* Flexbox para no shrinkear */
  flex-shrink: 0 !important;
}

.sp-cart-page__clear-btn:hover {
  background: #fef2f2 !important; /* Rojo muy claro */
  border-color: #dc2626 !important;
  color: #b91c1c !important;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2) !important;
  transform: translateY(-2px);
}

.sp-cart-page__clear-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(239, 68, 68, 0.2) !important;
}

.sp-cart-page__clear-btn i {
  font-size: 1.125rem !important;
}

/* =============================================
   RESPONSIVE: Mobile optimizations
   ============================================= */

@media (max-width: 640px) {
  .sp-cart-page__header {
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 1.25rem 1rem !important;
    gap: 1rem !important;
  }

  .sp-cart-page__title-section::before {
    font-size: 2rem;
    margin-bottom: 0.25rem;
  }

  .sp-cart-page__title {
    font-size: 1.5rem !important; /* 24px en mobile */
  }

  .sp-cart-page__subtitle {
    font-size: 0.9375rem !important; /* 15px en mobile */
  }

  .sp-cart-page__clear-btn {
    width: 100% !important;
    justify-content: center !important;
  }

  /* Ocultar texto "Vaciar" solo en mobile muy pequeño */
  @media (max-width: 374px) {
    .sp-hide-mobile {
      display: none !important;
    }

    .sp-cart-page__clear-btn {
      padding: 0.75rem !important;
      min-width: 44px;
    }
  }
}

/* Tablet */
@media (min-width: 641px) and (max-width: 1024px) {
  .sp-cart-page__header {
    padding: 1.5rem 1.25rem !important;
  }
}

/* =============================================
   ACCESSIBILITY
   ============================================= */

.sp-cart-page__clear-btn:focus-visible {
  outline: 3px solid #dc2626 !important;
  outline-offset: 3px !important;
}

@media (prefers-reduced-motion: reduce) {
  .sp-cart-page__header,
  .sp-cart-page__clear-btn {
    transition: none !important;
  }

  .sp-cart-page__header:hover,
  .sp-cart-page__clear-btn:hover {
    transform: none !important;
  }
}

@media (prefers-contrast: high) {
  .sp-cart-page__header {
    border-width: 3px !important;
    border-left-width: 8px !important;
  }

  .sp-cart-page__clear-btn {
    border-width: 3px !important;
  }
}

/* =============================================
   DARK MODE OVERRIDE
   Forzar modo claro en cart page
   ============================================= */

@media (prefers-color-scheme: dark) {
  .sp-cart-page__header {
    background: linear-gradient(135deg,
      var(--sp-green-extra-light) 0%,
      white 100%) !important;
    color: #212529 !important;
  }

  .sp-cart-page__title {
    color: var(--sp-green-primary) !important;
  }

  .sp-cart-page__subtitle {
    color: #6b7280 !important;
  }
}

/* =============================================
   PRINT STYLES
   ============================================= */

@media print {
  .sp-cart-page__header {
    background: white !important;
    box-shadow: none !important;
    border: 2px solid #e5e7eb !important;
    border-left: 4px solid var(--sp-green-primary) !important;
  }

  .sp-cart-page__clear-btn {
    display: none !important;
  }

  .sp-cart-page__title-section::before {
    filter: grayscale(100%);
  }
}

/* =============================================
   ANIMACIÓN DE ENTRADA
   Suave slide-in cuando se carga la página
   ============================================= */

@keyframes cart-header-slide-in {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.sp-cart-page__header {
  animation: cart-header-slide-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (prefers-reduced-motion: reduce) {
  .sp-cart-page__header {
    animation: none;
  }
}
