/* DespedidoPorIA — design tokens + componentes custom
 *
 * Tokens (CSS variables) reflejan el sistema de diseño aprobado.
 * Tailwind atómico cubre el grueso; este archivo agrega:
 *   1. Tokens (colores, escala, sombras, radios, transiciones).
 *   2. Componentes complejos (problema-card, timeline, testimonio-card,
 *      garantia-card, FAQ details, calculadora inputs).
 *   3. Animaciones (fade-up, bounce-subtle, pulse-glow).
 */

/* ============================================================ */
/* 1. TOKENS                                                    */
/* ============================================================ */
:root {
  --navy-900:  #0A1628;
  --navy-800:  #0E1F3A;
  --navy-700:  #1A2D4F;
  --navy-100:  #E8ECF3;

  --amber-600: #C8821F;
  --amber-500: #E8A33D;
  --amber-400: #F0B559;
  --amber-100: #FBEED4;

  --beige-100: #FAF6EE;
  --beige-200: #F4ECDD;
  --beige-300: #E5DAC4;

  --success:   #16A34A;
  --warning:   #DC2626;
  --info:      #0EA5E9;

  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  1.875rem;
  --text-4xl:  2.25rem;
  --text-5xl:  3rem;
  --text-6xl:  4rem;
  --text-7xl:  5rem;

  --shadow-sm:  0 1px 2px rgba(10,22,40,0.05);
  --shadow-md:  0 4px 6px -1px rgba(10,22,40,0.1), 0 2px 4px -2px rgba(10,22,40,0.1);
  --shadow-lg:  0 10px 15px -3px rgba(10,22,40,0.1), 0 4px 6px -4px rgba(10,22,40,0.1);
  --shadow-xl:  0 20px 25px -5px rgba(10,22,40,0.1), 0 8px 10px -6px rgba(10,22,40,0.1);
  --shadow-2xl: 0 25px 50px -12px rgba(10,22,40,0.25);

  --radius-sm:   0.375rem;
  --radius-md:   0.5rem;
  --radius-lg:   0.75rem;
  --radius-xl:   1rem;
  --radius-2xl:  1.5rem;
  --radius-full: 9999px;

  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================ */
/* 2. BASE + ACCESIBILIDAD                                       */
/* ============================================================ */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none;
}
body, p, span, li, div, a, button, input, textarea, select {
  font-family: 'Inter', system-ui, sans-serif;
}
h1, h2, h3, h4, h5, h6 {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
}

/* Focus visible custom (accesibilidad sin perder estética) */
:focus-visible {
  outline: 2px solid var(--amber-500);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* sr-only / focus-visible utility (skip-to-content) */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
.focus\:not-sr-only:focus {
  position: fixed; width: auto; height: auto; padding: 0.5rem 1rem;
  margin: 0; overflow: visible; clip: auto; white-space: normal;
}

/* ============================================================ */
/* 3. NAVBAR                                                     */
/* ============================================================ */
#navbar {
  background-color: rgba(244, 236, 221, 0);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  border-bottom: 1px solid transparent;
}
#navbar.navbar-scrolled {
  background-color: rgba(244, 236, 221, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(10,22,40,0.06);
  box-shadow: var(--shadow-sm);
}

/* Compensar el navbar fijo para que los anchors no queden tapados */
section[id] { scroll-margin-top: 80px; }

/* ============================================================ */
/* 4. ANIMACIONES                                                */
/* ============================================================ */

/* Fade-up animation reveal */
[data-animate="fade-up"] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--transition-slow), transform var(--transition-slow);
}
[data-animate="fade-up"].in-view {
  opacity: 1;
  transform: translateY(0);
}

/* Bounce sutil del indicador "ver cómo funciona" */
@keyframes bounce-subtle {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(6px); }
}
.animate-bounce-subtle { animation: bounce-subtle 2.2s ease-in-out infinite; }

/* Pulse del status dot del chat header */
@keyframes pulse-glow {
  0%   { box-shadow: 0 0 0 0    rgba(22,163,74,0.55); }
  70%  { box-shadow: 0 0 0 8px  rgba(22,163,74,0);    }
  100% { box-shadow: 0 0 0 0    rgba(22,163,74,0);    }
}

/* Pulse del CTA final del §10 (sutil cada 4s) */
@keyframes pulse-soft {
  0%, 92%, 100% { transform: translateY(0); box-shadow: var(--shadow-xl); }
  96% { transform: translateY(-2px); box-shadow: var(--shadow-2xl); }
}
#final-cta-primary { animation: pulse-soft 4s ease-in-out infinite; }
#final-cta-primary:hover { animation: none; }

/* ============================================================ */
/* 5. CARDS — §4 PROBLEMA                                        */
/* ============================================================ */
.problema-card {
  display: flex;
  gap: 1rem;
  background: white;
  padding: 1.5rem;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(10,22,40,0.04);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}
.problema-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}
.problema-card-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  background: var(--amber-100);
  color: var(--amber-600);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================================ */
/* 6. CALCULADORA — §5                                            */
/* ============================================================ */
.calc-input {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid var(--beige-300);
  border-radius: var(--radius-lg);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--navy-900);
  background: white;
  outline: none;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}
.calc-input:focus {
  border-color: var(--amber-500);
  box-shadow: 0 0 0 4px rgba(232,163,61,0.15);
}
.calc-step-btn {
  width: 44px;
  background: var(--beige-200);
  border: 2px solid var(--beige-300);
  color: var(--navy-800);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition-base);
}
.calc-step-btn:hover { background: var(--beige-300); }
.calc-step-btn[data-step="-1"] { border-right: 0; }
.calc-step-btn[data-step="1"]  { border-left: 0; }
#calc-years.calc-input { border-radius: 0; }

#calc-result {
  animation: slide-down 300ms ease-out;
}
@keyframes slide-down {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0);    }
}

/* Quitar las flechas spinner del input number */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none; margin: 0;
}
input[type="number"] { -moz-appearance: textfield; }

/* ============================================================ */
/* 7. TIMELINE — §6                                              */
/* ============================================================ */
.timeline-step {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.timeline-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--navy-800);
  color: white;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: var(--text-2xl);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  position: relative;
  z-index: 1;
  box-shadow: 0 0 0 6px var(--beige-100);
  transition: transform var(--transition-base), background var(--transition-base);
}
.timeline-step:hover .timeline-circle {
  background: var(--amber-500);
  color: var(--navy-900);
  transform: scale(1.06);
}
.timeline-card {
  background: white;
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  text-align: left;
  width: 100%;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}
.timeline-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.timeline-badge {
  display: inline-block;
  background: var(--amber-100);
  color: var(--amber-600);
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
}

/* Mobile: ocultar línea horizontal, mostrar vertical en cada step */
@media (max-width: 767px) {
  .timeline-step { margin-bottom: 1.5rem; }
  .timeline-circle { margin-bottom: 1rem; }
}

/* ============================================================ */
/* 8. TESTIMONIOS — §7                                           */
/* ============================================================ */
.testimonio-card {
  background: var(--navy-700);
  border: 1px solid rgba(232,236,243,0.1);
  border-radius: var(--radius-2xl);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: transform var(--transition-base), border-color var(--transition-base);
  min-width: 85%;
}
@media (min-width: 768px) {
  .testimonio-card { min-width: auto; }
}
.testimonio-card:hover {
  transform: translateY(-4px);
  border-color: rgba(232,163,61,0.4);
}
.testimonio-stars {
  display: flex;
  gap: 2px;
}
.testimonio-quote {
  font-size: var(--text-lg);
  line-height: 1.55;
  color: white;
  font-style: italic;
  flex: 1;
}
.testimonio-bottom {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(232,236,243,0.1);
}
.testimonio-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--amber-500);
  color: var(--navy-900);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: var(--text-sm);
}
.testimonio-meta { flex: 1; min-width: 0; }
.testimonio-name { font-weight: 600; font-size: var(--text-base); color: white; }
.testimonio-role { font-size: var(--text-xs); color: rgba(255,255,255,0.65); }
.testimonio-verified {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--success);
  flex-shrink: 0;
}
.testimonio-amount {
  display: inline-block;
  background: var(--amber-100);
  color: var(--amber-600);
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-full);
  align-self: flex-start;
}

/* Dots indicador del carousel mobile */
.testimonio-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  border: none;
  cursor: pointer;
  transition: background var(--transition-base), transform var(--transition-base);
}
.testimonio-dot.active {
  background: var(--amber-500);
  transform: scale(1.3);
}

/* Hide scrollbar on testimonios mobile carousel */
#testimonios-track::-webkit-scrollbar { display: none; }
#testimonios-track { scrollbar-width: none; -ms-overflow-style: none; }

/* ============================================================ */
/* 9. GARANTÍAS — §8                                             */
/* ============================================================ */
.garantia-card {
  background: white;
  border-radius: var(--radius-2xl);
  padding: 2rem;
  text-align: center;
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}
.garantia-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}
.garantia-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  margin: 0 auto 1.25rem;
  background: var(--amber-100);
  color: var(--amber-600);
  border-radius: var(--radius-2xl);
}

/* ============================================================ */
/* 10. FAQ ACCORDION — §9                                         */
/* ============================================================ */
.faq-item {
  background: var(--beige-100);
  border-radius: var(--radius-xl);
  padding: 0;
  transition: background var(--transition-base);
  border: 1px solid transparent;
}
.faq-item[open] {
  background: var(--beige-200);
  border-color: rgba(232,163,61,0.25);
}
.faq-summary {
  padding: 1.25rem 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-weight: 600;
  font-size: var(--text-lg);
  color: var(--navy-900);
  list-style: none;
  user-select: none;
}
.faq-summary::-webkit-details-marker { display: none; }
.faq-chevron {
  color: var(--navy-800);
  flex-shrink: 0;
  transition: transform var(--transition-base);
}
.faq-item[open] .faq-chevron {
  transform: rotate(180deg);
  color: var(--amber-500);
}
.faq-body {
  padding: 0 1.5rem 1.5rem;
  color: var(--navy-800);
  line-height: 1.65;
  font-size: var(--text-base);
}

/* ============================================================ */
/* 11. STICKY CTA MOBILE                                         */
/* ============================================================ */
#sticky-cta {
  position: fixed;
  bottom: 16px;
  left: 16px;
  right: 16px;
  z-index: 998;
  animation: slide-up-in 250ms ease-out;
}
#sticky-cta.hidden { display: none; }
@keyframes slide-up-in {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
/* Si el chat panel está abierto en mobile (full-screen), ocultar sticky CTA */
@media (max-width: 640px) {
  body:has(.chat-panel:not(.hidden)) #sticky-cta { display: none; }
  /* Y subir el FAB para no chocar con el sticky CTA */
  body:has(#sticky-cta:not(.hidden)) .chat-fab { bottom: 88px; }
}
