/* ===========================================================
   F·iT México · Registro
   Paleta del CRM: negro profundo + amarillo #F5C400
   Mobile-first, app-like. Contrato de datos intacto.
   =========================================================== */
:root {
  --bg:      #0c0c0d;
  --bg-2:    #101012;
  --card:    #161618;
  --card-2:  #1d1d20;   /* inputs / segmentos */
  --line:    rgba(255,255,255,.08);
  --line-2:  rgba(255,255,255,.16);

  --text:    #f4f4f5;
  --muted:   #9a9aa1;
  --faint:   #6c6c74;

  --yellow:  #F5C400;
  --yellow-2:#ffd62e;
  --yellow-700:#caa200;
  --ring:    rgba(245,196,0,.30);
  --green:   #34d27e;

  --ok-bg:   rgba(52,210,126,.12);  --ok-text:  #7ef0ad;  --ok-line:  rgba(52,210,126,.32);
  --err-bg:  rgba(243,108,98,.12);   --err-text: #ff9b93;  --err-line: rgba(243,108,98,.34);

  --radius:   24px;
  --radius-md:14px;
  --radius-sm:12px;

  --font:    "Inter", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  --display: "Space Grotesk", var(--font);

  --bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* ---------- Atmósfera ---------- */
.glow {
  position: fixed; inset: -20% -10% auto -10%; height: 70vh; z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(50% 60% at 78% 0%, rgba(245,196,0,.16), transparent 60%),
    radial-gradient(40% 50% at 12% 8%, rgba(245,196,0,.07), transparent 60%);
  animation: float 14s ease-in-out infinite alternate;
}
@keyframes float { from { transform: translateY(-12px); } to { transform: translateY(14px); } }
.grain {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Layout ---------- */
.page {
  position: relative; z-index: 1;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: clamp(14px, 4vw, 40px);
}

.card {
  position: relative;
  width: min(480px, 100%);
  background:
    linear-gradient(180deg, rgba(255,255,255,.03), transparent 40%),
    var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 40px 80px -40px rgba(0,0,0,.8);
  padding: clamp(22px, 5.5vw, 32px);
  animation: rise .6s cubic-bezier(.2,.7,.2,1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(.99); } to { opacity: 1; transform: none; } }

/* ---------- Marca ---------- */
.brand {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 20px;
}
.logo { display: flex; align-items: baseline; gap: 8px; }
.logoMark {
  font-family: var(--display); font-weight: 700; font-size: 26px;
  letter-spacing: -.02em; line-height: 1; color: var(--text);
}
.logoMark .dot { color: var(--yellow); }
.logoSub {
  font-size: 10px; font-weight: 600; letter-spacing: .28em; color: var(--faint);
  transform: translateY(-2px);
}
.status {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11.5px; color: var(--muted);
  padding: 6px 11px; border: 1px solid var(--line); border-radius: 999px;
  background: rgba(255,255,255,.02);
}
.statusDot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 3px rgba(52,210,126,.18);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(52,210,126,.06); } }

/* ---------- Hero ---------- */
.hero { margin-bottom: 22px; }
.hero h1 {
  margin: 0 0 6px;
  font-family: var(--display); font-weight: 600;
  font-size: clamp(26px, 7.5vw, 32px); line-height: 1.06; letter-spacing: -.025em;
}
.hero h1 span {
  color: var(--yellow);
  text-shadow: 0 0 24px rgba(245,196,0,.35);
}
.hero p { margin: 0; color: var(--muted); font-size: 14.5px; line-height: 1.5; }

/* ---------- Barra de progreso ---------- */
.bar { height: 4px; background: var(--card-2); border-radius: 999px; overflow: hidden; margin-bottom: 18px; }
.barFill {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--yellow-700), var(--yellow));
  border-radius: 999px;
  box-shadow: 0 0 14px rgba(245,196,0,.5);
  transition: width .4s cubic-bezier(.4,0,.2,1);
}

/* ---------- Formulario ---------- */
form { display: grid; gap: 15px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.field { display: grid; gap: 8px; }
.field > span, .lbl {
  font-size: 12.5px; font-weight: 600; color: var(--muted); letter-spacing: .01em;
}
.field > span i, .lbl i {
  font-style: normal; font-weight: 500; color: var(--faint);
  font-size: 11px; margin-left: 4px;
}

input[type=text], input[type=tel], input[type=email] {
  width: 100%; font: inherit; font-size: 16px; color: var(--text);
  height: 52px; padding: 0 15px;
  background: var(--card-2);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
input::placeholder { color: var(--faint); }
input:hover { border-color: var(--line-2); }
input:focus {
  border-color: var(--yellow);
  box-shadow: 0 0 0 4px var(--ring);
  background: #202023;
}
.field.invalid input { border-color: var(--err-line); }
.field.invalid input:focus { box-shadow: 0 0 0 4px var(--err-bg); }

/* ---------- Segmented control ---------- */
.seg {
  position: relative;
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--card-2);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 4px;
  isolation: isolate;
}
.segThumb {
  position: absolute; z-index: 0;
  top: 4px; bottom: 4px; left: 4px;
  width: calc((100% - 8px) / 3);
  background: linear-gradient(180deg, var(--yellow-2), var(--yellow));
  border-radius: 9px;
  box-shadow: 0 6px 16px -6px rgba(245,196,0,.6);
  transform: translateX(calc(var(--i, 0) * 100%));
  transition: transform .28s cubic-bezier(.5,.05,.1,1);
}
.segBtn {
  position: relative; z-index: 1;
  appearance: none; border: 0; background: transparent;
  font: inherit; font-size: 13.5px; font-weight: 600; color: var(--muted);
  padding: 11px 6px; cursor: pointer; border-radius: 9px;
  transition: color .2s;
}
.segBtn.is-active { color: #1a1300; }
.segBtn:not(.is-active):hover { color: var(--text); }
.segBtn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }

/* ---------- Checkbox ---------- */
.check {
  display: grid; grid-template-columns: 24px 1fr; align-items: start; gap: 12px;
  cursor: pointer; padding: 4px 0 2px;
}
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.checkMark {
  margin-top: 1px; width: 24px; height: 24px;
  border: 1.5px solid var(--line-2); border-radius: 8px;
  background: var(--card-2);
  display: grid; place-items: center;
  transition: background .16s, border-color .16s, transform .1s;
}
.checkMark::after {
  content: ""; width: 6px; height: 11px;
  border: solid #1a1300; border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg) scale(0); transition: transform .18s cubic-bezier(.2,.8,.3,1.5);
}
.check input:checked + .checkMark {
  background: var(--yellow); border-color: var(--yellow);
}
.check input:checked + .checkMark::after { transform: rotate(45deg) scale(1); }
.check input:focus-visible + .checkMark { box-shadow: 0 0 0 4px var(--ring); }
.check:active .checkMark { transform: scale(.94); }
.checkText { font-size: 13px; color: var(--muted); line-height: 1.45; }
.check.invalid .checkMark { border-color: var(--err-line); }

/* ---------- CTA ---------- */
.cta {
  position: sticky; bottom: 0; z-index: 5;
  margin: 4px -8px 0; padding: 14px 8px calc(8px + var(--bottom));
  display: grid; gap: 10px;
  background: linear-gradient(180deg, transparent, var(--card) 38%);
}
#btnEnviar {
  width: 100%; height: 56px; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-family: var(--display); font-weight: 600; font-size: 16px; color: #1a1300;
  background: linear-gradient(180deg, var(--yellow-2), var(--yellow));
  border-radius: var(--radius-md);
  box-shadow: 0 14px 30px -10px rgba(245,196,0,.5), 0 1px 0 rgba(255,255,255,.5) inset;
  transition: transform .12s, box-shadow .2s, filter .2s;
}
#btnEnviar:hover { transform: translateY(-1px); box-shadow: 0 18px 36px -10px rgba(245,196,0,.6); }
#btnEnviar:active { transform: translateY(0) scale(.99); }
#btnEnviar:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring); }
#btnEnviar:disabled { cursor: progress; filter: saturate(.9); }
#btnEnviar:disabled::before {
  content: ""; width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid rgba(26,19,0,.3); border-top-color: #1a1300;
  animation: spin .7s linear infinite;
}
#btnEnviar:disabled .btnText { opacity: .85; }
@keyframes spin { to { transform: rotate(360deg); } }

.nota { margin: 0; text-align: center; font-size: 11.5px; color: var(--faint); line-height: 1.45; }

.oculto { display: none; }

/* ---------- Alertas ---------- */
.alerta {
  display: grid; grid-template-columns: 20px 1fr; align-items: start; gap: 10px;
  padding: 12px 14px; margin-bottom: 16px;
  border-radius: var(--radius-md); border: 1px solid transparent;
  font-size: 13px; line-height: 1.4;
  animation: pop .25s ease both;
}
@keyframes pop { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }
.alerta::before {
  content: ""; width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
}
.alerta.ok    { background: var(--ok-bg);  color: var(--ok-text);  border-color: var(--ok-line); }
.alerta.ok::before    { content: "✓"; background: var(--green); color: #06210f; }
.alerta.error { background: var(--err-bg); color: var(--err-text); border-color: var(--err-line); }
.alerta.error::before { content: "!"; background: var(--err-text); color: #2a0a07; }

/* ---------- Éxito ---------- */
.success { text-align: center; padding: 18px 6px 8px; animation: pop .35s ease both; }
.successIcon { width: 90px; height: 90px; margin: 0 auto 16px; }
.successIcon svg { width: 100%; height: 100%; fill: none; }
.successIcon circle {
  stroke: var(--yellow); stroke-width: 3;
  stroke-dasharray: 151; stroke-dashoffset: 151; animation: draw .5s ease forwards;
}
.successIcon path {
  stroke: var(--yellow); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .35s .45s ease forwards;
  filter: drop-shadow(0 0 6px rgba(245,196,0,.5));
}
@keyframes draw { to { stroke-dashoffset: 0; } }
.success h2 { margin: 0 0 8px; font-family: var(--display); font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.success p { margin: 0 0 6px; color: var(--muted); font-size: 15px; line-height: 1.5; }
.successHint { color: var(--faint); font-size: 12.5px; }

/* ---------- Reveal escalonado ---------- */
.card .brand, .card .hero, .card .bar, .card form > * {
  animation: fadeUp .5s cubic-bezier(.2,.7,.2,1) both;
}
.card .hero { animation-delay: .05s; }
.card .bar  { animation-delay: .08s; }
.card form > *:nth-child(1) { animation-delay: .10s; }
.card form > *:nth-child(2) { animation-delay: .14s; }
.card form > *:nth-child(3) { animation-delay: .18s; }
.card form > *:nth-child(4) { animation-delay: .22s; }
.card form > *:nth-child(5) { animation-delay: .26s; }
.card form > *:nth-child(6) { animation-delay: .30s; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Móvil: pantalla app ---------- */
@media (max-width: 520px) {
  .page { padding: 0; place-items: stretch; }
  .card {
    width: 100%; min-height: 100dvh;
    border: 0; border-radius: 0; box-shadow: none;
    padding: 20px 18px calc(20px + var(--bottom));
    display: flex; flex-direction: column;
  }
  .grid { grid-template-columns: 1fr; }
  form { flex: 1; }
  .cta { margin-top: auto; }
}

/* ---------- Accesibilidad de movimiento ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .successIcon circle, .successIcon path { stroke-dashoffset: 0; }
  .glow { animation: none; }
}
