/* ==========================================================================
   VISTA AUTENTICACIÓN
   ======================================================================== */

/* --- Contenedor Principal de Pantalla Completa (Cero Scroll) --- */
.auth-viewport {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background-color: var(--surface-card);
  font-family: var(--font-sans);
}

/* ==========================================================================
   IZQUIERDA: HERO & BIENVENIDA
   ========================================================================== */
.auth-hero {
  position: relative;
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-xl, 2rem);
  padding: var(--space-2xl, 3rem) var(--space-xl, 2.5rem);
  background-image: url("../../images/backgroung.avif");
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  color: var(--text-inverse);
  overflow: hidden;
  z-index: 1;
  clip-path: polygon(0 0, 100% 0, calc(100% - 4.5vw) 100%, 0 100%);
}

/* Capa 2 de degradado */
.auth-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    225deg,
    rgba(30, 41, 59, 0.98) 0%,
    rgba(30, 41, 59, 0.96) 30%,
    rgba(30, 41, 59, 0.96) 70%,
    rgba(30, 41, 59, 0.98) 100%
  );
  z-index: -1;
  pointer-events: none;
}

/* Decoración Hero */
.auth-hero::after {
  content: "";
  position: absolute;
  bottom: -15%;
  left: -10%;
  width: 50vw;
  height: 50vw;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.05) 0%,
    transparent 70%
  );
  z-index: -1;
  pointer-events: none;
}

/* Contenido central */
.auth-hero__center {
  max-width: 34rem;
}

.auth-hero__title {
  font-size: clamp(1.85rem, 3.2vw, 2.75rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text-inverse);
  margin: 0 0 var(--space-xs, 0.75rem) 0;
}

.auth-hero__title-highlight {
  color: var(--color-brand-primary);
  font-weight: var(--font-weight-extrabold, 800);
  letter-spacing: var(--tracking-wide, 0.025em);
  display: inline;
}

/* ==========================================================================
   DERECHA: PANEL DE ACCESO
   ========================================================================== */
.auth-form-pane {
  position: relative;
  height: 100%;
  width: 100%;
  background-color: var(--surface-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-lg, 1.5rem) var(--space-xl, 2rem);
  overflow: hidden;
  box-sizing: border-box;
}

/* Contenedor del Formulario */
.auth-form-wrapper {
  width: 100%;
  max-width: 23.5rem;
  margin: auto 0;
  border: none;
  box-shadow: none;
  background: transparent;
  display: flex;
  flex-direction: column;
}

/* Cabecera del formulario */
.auth-form__header {
  text-align: center;
  margin-bottom: var(--space-xs, 0.5rem);
}

/* .auth-form__logo-link {
  display: inline-block;
  transition: transform var(--duration-fast, 150ms) var(--ease-out, ease-out);
}

.auth-form__logo-link:hover {
  transform: scale(1.02);
} */

.auth-form__logo {
  max-height: 8.25rem;
  max-width: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  margin-bottom: -1rem;
}

.auth-form__heading {
  font-size: var(--text-xl, 1.25rem);
  font-weight: var(--font-weight-extrabold);
  color: var(--text-secondary, var(--text-secondary));
  margin: 0;
}

.auth-form__subheading {
  font-size: var(--caption-font-size, 0.75rem);
  color: var(--text-secondary, var(--text-secondary));
  margin: 0;
}

/* Slot de Alertas Flash */
.auth-alert-slot {
  width: 100%;
  margin-bottom: var(--space-xs, 0.65rem);
}

.auth-alert-slot .alert {
  padding: 0.45rem 0.75rem;
  font-size: var(--caption-font-size, 0.75rem);
  line-height: 1.25;
  border-radius: var(--radius-xs, 4px);
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  animation: authFadeIn 0.2s ease-out;
}

@keyframes authFadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   OVERRIDES CONTEXTUALES DE VISTA (SOBRE COMPONENTES BASE)
   ========================================================================== */

/* Labels de formulario en el login: Color caoba y tamaño compacto */
.auth-form-wrapper .form-label {
  font-size: var(--text-xs, 0.75rem);
  font-weight: var(--font-weight-semibold);
  color: var(--color-brand-primary);
  margin-bottom: var(--space-3xs, 0.35rem);
}

/* Botón Toggle Ver/Ocultar Contraseña (integrado en .form-input-wrapper) */
.auth-password-toggle {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  padding: 0.35rem;
  cursor: pointer;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs, 4px);
  transition:
    color var(--duration-fast, 150ms) ease,
    background-color var(--duration-fast, 150ms) ease;
  z-index: 3;
}

.auth-password-toggle:hover {
  color: var(--text-primary);
  background-color: rgba(0, 0, 0, 0.04);
}

.auth-password-toggle:focus-visible {
  outline: 2px solid var(--color-blue-indigo);
}

.auth-password-toggle .icon-toggle-hidden {
  display: none;
}

/* Espacio reservado a la derecha para el botón de visibilidad */
.auth-form-wrapper input[type="password"].form-input {
  padding-right: 2.5rem;
}

/* Recuperación de Contraseña */
.auth-form__actions-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: calc(var(--space-3xs) * -1);
  margin-bottom: var(--space-sm, 1rem);
}

.auth-forgot-link {
  font-size: var(--caption-font-size, 0.75rem);
  font-weight: var(--font-weight-regular, 400);
  color: var(--text-secondary, var(--text-secondary));
  text-decoration: none;
  transition:
    color var(--duration-fast, 150ms) ease,
    text-decoration var(--duration-fast, 150ms) ease;
  cursor: pointer;
}

.auth-forgot-link:hover {
  color: var(--color-blue-indigo-hover);
  font-weight: var(--font-weight-medium, 500);
  text-decoration: underline;
}

/* Botón de Ingreso: Color de marca Su Tornillo, alineación y ancho */
.auth-form-wrapper .auth-submit-btn {
  align-self: flex-start;
  min-width: 12rem;
  background-color: var(--color-brand-primary);
  border-color: var(--color-brand-primary);
  color: var(--text-inverse);
}

.auth-form-wrapper .auth-submit-btn:hover {
  background-color: var(--color-brand-primary-hover);
  border-color: var(--color-brand-primary-hover);
}

.auth-form-wrapper .auth-submit-btn:active {
  background-color: var(--color-brand-primary-active);
  border-color: var(--color-brand-primary-active);
}

/* Footer Institucional AP Ingeniería */
.auth-form__footer {
  width: 100%;
  text-align: center;
  padding-top: var(--space-xs, 0.5rem);
}

.auth-form__footer-text {
  font-size: var(--text-2xs, 0.7rem);
  color: var(--text-secondary);
  line-height: 1.35;
  margin: 0;
}

.auth-form__footer-text strong {
  color: var(--text-primary);
}

/* ==========================================================================
   ADAPTACIÓN RESPONSIVA (MOBILE & TABLETS) - CERO SCROLL
   ========================================================================== */
@media (max-width: 52em) {
  /* 832px */
  .auth-viewport {
    grid-template-columns: 1fr;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  .auth-hero {
    display: none;
  }

  .auth-form-pane {
    padding: var(--space-md, 1rem) var(--space-md, 1.25rem);
    justify-content: space-between;
    height: 100%;
  }

  .auth-form-wrapper {
    max-width: 22rem;
  }

  .auth-form__logo {
    max-height: 5.125rem;
  }

  .auth-form__heading {
    font-size: var(--section-title-font-size, 1.25rem);
  }

  .auth-form-wrapper .form-label {
    font-size: var(--body-font-size, 0.875rem);
  }

  .auth-form-wrapper .auth-submit-btn {
    width: 100%;
    min-width: auto;
    align-self: stretch;
  }
}

@media (max-height: 600px) {
  .auth-form__header {
    margin-bottom: 0.5rem;
  }
  .auth-form__logo {
    max-height: 4rem;
  }
  .form-group {
    margin-bottom: 0.5rem;
  }
  .auth-form__actions-row {
    margin-bottom: 0.5rem;
  }
}
