/* ============================================================================
   LOGIN2 · Base compartida por las 3 versiones
   ----------------------------------------------------------------------------
   · Tokens de marca (verde del logo, carbón, grises)
   · Componentes del formulario (campo con etiqueta flotante, botón, alertas)
   · Estados: foco, error, cargando, éxito, bloqueo
   · Aviso/conmutador de versiones (solo mientras sea plantilla)

   Cada versión (v1.css, v2.css, v3.css) solo define la composición de la
   pantalla y PERSONALIZA el formulario con variables --f-* y --b-* (abajo).
   ============================================================================ */

:root {
  /* Marca — #C5C724 es el verde de la insignia "SPORT GYM" del logo;
     #CBD100 es el del sitio web (curva del encabezado). */
  --l2-lime:      #CBD100;
  --l2-lime-hi:   #DCE31F;
  --l2-lime-deep: #8E9400;
  --l2-lime-text: #6B7000;      /* verde legible como TEXTO sobre fondo claro */

  --l2-ink:       #0D0D0D;
  --l2-carbon:    #161616;
  --l2-graphite:  #262626;
  --l2-steel:     #444444;
  --l2-fog:       #8A8A82;
  --l2-line:      #E4E4DD;
  --l2-mist:      #F3F3EE;

  --l2-danger:    #D93636;
  --l2-ok:        #2FA35B;

  --l2-font-display: 'Oswald', 'Arial Narrow', Impact, sans-serif;
  --l2-font-body:    'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --l2-ease: cubic-bezier(.2, .8, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; }
body.l2 {
  font-family: var(--l2-font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.l2 img { max-width: 100%; }
.l2-display {                       /* tipografía de títulos: condensada, cursiva, espaciada (como el sitio) */
  font-family: var(--l2-font-display);
  font-style: italic;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .14em;
}
.l2-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Iconos (sprite SVG inline) ─────────────────────────────────────────── */
.l2-i {
  width: 1.25em; height: 1.25em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ── Formulario ─────────────────────────────────────────────────────────── */
/* Variables por defecto (tema claro). Cada versión las redefine. */
.l2-form {
  --f-h: 58px;
  --f-fg: #111;
  --f-bg: #F4F4EF;
  --f-bg-focus: #fff;
  --f-autofill: #F4F4EF;
  --f-bd: transparent;
  --f-bd-hover: #D8D8CF;
  --f-bd-focus: var(--l2-ink);
  --f-bw: 1.5px;
  --f-ring: rgba(203, 209, 0, .35);
  --f-label: #8A8A82;
  --f-label-up: #66665F;
  --f-muted: #5D5D57;
  --f-ico: #8A8A82;
  --f-warn: #A15C00;
  --f-radius: 12px;
  --f-pad-l: 18px;

  --b-h: 56px;
  --b-bg: var(--l2-lime);
  --b-fg: var(--l2-ink);
  --b-bg-hover: var(--l2-lime-hi);
  --b-fg-hover: var(--l2-ink);
  --b-radius: 12px;
  --b-focus: var(--l2-ink);

  --a-bg: #FDECEC; --a-fg: #8F1D1D; --a-bd: #F6C4C4;

  display: flex; flex-direction: column; gap: 14px;
  width: 100%;
  font-family: var(--l2-font-body);
}

.l2-field { position: relative; }

.l2-input {
  display: block; width: 100%; height: var(--f-h);
  padding: 22px 16px 6px var(--f-pad-l);
  font: 500 15px/1.2 var(--l2-font-body);
  color: var(--f-fg);
  background: var(--f-bg);
  border: var(--f-bw) solid var(--f-bd);
  border-radius: var(--f-radius);
  outline: none;
  -webkit-appearance: none; appearance: none;
  transition: border-color .18s, background-color .18s, box-shadow .18s;
}
.l2-field--pass .l2-input { padding-right: 54px; }
.l2-input:hover { border-color: var(--f-bd-hover); }
.l2-input:focus {
  background: var(--f-bg-focus);
  border-color: var(--f-bd-focus);
  box-shadow: 0 0 0 4px var(--f-ring);
}

/* Etiqueta flotante: sube cuando hay foco o contenido (placeholder=" " permite detectarlo en CSS) */
.l2-label {
  position: absolute; left: var(--f-pad-l); top: 50%;
  transform: translateY(-50%);
  max-width: calc(100% - var(--f-pad-l) - 54px);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: 500 14.5px/1 var(--l2-font-body);
  color: var(--f-label);
  pointer-events: none;
  transition: top .18s var(--l2-ease), transform .18s var(--l2-ease), font-size .18s, letter-spacing .18s, color .18s;
}
.l2-input:focus + .l2-label,
.l2-input:not(:placeholder-shown) + .l2-label,
.l2-input:-webkit-autofill + .l2-label {
  top: 11px; transform: none;
  font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--f-label-up);
}
.l2-input:-webkit-autofill,
.l2-input:-webkit-autofill:focus {            /* el autocompletado del navegador no debe pintar su amarillo/azul */
  -webkit-text-fill-color: var(--f-fg);
  -webkit-box-shadow: 0 0 0 100px var(--f-autofill) inset;
  caret-color: var(--f-fg);
  transition: background-color 9999s ease-out 0s;
}

/* Icono a la izquierda del campo (lo activa solo la versión que lo usa) */
.l2-ico {
  position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
  display: none; align-items: center; color: var(--f-ico);
  pointer-events: none; transition: color .18s;
}

/* Ojo para mostrar/ocultar la contraseña */
.l2-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 42px; height: 42px; display: grid; place-items: center;
  border: 0; border-radius: 10px; background: transparent; color: var(--f-label);
  cursor: pointer; transition: color .15s, background-color .15s;
}
.l2-eye:hover { color: var(--f-fg); background: rgba(127, 127, 127, .12); }
.l2-eye:focus-visible { outline: 2px solid var(--f-bd-focus); outline-offset: 0; }
.l2-eye .l2-i-off { display: none; }
.l2-eye[aria-pressed="true"] .l2-i-on  { display: none; }
.l2-eye[aria-pressed="true"] .l2-i-off { display: block; }

/* Error en campo */
.l2-field.is-invalid .l2-input {
  border-color: var(--l2-danger);
  box-shadow: 0 0 0 4px rgba(217, 54, 54, .14);
}

.l2-caps { margin: -6px 0 0; font-size: 12px; font-weight: 600; color: var(--f-warn); display: flex; align-items: center; gap: 6px; }
.l2-caps[hidden] { display: none; }
.l2-caps .l2-i { width: 14px; height: 14px; }

/* Fila "recordar usuario" */
.l2-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 2px 0 2px; }
.l2-check {
  position: relative; display: inline-flex; align-items: center; gap: 10px;
  font-size: 13px; font-weight: 500; color: var(--f-muted);
  cursor: pointer; user-select: none;
}
.l2-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.l2-check-box {
  width: 19px; height: 19px; flex: none; display: grid; place-items: center;
  border-radius: 5px; border: 1.5px solid var(--f-bd-hover); background: var(--f-bg);
  transition: background-color .15s, border-color .15s, box-shadow .15s;
}
.l2-check-box::after {
  content: ""; width: 9px; height: 5px; margin-top: -2px;
  border-left: 2.5px solid var(--l2-ink); border-bottom: 2.5px solid var(--l2-ink);
  transform: rotate(-45deg) scale(0); transition: transform .15s var(--l2-ease);
}
.l2-check input:checked + .l2-check-box { background: var(--l2-lime); border-color: var(--l2-lime); }
.l2-check input:checked + .l2-check-box::after { transform: rotate(-45deg) scale(1); }
.l2-check input:focus-visible + .l2-check-box { box-shadow: 0 0 0 3px var(--f-ring); }

/* Botón principal */
.l2-btn {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; height: var(--b-h); margin-top: 4px; padding: 0 20px;
  border: 0; cursor: pointer; overflow: hidden;
  font: 700 15px/1 var(--l2-font-display); font-style: italic; letter-spacing: .2em; text-transform: uppercase;
  color: var(--b-fg); background: var(--b-bg); border-radius: var(--b-radius);
  transition: background-color .18s, color .18s, transform .18s var(--l2-ease), filter .18s;
}
.l2-btn:hover { background: var(--b-bg-hover); color: var(--b-fg-hover); transform: translateY(-1px); }
.l2-btn:active { transform: translateY(0); }
.l2-btn:focus-visible { outline: 3px solid var(--b-focus); outline-offset: 3px; }
.l2-btn .l2-i { width: 1.35em; height: 1.35em; transition: transform .2s var(--l2-ease); }
.l2-btn:hover .l2-i { transform: translateX(5px); }
.l2-btn:disabled { cursor: not-allowed; filter: saturate(.3) brightness(.92); transform: none; }

.l2-btn-spin {
  display: none; width: 19px; height: 19px; border-radius: 50%;
  border: 2.5px solid currentColor; border-right-color: transparent;
  animation: l2-spin .7s linear infinite;
}
.l2-form.is-busy .l2-btn:disabled,
.l2-form.is-ok .l2-btn:disabled { filter: none; cursor: default; }   /* validando / éxito: no se ve "apagado" */
.l2-form.is-busy .l2-btn { pointer-events: none; }
.l2-form.is-busy .l2-btn-spin { display: block; }
.l2-form.is-busy .l2-btn .l2-i { display: none; }
.l2-form.is-ok .l2-btn { background: var(--l2-ok); color: #fff; }
.l2-form.is-ok .l2-btn .l2-i { display: none; }

.l2-note { margin: 4px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--f-muted); }
.l2-note strong { font-weight: 700; color: var(--f-fg); }

/* Mensajes */
.l2-alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: var(--f-radius);
  font-size: 13.5px; font-weight: 500; line-height: 1.45;
  color: var(--a-fg); background: var(--a-bg); border: 1px solid var(--a-bd);
  animation: l2-pop .25s var(--l2-ease);
}
.l2-alert[hidden] { display: none; }
.l2-alert .l2-i { width: 18px; height: 18px; margin-top: 1px; }
.l2-alert--warn { --a-bg: #FFF5D6; --a-fg: #6E4C00; --a-bd: #F1DB8C; }

.l2-legal { font-size: 11.5px; line-height: 1.6; color: var(--l2-fog); }
.l2-legal p { margin: 0; }

.l2-noscript { padding: 12px 14px; border-radius: 10px; font-size: 13px; background: #FFF5D6; color: #6E4C00; }

/* ── Animaciones ────────────────────────────────────────────────────────── */
@keyframes l2-spin  { to { transform: rotate(360deg); } }
@keyframes l2-rise  { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes l2-pop   { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
@keyframes l2-pulse { 0% { box-shadow: 0 0 0 0 rgba(203, 209, 0, .55); } 70%, 100% { box-shadow: 0 0 0 9px rgba(203, 209, 0, 0); } }
@keyframes l2-shake {
  10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-7px); } 40%, 60% { transform: translateX(7px); }
}
.l2-shake { animation: l2-shake .45s both; }

body.is-leaving { opacity: 0; transition: opacity .35s ease; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ── Aviso de sesión activa y conmutador de versiones (solo plantilla) ──── */
.l2-switch {
  position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 50;
  display: flex; align-items: center; gap: 2px; padding: 5px;
  border-radius: 999px; background: rgba(13, 13, 13, .9);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
  font: 600 11px/1 var(--l2-font-body); color: #aaa; white-space: nowrap;
}
.l2-switch span { padding: 0 8px 0 12px; letter-spacing: .14em; text-transform: uppercase; }
.l2-switch a { padding: 9px 14px; border-radius: 999px; color: #e6e6e0; text-decoration: none; transition: background-color .15s; }
.l2-switch a:hover { background: rgba(255, 255, 255, .12); }
.l2-switch a[aria-current="page"] { background: var(--l2-lime); color: var(--l2-ink); }
.l2-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 16px;
  padding: 8px 16px; background: var(--l2-ink); color: #e8e8e2;
  font: 500 12.5px/1.4 var(--l2-font-body);
}
.l2-banner a { color: var(--l2-lime); font-weight: 700; text-decoration: none; }
.l2-banner a:hover { text-decoration: underline; }
html.l2-embed .l2-chrome { display: none !important; }

@media (max-width: 480px) {
  .l2-switch span { display: none; }
  .l2-switch a { padding: 9px 12px; }
}
