/* =========================================================
   GESERP — Login v2 ("Stitch" — reproducción de maqueta)
   ---------------------------------------------------------
   Reproduce la imagen de referencia entregada por el usuario:
   panel izquierdo institucional (foto + overlay verde, corte
   diagonal irregular, stepper de trayectoria con íconos) +
   panel derecho claro con el formulario dentro de una tarjeta.

   Es un archivo NUEVO e independiente de css/login.css (que se
   conserva intacto por si se quiere volver al diseño anterior).
   Solo cambia la interfaz — index.php conserva exactamente el
   mismo formulario, method POST, nombres de campos, CSRF y
   lógica de sesión.
========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* Paleta institucional (verde TESCH + navy de texto + acentos) */
  --v-950: #0a2417;
  --v-900: #0d3320;
  --v-800: #114429;
  --v-700: #15532f;
  --v-600: #1a6b3a;
  --v-500: #16a34a;
  --v-400: #22c55e;
  --v-glow: #4ade80;

  --ink-900: #0f172a;
  --ink-600: #475569;
  --ink-400: #94a3b8;

  --surface: #ffffff;
  --canvas: #f6f8f7;
  --line: #e5e7eb;

  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  width: 100%;
}

img {
  max-width: 100%;
}

body {
  font-family: var(--font);
  color: var(--ink-900);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}

/* =========================================================
   CONTENEDOR GENERAL
========================================================= */
.stitch-shell {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--surface);
  overflow: hidden;
  display: flex;
  align-items: stretch;
}

/* =========================================================
   PANEL IZQUIERDO — foto institucional + overlay verde +
   corte diagonal irregular (clip-path en zigzag, como en la
   maqueta) + stepper de trayectoria.
========================================================= */
.stitch-brand {
  position: relative;
  z-index: 2;
  /* z-index por encima del panel blanco: así los "dientes" del borde
     dentado se dibujan ENCIMA del panel derecho en vez de dejar un
     hueco o una costura visible entre los dos paneles. */
  flex: 0 0 60%;
  max-width: 60%;
  color: #fff;
  padding: clamp(24px, 3vw, 44px) clamp(70px, 7vw, 104px) clamp(24px, 3vw, 44px) clamp(24px, 4vw, 56px);
  /* padding-right ampliado a propósito: reserva el espacio de la franja
     dentada para que el contenido (logos, texto, stepper) nunca quede
     recortado por el clip-path. */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  margin-right: -64px;
  /* Jala al panel derecho 64px hacia la izquierda (en flexbox, el
     margen negativo de un elemento reduce el espacio que reserva para
     sí mismo, así que el siguiente hermano avanza) — esto crea la zona
     de superposición de 64px donde se dibuja el diente, sin huecos. */
  clip-path: polygon(0 0, 100% 0, 78% 100%, 0 100%);
  /* Diagonal limpia y suave (no zigzag): el borde va del 100% de este
     panel arriba, al 78% abajo — se abre más ancho en la parte
     superior y se cierra hacia la parte inferior, igual que en la
     imagen de referencia. */
  background:
    linear-gradient(125deg, rgba(10, 36, 23, 0.94) 0%, rgba(13, 51, 32, 0.88) 45%, rgba(17, 68, 41, 0.82) 100%),
    url("../Img/Fondo_Tesch.jpeg") center/cover no-repeat;
}

/* Textura de puntos decorativa (esquina inferior izquierda, como en la maqueta) */
.stitch-brand::after {
  content: "";
  position: absolute;
  left: clamp(20px, 3vw, 40px);
  bottom: clamp(90px, 10vw, 130px);
  width: 90px;
  height: 60px;
  background-image: radial-gradient(rgba(255, 255, 255, 0.35) 1.4px, transparent 1.4px);
  background-size: 14px 14px;
  opacity: 0.5;
  pointer-events: none;
}

.stitch-brand-inner {
  position: relative;
  z-index: 1;
  max-width: 92%;
}

/* ---- Logos + nombre de la institución ---- */
.stitch-logos {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.stitch-logo-chip {
  height: 56px;
  width: auto;
  min-width: 56px;
  padding: 0 8px;
  border-radius: 12px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.stitch-logo-chip img {
  height: 100%;
  width: auto;
  max-width: 130px;
  object-fit: contain;
}

.stitch-institucion {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--v-400);
  margin: 0 0 6px;
}

.stitch-headline {
  font-family: var(--font);
  font-size: clamp(2rem, 3.4vw, 2.75rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin: 0 0 16px;
}

.stitch-headline .accent {
  color: var(--v-400);
}

.stitch-sub {
  font-size: 15px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.78);
  max-width: 40ch;
  margin: 0 0 clamp(26px, 4vw, 42px);
}

/* ---- Stepper de trayectoria ---- */
.stitch-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.stitch-step {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 0;
  position: relative;
}

.stitch-step::before {
  /* línea punteada conectora */
  content: "";
  position: absolute;
  left: 21px;
  top: -4px;
  bottom: -4px;
  border-left: 2px dotted rgba(255, 255, 255, 0.28);
}

.stitch-step:first-child::before {
  top: 50%;
}

.stitch-step:last-child::before {
  bottom: 50%;
}

.stitch-step-icon {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  color: rgba(255, 255, 255, 0.75);
}

.stitch-step-label {
  font-size: 15.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.68);
}

.stitch-step.is-active .stitch-step-icon {
  background: linear-gradient(135deg, var(--v-500), var(--v-600));
  border-color: var(--v-500);
  color: #fff;
  box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.18);
}

.stitch-step.is-active .stitch-step-label {
  color: #fff;
  font-weight: 700;
}

.stitch-step-tag {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #0a2417;
  background: var(--v-glow);
  padding: 4px 11px;
  border-radius: 999px;
}

/* ---- Tarjeta institucional inferior ---- */
.stitch-brand-foot {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  padding: 14px 18px;
  margin-top: clamp(20px, 3vw, 32px);
  backdrop-filter: blur(6px);
  max-width: fit-content;
}

.stitch-brand-foot i {
  font-size: 20px;
  color: var(--v-400);
}

.stitch-brand-foot strong {
  display: block;
  font-size: 14px;
  color: #fff;
}

.stitch-brand-foot span {
  display: block;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.6);
}

/* =========================================================
   PANEL DERECHO — formulario
========================================================= */
.stitch-panel {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(28px, 4vw, 64px);
}

/* ---- Franja superior: modo claro/oscuro (decorativo) + cuenta ---- */
.stitch-topbar {
  position: absolute;
  top: clamp(20px, 3vw, 36px);
  right: clamp(20px, 4vw, 56px);
  display: flex;
  align-items: center;
  gap: 10px;
}

.stitch-theme-toggle {
  display: flex;
  align-items: center;
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  gap: 2px;
}

.stitch-theme-toggle button {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--ink-400);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: background 150ms ease, color 150ms ease;
}

.stitch-theme-toggle button.is-active {
  background: var(--surface);
  color: #d97706;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.stitch-theme-toggle button.is-moon.is-active {
  color: var(--ink-900);
}

.stitch-topbar-divider {
  width: 1px;
  height: 22px;
  background: var(--line);
}

.stitch-account {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-600);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

/* ---- Cuerpo del formulario ---- */
.stitch-form-wrap {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

.stitch-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--v-500);
  margin: 0 0 14px;
}

.stitch-kicker i {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--v-500);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

.stitch-title {
  font-size: clamp(1.7rem, 3vw, 2.1rem);
  font-weight: 800;
  color: var(--ink-900);
  margin: 0 0 10px;
  letter-spacing: -0.01em;
}

.stitch-hint {
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink-600);
  margin: 0 0 26px;
}

/* ---- Avisos ---- */
.stitch-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.5;
  margin-bottom: 18px;
}

.stitch-banner i {
  margin-top: 2px;
}

.stitch-banner-info {
  background: #eef6f0;
  color: var(--v-700);
  border: 1px solid #d3ecd9;
}

.stitch-banner-error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

/* ---- Campos ---- */
.stitch-field {
  margin-bottom: 18px;
}

.stitch-field label {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink-900);
  margin-bottom: 8px;
}

.stitch-input-shell {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 8px 14px 8px 8px;
  background: var(--surface);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.stitch-input-shell:focus-within {
  border-color: var(--v-500);
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.12);
}

.stitch-input-icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--v-500), var(--v-700));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.stitch-input-shell input {
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font);
  font-size: 15px;
  color: var(--ink-900);
  width: 100%;
  min-width: 0;
  padding: 8px 0;
}

.stitch-input-shell input::placeholder {
  color: var(--ink-400);
}

.stitch-toggle-password {
  cursor: pointer;
  color: var(--ink-400);
  font-size: 15px;
  padding: 4px;
  flex-shrink: 0;
}

.stitch-toggle-password:hover {
  color: var(--ink-600);
}

/* ---- Botón ---- */
.stitch-btn-submit {
  width: 100%;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--v-600), var(--v-800));
  color: #fff;
  font-family: var(--font);
  font-size: 15.5px;
  font-weight: 700;
  padding: 15px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  margin-top: 8px;
  transition: filter 150ms ease, transform 150ms ease, box-shadow 150ms ease;
  box-shadow: 0 10px 24px rgba(21, 83, 47, 0.28);
}

.stitch-btn-submit:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.stitch-btn-submit:active {
  transform: translateY(0);
}

.stitch-btn-submit i {
  font-size: 13px;
  transition: transform 150ms ease;
}

.stitch-btn-submit:hover i {
  transform: translateX(3px);
}

/* ---- Estado de carga (al enviar el formulario) ---- */
.stitch-btn-submit.is-loading {
  cursor: default;
  opacity: 0.9;
}

.stitch-btn-submit:disabled {
  cursor: default;
}

.stitch-spinner {
  display: inline-block;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: stitchGirar 0.7s linear infinite;
  vertical-align: middle;
}

@keyframes stitchGirar {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .stitch-spinner {
    animation-duration: 1.4s;
  }
}

/* ---- Enlaces auxiliares ---- */
.stitch-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 22px;
  font-size: 14px;
  flex-wrap: wrap;
}

.stitch-links a {
  color: var(--v-600);
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.stitch-links a:hover {
  text-decoration: underline;
}

.stitch-links .divider {
  width: 1px;
  height: 16px;
  background: var(--line);
}

.stitch-privacy {
  text-align: center;
  margin-top: 18px;
}

.stitch-privacy a {
  font-size: 12.5px;
  color: var(--ink-400);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.stitch-privacy a:hover {
  color: var(--ink-600);
}

/* =========================================================
   MODO OSCURO (opcional, decorativo/funcional en el panel
   derecho) — se activa con la clase .stitch-dark en <body>
========================================================= */
body.stitch-dark {
  background: #0f172a;
}

body.stitch-dark .stitch-panel {
  background: #0f172a;
}

body.stitch-dark .stitch-title {
  color: #f8fafc;
}

body.stitch-dark .stitch-hint {
  color: #94a3b8;
}

body.stitch-dark .stitch-field label {
  color: #e2e8f0;
}

body.stitch-dark .stitch-input-shell {
  background: #1e293b;
  border-color: #334155;
}

body.stitch-dark .stitch-input-shell input {
  color: #f1f5f9;
}

body.stitch-dark .stitch-theme-toggle,
body.stitch-dark .stitch-account {
  background: #1e293b;
  border-color: #334155;
}

body.stitch-dark .stitch-topbar-divider {
  background: #334155;
}

/* =========================================================
   ANIMACIÓN DE ENTRADA (un solo gesto orquestado y escalonado,
   no efectos sueltos por elemento)
========================================================= */
@keyframes stitchSubir {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stitch-logos,
.stitch-institucion,
.stitch-headline,
.stitch-sub,
.stitch-steps,
.stitch-brand-foot,
.stitch-topbar,
.stitch-kicker,
.stitch-title,
.stitch-hint,
.stitch-panel form {
  opacity: 0;
  animation: stitchSubir 0.6s ease forwards;
}

/* Escalonado: cada elemento entra un poco después que el anterior */
.stitch-logos {
  animation-delay: 0.05s;
}

.stitch-institucion {
  animation-delay: 0.1s;
}

.stitch-headline {
  animation-delay: 0.15s;
}

.stitch-sub {
  animation-delay: 0.2s;
}

.stitch-steps {
  animation-delay: 0.3s;
}

.stitch-brand-foot {
  animation-delay: 0.4s;
}

.stitch-topbar {
  animation-delay: 0.15s;
}

.stitch-kicker {
  animation-delay: 0.2s;
}

.stitch-title {
  animation-delay: 0.25s;
}

.stitch-hint {
  animation-delay: 0.3s;
}

.stitch-panel form {
  animation-delay: 0.35s;
}

/* =========================================================
   ACCESIBILIDAD
========================================================= */
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--v-500);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {

  .stitch-btn-submit,
  .stitch-btn-submit i,
  .stitch-input-shell {
    transition: none;
  }

  .stitch-logos,
  .stitch-institucion,
  .stitch-headline,
  .stitch-sub,
  .stitch-steps,
  .stitch-brand-foot,
  .stitch-topbar,
  .stitch-kicker,
  .stitch-title,
  .stitch-hint,
  .stitch-panel form {
    animation: none;
    opacity: 1;
  }
}

/* =========================================================
   RESPONSIVE
========================================================= */
@media (max-width: 1100px) {
  .stitch-brand {
    flex-basis: 56%;
    max-width: 56%;
  }
}

@media (max-width: 900px) {
  .stitch-shell {
    flex-direction: column;
  }

  .stitch-brand {
    position: relative;
    flex-basis: auto;
    max-width: 100%;
    margin-right: 0;
    clip-path: none;
    padding: 32px 24px 40px;
    min-height: auto;
  }

  .stitch-brand::after {
    display: none;
  }

  .stitch-brand-foot {
    display: none;
  }

  .stitch-sub {
    margin-bottom: 20px;
  }

  .stitch-steps {
    margin-bottom: 24px;
  }

  .stitch-step {
    gap: 12px;
    padding: 8px 0;
  }

  .stitch-step-icon {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }

  .stitch-step-label {
    font-size: 14px;
  }

  .stitch-step::before {
    left: 17px;
  }

  .stitch-panel {
    position: relative;
    width: 100%;
    min-height: auto;
    padding: 32px 20px 48px;
  }

  .stitch-topbar {
    position: static;
    justify-content: flex-end;
    margin-bottom: 20px;
  }
}

@media (max-width: 480px) {
  .stitch-headline {
    font-size: 1.7rem;
  }

  .stitch-logo-chip {
    height: 46px;
    min-width: 46px;
  }

  .stitch-step {
    gap: 10px;
  }

  .stitch-step-icon {
    width: 32px;
    height: 32px;
    font-size: 12.5px;
  }

  .stitch-step-label {
    font-size: 13px;
  }

  .stitch-step-tag {
    font-size: 9.5px;
    padding: 3px 8px;
  }

  .stitch-title {
    font-size: 1.5rem;
  }

  .stitch-input-shell {
    padding: 6px 10px 6px 6px;
  }

  .stitch-input-icon {
    width: 30px;
    height: 30px;
    font-size: 12.5px;
  }

  .stitch-btn-submit {
    font-size: 14.5px;
    padding: 13px 14px;
  }
}

@media (max-width: 360px) {
  .stitch-panel {
    padding: 24px 16px 40px;
  }

  .stitch-brand {
    padding: 24px 16px 32px;
  }
}
