/* =========================================================
   1. RESET GENERAL
   Función:
   - Quita márgenes por defecto del navegador.
   - Hace que los tamaños sean más predecibles.
========================================================= */

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  color: #ffffff;
  background: #075f86;
}

/* =========================================================
   2. CONTENEDOR PRINCIPAL DE AUTH
   Función:
   - Define la página completa del login/registro.
   - Evita scroll horizontal.
========================================================= */

.auth-page {
  min-height: 100vh;
  width: 100%;
  overflow: hidden;
}

/* =========================================================
   3. LAYOUT DESKTOP
   Función:
   - Divide la pantalla en 2 columnas.
   - Izquierda: fondo con captura.png.
   - Derecha: panel azul con logo y formulario.
========================================================= */

.auth-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 59.5% 40.5%;
  background: #075f86;
}

.auth-layout__visual {
  position: relative;
  min-height: 100vh;
  background-image: url("../../assets/images/ui/captura.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.auth-layout__panel {
  min-height: 100vh;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #075f86;
}

/* =========================================================
   4. PANEL CENTRAL
   Función:
   - Contiene logo, botones y formularios.
   - Mantiene el contenido alineado y centrado.
========================================================= */

.auth-panel {
  width: min(470px, 82%);
  min-height: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* =========================================================
   5. LOGO
   Función:
   - Define tamaño del logo.
   - Permite animación suave al hacer hover.
========================================================= */

.auth-panel__logo {
  width: 220px;
  height: 220px;
  margin-bottom: 80px;
}

.auth-panel__logo a {
  display: block;
  width: 100%;
  height: 100%;
}

.auth-panel__logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.auth-panel__logo:hover img {
  transform: scale(1.08);
  filter: brightness(1.05);
}

/* =========================================================
   6. BOTONES GENERALES
   Función:
   - Estilo base para botones y links con apariencia de botón.
========================================================= */

.auth-button {
  border: 0;
  outline: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 50px;
  border-radius: 10px;
  padding: 0 28px;
  font-size: 18px;
  font-weight: 700;
  text-transform: none;
  text-decoration: underline;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease, opacity 0.15s ease;
}

.auth-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.auth-button:active {
  transform: translateY(0);
}

.auth-button--secondary {
  width: 300px;
  background: #c9d4e2;
  color: #2c81bd;
}

.auth-button--primary {
  background: #ff9f12;
  color: #ffffff;
}

.auth-button--small {
  min-width: 170px;
  height: 43px;
  border-radius: 999px;
}

.auth-button--token {
  width: 115px;
  height: 50px;
  border-radius: 0 10px 10px 0;
  background: #7fbef4;
  color: #ffffff;
  text-decoration: none;
  font-size: 16px;
  font-weight: 500;
  padding: 0 16px;
}

.auth-button--disabled {
  opacity: 0.95;
}

.auth-button.is-loading {
  opacity: 0.7;
  pointer-events: none;
}

/* =========================================================
   7. PANTALLA INICIAL / LANDING
   Función:
   - Ordena los botones "Iniciar sesión" y "Registrarse".
   - Los deja exactamente iguales de ancho y alto.
========================================================= */

.auth-panel__actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 34px;
}

.auth-page--landing .auth-panel {
  justify-content: center;
}

.auth-page--landing .auth-panel__logo {
  margin-bottom: 88px;
}

.auth-page--landing .auth-button,
.auth-page--landing .auth-button--primary,
.auth-page--landing .auth-button--secondary {
  width: 320px;
  height: 50px;
  border-radius: 10px;
  padding: 0 28px;
}

/* =========================================================
   8. SEPARADOR ENTRE BOTONES
   Función:
   - Crea la línea con punto en el medio entre login y registro.
========================================================= */

.auth-divider {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-divider__line {
  height: 3px;
  flex: 1;
  background: #7fc2e6;
}

.auth-divider__dot {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: #7fc2e6;
}

/* =========================================================
   9. FORMULARIOS
   Función:
   - Define ancho, separación y posición de formularios.
========================================================= */

.auth-form {
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.auth-form--login {
  margin-top: -24px;
}

.auth-form--register {
  margin-top: -38px;
}

.auth-form--register-token {
  width: 320px;
  margin-top: -42px;
  gap: 17px;
}

/* =========================================================
   10. CAMPOS DE FORMULARIO
   Función:
   - Estiliza labels e inputs.
========================================================= */

.auth-field {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-field__label {
  font-size: 18px;
  font-weight: 400;
  color: #ffffff;
}

.auth-field__input {
  width: 100%;
  height: 50px;
  border: 0;
  outline: 0;
  border-radius: 10px;
  padding: 0 16px;
  background: #c9d4e2;
  color: #143448;
  font-size: 18px;
}

.auth-field__input:focus {
  box-shadow: 0 0 0 3px rgba(255, 159, 18, 0.35);
}

/* =========================================================
   11. ACCIONES Y LINKS DEL FORMULARIO
   Función:
   - Centra botones.
   - Estiliza links como "olvidaste contraseña".
========================================================= */

.auth-form__actions {
  margin-top: 10px;
  display: flex;
  justify-content: center;
}

.auth-form__links {
  margin-top: 4px;
  text-align: center;
}

.auth-link {
  color: #ffffff;
  font-size: 16px;
  text-decoration: underline;
}

/* =========================================================
   12. MENSAJES DE ERROR / ÉXITO
   Función:
   - Muestra errores o confirmaciones sin usar alert().
========================================================= */

.auth-form__message {
  min-height: 22px;
  margin: 0;
  font-size: 15px;
  text-align: center;
}

.auth-form__message--error {
  color: #ffb3b3;
}

.auth-form__message--success {
  color: #b7ffcf;
}

/* =========================================================
   13. TEXTO DE AYUDA
   Función:
   - Estiliza textos chicos debajo de token o enlaces.
========================================================= */

.auth-help-text {
  margin: 0;
  color: #ffffff;
  font-size: 16px;
  line-height: 1.35;
  text-align: center;
}

/* =========================================================
   14. FILA TOKEN + BOTÓN CONFIRMAR
   Función:
   - Une input de token con botón confirmar.
========================================================= */

.auth-token-row {
  width: 100%;
  display: flex;
  align-items: flex-end;
}

.auth-field--token {
  flex: 1;
}

.auth-field--token .auth-field__input {
  border-radius: 10px 0 0 10px;
}

/* =========================================================
   15. AJUSTES POR PANTALLA
   Función:
   - Ajusta separación del logo según la página.
========================================================= */

.auth-page--login .auth-panel__logo {
  margin-bottom: 52px;
}

.auth-page--register-step-1 .auth-panel__logo {
  margin-bottom: 38px;
}

.auth-page--register-step-2 .auth-panel__logo {
  margin-bottom: 28px;
}

/* =========================================================
   16. TABLET
   Función:
   - En pantallas medianas elimina la división dura en columnas.
   - Mantiene fondo y panel encima.
========================================================= */

@media (max-width: 900px) {
  .auth-layout {
    grid-template-columns: 1fr;
  }

  .auth-layout__visual {
    position: absolute;
    inset: 0;
    opacity: 0.45;
  }

  .auth-layout__panel {
    z-index: 1;
    background: rgba(7, 95, 134, 0.86);
  }

  .auth-panel {
    width: min(430px, 90%);
  }
}

/* =========================================================
   17. MOBILE TIPO APP
   Función:
   - Hace que en celular se vea como app vertical.
   - Usa captura.png como fondo completo.
   - Centra logo, inputs y botones.
========================================================= */

@media (max-width: 600px) {
  body {
    background: #075f86;
  }

  .auth-page {
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .auth-layout {
    min-height: 100dvh;
    display: block;
    position: relative;
    background-image: url("../../assets/images/ui/captura.png");
    background-size: cover;
    background-position: center bottom;
    background-repeat: no-repeat;
  }

  .auth-layout__visual {
    display: none;
  }

  .auth-layout__panel {
    min-height: 100dvh;
    width: 100%;
    padding: 34px 28px 28px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background: rgba(7, 95, 134, 0.18);
  }

  .auth-panel {
    width: 100%;
    max-width: 360px;
    min-height: auto;
    display: flex;
    align-items: center;
    justify-content: flex-start;
  }

  .auth-panel__logo {
    width: 170px;
    height: 170px;
    margin-bottom: 12px;
  }

  .auth-form,
  .auth-form--login,
  .auth-form--register,
  .auth-form--register-token {
    width: 100%;
    margin-top: 0;
    gap: 16px;
  }

  .auth-field {
    gap: 8px;
  }

  .auth-field__label {
    font-size: 20px;
    line-height: 1.2;
  }

  .auth-field__input {
    height: 46px;
    border-radius: 10px;
    font-size: 18px;
    background: #d7e0ec;
  }

  .auth-form__actions {
    margin-top: 14px;
  }

  .auth-button--small,
  .auth-button--primary,
  .auth-button--secondary {
    width: 100%;
    max-width: 320px;
    height: 48px;
    border-radius: 999px;
    font-size: 20px;
  }

  .auth-form__links {
    margin-top: 8px;
  }

  .auth-link {
    font-size: 18px;
  }

  .auth-help-text {
    font-size: 15px;
  }

  .auth-token-row {
    display: flex;
    align-items: flex-end;
  }

  .auth-field--token .auth-field__input {
    border-radius: 10px 0 0 10px;
  }

  .auth-button--token {
    width: 112px;
    height: 46px;
    border-radius: 0 10px 10px 0;
    font-size: 16px;
  }

  .auth-page--landing .auth-panel {
    padding-top: 90px;
  }

  .auth-page--landing .auth-panel__logo {
    width: 190px;
    height: 190px;
    margin-bottom: 70px;
  }

  .auth-page--landing .auth-panel__actions {
    width: 100%;
    gap: 32px;
  }

  .auth-page--landing .auth-button {
    width: 100%;
    max-width: 320px;
  }

  .auth-page--landing .auth-divider {
    max-width: 330px;
  }
}

/* =========================================================
   18. MOBILE CHICO
   Función:
   - Ajusta tamaños para pantallas muy angostas.
========================================================= */

@media (max-width: 420px) {
  .auth-layout__panel {
    padding: 28px 22px 24px;
  }

  .auth-panel__logo {
    width: 150px;
    height: 150px;
  }

  .auth-page--landing .auth-panel__logo {
    width: 170px;
    height: 170px;
  }

  .auth-field__label {
    font-size: 18px;
  }

  .auth-button--small,
  .auth-button--primary,
  .auth-button--secondary {
    max-width: 100%;
  }
}