/**
 * Purewell — Componentes Reutilizables (Ligeros)
 *
 * Este archivo centraliza los estilos de componentes reutilizables pequeños
 * que se utilizan frecuentemente en el sitio.
 *
 * Componentes pesados (package-selector, buyNow-button) se cargan condicionalmente.
 *
 * @version 1.0
 * @date 2025-11-17
 */

/* ============================================
   CTA BUTTON PREMIUM
   ============================================ */

.pw-cta-wrapper * {
  box-sizing: border-box;
}

.pw-cta-premium {
  /* Layout robusto */
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 22px 36px;
  min-height: 68px;

  /* Tipografía ROBUSTA - anti-fallo */
  font-family: var(--pw-font-sans), -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #ffffff !important;
  text-decoration: none !important;
  white-space: nowrap;

  /* Rendering óptimo */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;

  /* Estructura */
  border: none;
  border-radius: 14px;
  cursor: pointer;
  overflow: visible;
  user-select: none;
  isolation: isolate;

  /* Gradiente llamativo usando variables globales */
  background: linear-gradient(
    135deg,
    var(--pw-primary) 0%,
    #6ea844 35%,
    #81c064 65%,
    var(--pw-primary) 100%
  );
  background-size: 300% 100%;
  animation: gradientFlow 5s ease-in-out infinite;

  /* Sombras profundas */
  box-shadow:
    0 6px 20px rgba(var(--pw-primary-rgb), 0.4),
    0 12px 40px rgba(var(--pw-primary-rgb), 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);

  /* Transiciones suaves */
  transition:
    transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.3s ease,
    filter 0.2s ease;

  /* Text shadow fuerte */
  text-shadow:
    0 2px 6px rgba(0, 0, 0, 0.4),
    0 0 30px rgba(255, 255, 255, 0.15);
}

/* Capa de brillo dinámico */
.pw-cta-premium::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    45deg,
    transparent 30%,
    rgba(255, 255, 255, 0.15) 50%,
    transparent 70%
  );
  background-size: 200% 200%;
  animation: shineMove 3s ease-in-out infinite;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}

/* Partículas flotantes */
.pw-cta-premium::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: radial-gradient(
      circle at 20% 50%,
      rgba(255, 255, 255, 0.8) 2px,
      transparent 2px
    ),
    radial-gradient(
      circle at 60% 70%,
      rgba(255, 255, 255, 0.6) 1px,
      transparent 1px
    ),
    radial-gradient(
      circle at 80% 30%,
      rgba(255, 255, 255, 0.7) 1.5px,
      transparent 1.5px
    ),
    radial-gradient(
      circle at 40% 80%,
      rgba(255, 255, 255, 0.5) 1px,
      transparent 1px
    );
  background-size: 100% 100%;
  animation: particlesFloat 6s ease-in-out infinite;
  opacity: 0;
  z-index: 2;
  pointer-events: none;
  transition: opacity 0.4s ease;
  mix-blend-mode: overlay;
}

/* Glow exterior */
.glow-ring {
  position: absolute;
  inset: -8px;
  border-radius: 20px;
  background: linear-gradient(
    90deg,
    var(--pw-secondary),
    #6ea844,
    var(--pw-secondary)
  );
  background-size: 200% 100%;
  opacity: 0;
  filter: blur(16px);
  z-index: -1;
  animation: glowPulse 4s ease-in-out infinite;
  transition: opacity 0.4s ease;
}

/* Texto del botón */
.pw-cta-premium > span {
  position: relative;
  z-index: 10;
  display: inline-block;
  color: #ffffff !important;
}

/* Icono */
.pw-cta-premium .icon {
  position: relative;
  z-index: 10;
  display: inline-flex;
  font-size: 24px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.3s ease;
}

/* Hover state */
.pw-cta-premium:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25), 
              0 16px 48px rgba(var(--pw-primary-rgb), 0.85),
              inset 0 1px 0 rgba(255, 255, 255, 0.3);
  filter: brightness(1.1);
  color: #ffffff;
}

.pw-cta-premium:hover::before {
  opacity: 1;
  animation: shineMove 1.5s ease-in-out infinite;
}

.pw-cta-premium:hover::after {
  opacity: 1;
}

.pw-cta-premium:hover .glow-ring {
  opacity: 1;
  filter: blur(24px);
}

.pw-cta-premium:hover .icon {
  transform: translateX(6px) rotate(-12deg) scale(1.1);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
}

/* Active state */
.pw-cta-premium:active {
  transform: translateY(-1px) scale(1);
  transition: all 0.1s ease;
}

/* Focus state */
.pw-cta-premium:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.8);
  outline-offset: 6px;
}

/* ============================================
   ANNOUNCEMENT BAR
   ============================================ */

.pw-announcement-bar {
  color: var(--pw-white);
  padding: 0.875rem 1rem;
  margin-top: var(--pw-space-6);
  margin-bottom: var(--pw-space-5);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  box-shadow: 0 6px 20px rgba(var(--pw-primary-rgb), 0.25),
              0 2px 8px rgba(86, 124, 57, 0.15);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  text-align: center;
  transform: translateZ(0);
  will-change: transform, box-shadow;
  animation: announcement-pulse 3s ease-in-out infinite;
}

.pw-announcement-bar--green {
  background: linear-gradient(135deg, var(--pw-primary) 0%, #567C39 100%);
}

.pw-announcement-bar__icon {
  font-size: 1.35rem;
  line-height: 1;
  display: inline;
  margin-right: 0.375rem;
  animation: announcement-icon-bounce 2400ms ease-in-out infinite;
}

.pw-announcement-bar__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  width: 100%;
}

.pw-announcement-bar__title {
  font-size: 1.0625rem;
  font-weight: var(--pw-font-weight-bold);
  line-height: 1.3;
  letter-spacing: -0.01em;
  display: block;
  width: 100%;
}

.pw-announcement-bar__subtitle {
  font-size: 0.875rem;
  font-weight: var(--pw-font-weight-medium);
  line-height: 1.35;
  opacity: 0.92;
  display: block;
  width: 100%;
}

/* ============================================
   HIGHLIGHT BOX
   ============================================ */

.pw-highlight-box {
  position: relative;
  background: linear-gradient(
    135deg,
    var(--pw-primary) 0%,
    #6ea844 50%,
    #81c064 100%
  );
  color: #ffffff;
  padding: var(--pw-space-8);
  border-radius: var(--pw-radius-lg);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.4),
    0 0 32px rgba(129, 192, 100, 0.25);
  /* Removido overflow: hidden para permitir sombras completas */
  animation: pw-highlight-box-bgFlow 10s ease-in-out infinite alternate;
  background-size: 200% 200%;
}

.pw-highlight-box--align-center {
  text-align: center;
}

.pw-highlight-box--align-right {
  text-align: right;
}

.pw-highlight-box--margin-small {
  margin: var(--pw-space-4) 0;
}

.pw-highlight-box--margin-default {
  margin: var(--pw-space-8) 0;
}

.pw-highlight-box--margin-large {
  margin: var(--pw-space-12) 0;
}

.pw-highlight-box::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    circle at 30% 20%,
    rgba(255, 255, 255, 0.12) 0%,
    transparent 70%
  );
  pointer-events: none;
  opacity: 0.6;
  animation: pw-highlight-box-glowPulse 6s ease-in-out infinite alternate;
}

.pw-highlight-box .pw-highlight-box__title {
  position: relative;
  z-index: 2;
  font-family: var(--pw-font-serif) !important;
  font-size: clamp(1.375rem, 3.5vw, 1.625rem) !important;
  font-weight: var(--pw-font-weight-bold) !important;
  color: #ffffff !important;
  margin-bottom: var(--pw-space-4);
  line-height: 1.3;
}

.pw-highlight-box .pw-highlight-box__text {
  position: relative;
  z-index: 2;
  font-family: var(--pw-font-sans) !important;
  font-size: clamp(1.0625rem, 2.5vw, 1.125rem) !important;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.95) !important;
  margin: 0;
}

/* Override para <strong> dentro del texto */
.pw-highlight-box .pw-highlight-box__text strong {
  font-family: var(--pw-font-serif) !important;
  font-weight: var(--pw-font-weight-bold) !important;
  color: #ffffff !important;
}

/* ============================================
   AMAZON BUTTON
   ============================================ */

.pw-amazon-button-wrapper {
    display: inline-block;
    width: 100%;
}

.pw-amazon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(to bottom, #f7dfa5, #f0c14b);
    border: 1px solid #a88734;
    border-radius: 8px;
    color: #111;
    font-family: 'Amazon Ember', Arial, sans-serif;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(213, 217, 217, 0.5);
}

.pw-amazon-button:hover {
    background: linear-gradient(to bottom, #f5d78e, #e7b933);
    border-color: #9c7e31;
    box-shadow: 0 4px 8px rgba(213, 217, 217, 0.7);
    transform: translateY(-1px);
}

.pw-amazon-button:active {
    background: linear-gradient(to bottom, #f0c14b, #e7b933);
    box-shadow: 0 1px 3px rgba(213, 217, 217, 0.5);
    transform: translateY(0);
}

.pw-amazon-button__logo {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    flex-shrink: 0;
    max-height: 20px;
    overflow: visible;
    margin-right: 4px;
}

.pw-amazon-button__logo svg {
    height: 20px !important;
    width: auto !important;
    max-width: none !important;
    display: block;
}

.pw-amazon-button__text {
    flex: 0 1 auto;
    white-space: nowrap;
}

.pw-amazon-button__arrow {
    flex-shrink: 0;
    stroke-width: 2.5;
    width: 16px;
    height: 16px;
}

/* Tamaños */
.pw-amazon-button--small {
    padding: 10px 18px;
    font-size: 14px;
    gap: 8px;
}

.pw-amazon-button--small .pw-amazon-button__logo {
    max-height: 16px;
}

.pw-amazon-button--small .pw-amazon-button__logo svg {
    height: 16px !important;
}

.pw-amazon-button--small .pw-amazon-button__arrow {
    width: 14px;
    height: 14px;
}

.pw-amazon-button--medium {
    padding: 14px 24px;
    font-size: 16px;
    gap: 12px;
}

.pw-amazon-button--large {
    padding: 18px 32px;
    font-size: 18px;
    gap: 14px;
}

.pw-amazon-button--large .pw-amazon-button__logo {
    max-height: 24px;
}

.pw-amazon-button--large .pw-amazon-button__logo svg {
    height: 24px !important;
}

.pw-amazon-button--large .pw-amazon-button__arrow {
    width: 18px;
    height: 18px;
}

/* Responsive */
@media (max-width: 768px) {
    .pw-amazon-button {
        font-size: 15px;
        padding: 12px 20px;
    }

    .pw-amazon-button__logo svg {
        height: 18px !important;
    }

    .pw-amazon-button--large {
        padding: 16px 28px;
        font-size: 17px;
    }
    
    .pw-amazon-button--large .pw-amazon-button__logo svg {
        height: 22px !important;
    }
}

@media (max-width: 480px) {
    .pw-amazon-button__text {
        font-size: 14px;
    }
    
    .pw-amazon-button--small .pw-amazon-button__text {
        font-size: 13px;
    }
}

.pw-amazon-button--logo-only {
    justify-content: center;
}

.pw-amazon-button--logo-only .pw-amazon-button__logo {
    margin: 0;
}

@keyframes gradientFlow {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

@keyframes shineMove {
  0%, 100% {
    background-position: -200% 0;
  }
  50% {
    background-position: 200% 0;
  }
}

@keyframes particlesFloat {
  0%, 100% {
    transform: translateY(0) scale(1);
    opacity: 0.3;
  }
  50% {
    transform: translateY(-10px) scale(1.1);
    opacity: 0.7;
  }
}

@keyframes glowPulse {
  0%, 100% {
    background-position: 0% 0%;
    transform: scale(0.95);
  }
  50% {
    background-position: 200% 0%;
    transform: scale(1.05);
  }
}

@keyframes announcement-pulse {
  0%, 100% { 
    box-shadow: 0 6px 20px rgba(var(--pw-primary-rgb), 0.25),
                0 2px 8px rgba(86, 124, 57, 0.15);
    transform: scale(1);
  }
  50% { 
    box-shadow: 0 8px 28px rgba(var(--pw-primary-rgb), 0.35),
                0 3px 12px rgba(86, 124, 57, 0.25);
    transform: scale(1.01);
  }
}

@keyframes announcement-icon-bounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-3px) scale(1.1); }
}

@keyframes pw-highlight-box-bgFlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes pw-highlight-box-glowPulse {
  0% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.02); }
  100% { opacity: 0.4; transform: scale(1); }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  /* CTA Button */
  .pw-cta-premium {
    font-size: 16px;
    padding: 18px 28px;
    min-height: 58px;
  }

  .pw-cta-premium .icon {
    font-size: 20px;
  }

  /* Announcement Bar */
  .pw-announcement-bar {
    padding: 0.75rem 0.875rem;
    border-radius: 12px;
    margin-top: var(--pw-space-4);
    margin-bottom: var(--pw-space-4);
    gap: 0.2rem;
    box-shadow: 0 4px 16px rgba(var(--pw-primary-rgb), 0.2),
                0 1px 6px rgba(86, 124, 57, 0.1);
  }

  .pw-announcement-bar__icon {
    font-size: 1.375rem;
    margin-right: 0.4rem;
  }

  .pw-announcement-bar__title {
    font-size: 1rem;
  }

  .pw-announcement-bar__subtitle {
    font-size: 0.8125rem;
  }

  /* Highlight Box */
  .pw-highlight-box {
    padding: var(--pw-space-6);
  }

  .pw-highlight-box__title {
    font-size: clamp(1.25rem, 4vw, 1.375rem);
  }

  .pw-highlight-box__text {
    font-size: clamp(1rem, 3vw, 1.0625rem);
  }
}

@media (max-width: 1023px) {
  .pw-announcement-bar__content {
    font-size: 0.8125rem;
    gap: var(--pw-space-1);
  }
}

/* ============================================
   CLASES UTILITARIAS DE PÁGINA
   ============================================ */

/* Títulos de Sección Estándar */
.pw-section-title {
  font-family: var(--pw-font-serif);
  font-size: clamp(1.875rem, 5vw, 2.5rem);
  font-weight: var(--pw-font-weight-black);
  color: var(--pw-primary);
  line-height: 1.3;
  margin: 0 0 var(--pw-space-10);
}

.pw-section-title--large {
  font-size: clamp(2rem, 5vw, 3rem);
}

.pw-section-title--centered {
  text-align: center;
}

/* Subtítulos de Sección */
.pw-section-subtitle {
  font-family: var(--pw-font-sans);
  font-size: clamp(1.125rem, 3vw, 1.25rem);
  color: var(--pw-text-secondary);
  margin: 0;
  line-height: 1.6;
}

/* Card Estándar con Hover */
.pw-card {
  background: var(--pw-white);
  border-radius: var(--pw-radius-lg);
  border: 2px solid rgba(84, 113, 49, 0.15);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
}

.pw-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 20px rgba(84, 113, 49, 0.15);
  border-color: var(--pw-primary);
}

.pw-card--elevated:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 32px rgba(84, 113, 49, 0.2);
}

/* Overlay común para fondos */
.pw-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.pw-overlay--gradient {
  background-image: radial-gradient(circle at 25% 25%, rgba(84, 113, 49, 0.03) 0%, transparent 50%),
                    radial-gradient(circle at 75% 75%, rgba(139, 94, 59, 0.03) 0%, transparent 50%);
}

/* Contenedor con z-index relativo */
.pw-container-rel {
  position: relative;
  z-index: 2;
}

/* Lista de Beneficios Estándar */
.pw-benefit-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--pw-space-3);
}

.pw-benefit-list li {
  display: flex;
  align-items: flex-start;
  gap: var(--pw-space-3);
  font-size: var(--pw-text-base);
  color: var(--pw-text);
  line-height: 1.6;
}

.pw-benefit-list svg {
  color: var(--pw-primary);
  flex-shrink: 0;
  margin-top: 2px;
}

/* Grid de 2 columnas responsive */
.pw-grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--pw-space-6);
}

@media (min-width: 768px) {
  .pw-grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Badges de Trust/Urgencia */
.pw-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--pw-space-2);
  padding: var(--pw-space-3) var(--pw-space-4);
  background: rgba(84, 113, 49, 0.05);
  border-radius: var(--pw-radius-md);
  border: 1px solid rgba(84, 113, 49, 0.2);
  font-size: var(--pw-text-sm);
  color: var(--pw-text);
}

.pw-badge svg {
  color: var(--pw-primary);
  flex-shrink: 0;
}

.pw-badge--urgency {
  background: linear-gradient(135deg, rgba(255, 87, 34, 0.05), rgba(255, 152, 0, 0.05));
  border-color: rgba(255, 87, 34, 0.2);
}

.pw-badge--urgency svg {
  color: #FF5722;
}

/* ============================================
   ACCESIBILIDAD
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  .pw-cta-premium,
  .pw-cta-premium::before,
  .pw-cta-premium::after,
  .glow-ring,
  .pw-announcement-bar,
  .pw-announcement-bar__icon,
  .pw-highlight-box,
  .pw-highlight-box::before {
    animation: none !important;
  }

  .pw-cta-premium {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }
}
