/* =========================================================
   Archivo: mto_acceder.css
   Fecha: 2026-02-05 (ajuste UI 2026-02-05, landscape fix 2026-02-07)
   Template: autenticacion/acceder.html
   Objetivo: Login aislado, UI igual a producción, sin JS/jQuery
   Validación: 360 / 414 / 768 / 1024 / 1366+ + landscape (altura baja)
   Estándares: HTML5 semántico, CSS moderno, sin frameworks
========================================================= */

/* -----------------------------------------
   AISLACIÓN (sin tocar Django)
----------------------------------------- */
body.login-isolated .mto_encabezado,
body.login-isolated header,
body.login-isolated .navbar,
body.login-isolated .footer,
body.login-isolated footer,
body.login-isolated .footerTiendalo,
body.login-isolated .footerTiendalo_responsive,
body.login-isolated .navTiendalo,
body.login-isolated .navbarTiendalo_mob {
  display: none;
}

body.login-isolated .main-wrapper,
body.login-isolated .mto_contenido_principal,
body.login-isolated #contenido_principal {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: none;
}

/* -----------------------------------------
   FIX GLOBAL (landscape / iOS / barras dinámicas)
   - Evita corte por 100vh en móviles con UI dinámica.
   - Permite scroll vertical cuando la altura es baja.
----------------------------------------- */
html,
body {
  height: auto;
  min-height: 100%;
  overflow-x: hidden; /* nunca scroll horizontal */
}

body.login-isolated {
  overflow-x: hidden;
  overflow-y: auto; /* habilita scroll vertical si hace falta */
  -webkit-text-size-adjust: 100%;
}

/* -----------------------------------------
   LAYOUT GENERAL LOGIN
----------------------------------------- */
.mto_autenticacion {
  /* Fallback */
  min-height: 100vh;
  background: #fff;

  /* Viewports modernos: evita cortes por barras del navegador */
  min-height: 100svh;
  min-height: 100dvh;
}

.mto_acceder__grid {
  /* Fallback */
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;

  /* Viewports modernos */
  min-height: 100svh;
  min-height: 100dvh;

  /* Importante para que el scroll funcione bien en iOS */
  overflow-x: hidden;
}

@media (min-width: 992px) {
  .mto_acceder__grid {
    grid-template-columns: minmax(380px, 460px) 1fr;
  }
}

/* Panel */
.mto_acceder__panel {
  padding: clamp(1.25rem, 3vw, 2.75rem);
  padding-top: clamp(1.25rem, 3vw, 2.25rem);

  display: flex;
  flex-direction: column;

  /* ✅ 1) Logo arriba: dejamos de centrar verticalmente */
  justify-content: flex-start;

  gap: 1rem;

  /* Permite que el panel pueda scrollear cuando la altura es baja */
  min-height: 0;
}

.mto_acceder__marca {
  display: flex;
  align-items: center;
  justify-content: flex-start; /* ✅ arriba/izq */
}

.mto_acceder__enlace_logo {
  display: inline-flex;
  align-items: center;
}

.mto_acceder__logo {
  width: 165px;
  height: auto;
}

/* Contenido: separa logo del bloque */
.mto_acceder__contenido {
  padding-top: 2.9rem;
}

/* Texto */
.mto_acceder__titulo {
  /* ✅ 5) más chico */
  font-size: clamp(1.25rem, 1.6vw, 1.6rem);
  line-height: 1.18;
  margin: 0 0 0.35rem 0;
}

.mto_acceder__bajada {
  margin: 0 0 1rem 0;
  color: rgba(0, 0, 0, 0.72);
  font-size: 0.95rem;
}

/* Formulario (crispy trae .form-control, .form-label, etc.) */
.mto_acceder__formulario {
  display: grid;
  gap: 0.85rem;
}

/* Labels */
.mto_autenticacion label,
.mto_autenticacion .form-label {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

/* Inputs */
.mto_autenticacion input[type="text"],
.mto_autenticacion input[type="email"],
.mto_autenticacion input[type="password"] {
  width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.35);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
  background: #fff;
}

.mto_autenticacion input:focus-visible {
  outline: 2px solid rgba(90, 241, 57, 0.55);
  outline-offset: 2px;
}

/* Password: botón ojo */
.mto_acceder__campo_password {
  position: relative;
}

.mto_autenticacion #id_password {
  padding-right: 2.65rem; /* espacio para el ojo */
}

.mto_acceder__boton_ojo {
  position: absolute;
  top: 50%;
  right: 0.55rem;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  padding: 0.3rem;
  cursor: pointer;
  line-height: 0;
  border-radius: 10px;
}

.mto_acceder__boton_ojo:focus-visible {
  outline: 2px solid rgba(90, 241, 57, 0.55);
  outline-offset: 2px;
}

/* ✅ 3) Íconos ojo modernos (sin assets externos)
   Usamos SVG embebido en background-image.
*/
.mto_acceder__icono_ojo {
  display: block;
  width: 20px;
  height: 20px;
  background-size: 20px 20px;
  background-repeat: no-repeat;
  opacity: 0.75;
}

/* Ojo abierto */
.mto_acceder__icono_ojo--abierto {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12Z' stroke='%23666666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z' stroke='%23666666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Ojo cerrado */
.mto_acceder__icono_ojo--cerrado {
  display: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M3 3l18 18' stroke='%23666666' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M10.58 10.58A3 3 0 0 0 12 15a3 3 0 0 0 2.42-4.42' stroke='%23666666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M9.88 5.09A10.94 10.94 0 0 1 12 5c6.5 0 10 7 10 7a18.5 18.5 0 0 1-4.26 5.19' stroke='%23666666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M6.11 6.11C3.73 8.05 2 12 2 12s3.5 7 10 7c1.01 0 1.97-.13 2.87-.37' stroke='%23666666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Swap por aria-pressed (si tu JS lo setea, esto ya funciona) */
.mto_acceder__boton_ojo[aria-pressed="true"] .mto_acceder__icono_ojo--abierto {
  display: none;
}
.mto_acceder__boton_ojo[aria-pressed="true"] .mto_acceder__icono_ojo--cerrado {
  display: block;
}

/* Botón submit */
.mto_acceder__boton_submit {
  width: 100%;
  border-radius: 6px;
  padding: 0.65rem 0.9rem;

  /* ✅ 2) "Ingresar" en bold */
  font-weight: 700;
}

/* ✅ 4) Links centrados */
.mto_acceder__ayudas {
  margin-top: 0.3rem;
  display: grid;
  gap: 0.35rem;
  font-size: 0.92rem;
  text-align: center;
}

.mto_acceder__ayuda {
  margin: 0;
  color: rgba(0, 0, 0, 0.7);
}

.mto_acceder__link {
  font-weight: 700;
  text-decoration: underline;
}

/* Fondo (imagen derecha) */
.mto_acceder__fondo {
  display: none;
  background-image: url("../../images/login.jpg");
  background-size: cover;
  background-position: center;
}

@media (min-width: 992px) {
  .mto_acceder__fondo {
    display: block;
  }
}

@media (max-width: 360px) {
  .mto_acceder__ayudas {
    gap: 0.25rem;
    font-size: 0.8rem; /* achica todo el bloque */
    line-height: 1.25;
  }

  .mto_acceder__ayuda {
    white-space: nowrap; /* fuerza una sola línea */
  }

  .mto_acceder__link {
    font-size: 0.8rem;
  }
}

.mto_acceder__link,
.mto_acceder__link:visited,
.mto_acceder__link:hover,
.mto_acceder__link:active,
.mto_acceder__link:focus {
  color: inherit;          /* hereda el color del texto */
  text-decoration: none;   /* sin underline legacy */
  outline: none;
}

/* Hover accesible y moderno */
.mto_acceder__link:hover,
.mto_acceder__link:focus-visible {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

/* -----------------------------------------
   LANDSCAPE: evita corte y habilita scroll
   Apunta a celulares “de costado” (altura baja).
----------------------------------------- */
@media (orientation: landscape) and (max-height: 520px) {
  /* el problema típico: 100vh + altura chica = contenido cortado */
  .mto_acceder__panel {
    padding: 1rem;
    padding-top: 1rem;

    /* scroll interno del panel si no entra */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;

    /* evita rebotes raros y scroll horizontal */
    overflow-x: hidden;
  }

  .mto_acceder__contenido {
    padding-top: 1.25rem; /* reduce el “aire” en landscape */
  }

  .mto_acceder__logo {
    width: 145px; /* un toque más chico para ganar altura */
  }

  .mto_acceder__bajada {
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
  }

  .mto_acceder__formulario {
    gap: 0.7rem;
  }
}

/* Variante más estricta para 320px landscape (iPhone SE / similares) */
@media (orientation: landscape) and (max-height: 420px) {
  .mto_acceder__titulo {
    font-size: 1.15rem;
  }

  .mto_autenticacion input[type="text"],
  .mto_autenticacion input[type="email"],
  .mto_autenticacion input[type="password"] {
    padding: 0.55rem 0.7rem;
  }

  .mto_acceder__ayudas {
    font-size: 0.85rem;
    gap: 0.25rem;
  }
}
