/* Las pantallas de entrada fuera de la aplicacion, con la forma del ingreso del
   LIMS (frontend/src/index.css, .login-*): la foto con su velo de marca a un lado
   y la tarea en el otro. La misma forma, con otro contenido, en el portal publico
   (la foto lleva la presentacion) y en el ingreso del admin de Django. */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--superficie);
  color: var(--texto);
  font-family: var(--fuente);
  font-size: 0.95rem;
  line-height: 1.5;
}

:root[data-tema='oscuro'] body {
  background: var(--fondo);
}

a {
  color: inherit;
}

.acceso {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

/* --- El lado de la marca ------------------------------------------------- */
.presenta {
  position: relative;
  background: var(--marca-profundo);
  color: #ffffff;
}

/* Foto y texto se quedan en pantalla mientras el formulario se recorre. */
.presenta-foto {
  position: sticky;
  top: 0;
  height: 100vh;
  margin-bottom: -100vh;
  overflow: hidden;
}

.presenta-foto img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.presenta-foto::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(150deg, rgb(77 13 13 / 72%), rgb(192 0 0 / 45%));
}

/* Con texto encima el velo se cierra: sobre la foto abierta no se lee. */
.presenta-con-texto .presenta-foto::after {
  background: linear-gradient(150deg, rgb(43 8 8 / 94%), rgb(112 6 6 / 86%));
}

.presenta-texto {
  position: sticky;
  top: 0;
  min-height: 100vh;
  max-width: 41rem;
  margin-left: auto;
  padding: clamp(2rem, 5vh, 3.5rem) clamp(1.5rem, 4vw, 4rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.presenta-logo {
  display: block;
  width: 9.5rem;
  height: auto;
  margin-bottom: clamp(1.5rem, 5vh, 3rem);
}

.presenta h1 {
  margin: 0 0 0.9rem;
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.presenta h2 {
  margin: clamp(1.25rem, 3.5vh, 2rem) 0 0.55rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.presenta p {
  margin: 0;
  max-width: 34rem;
  color: rgb(255 255 255 / 86%);
}

.presenta .entrada {
  font-size: 1.05rem;
  color: rgb(255 255 255 / 92%);
}

.incluye {
  margin: 0;
  padding: 0;
  max-width: 34rem;
  list-style: none;
  color: rgb(255 255 255 / 86%);
}

.incluye li {
  position: relative;
  padding-left: 1.6rem;
}

.incluye li + li {
  margin-top: 0.4rem;
}

.incluye li::before {
  content: '';
  position: absolute;
  top: 0.32em;
  left: 0;
  width: 1rem;
  height: 1rem;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23ffffff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 8.5 6.2 12 13.5 4.5'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Solo cuando la presentacion deja el formulario lejos, en el telefono. */
.ir-al-formulario {
  display: none;
}

/* --- El lado de la tarea ------------------------------------------------- */
.panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  padding: 5rem 1.5rem 1.25rem;
  background: var(--superficie);
}

:root[data-tema='oscuro'] .panel {
  background: var(--fondo);
}

.panel-tema {
  position: absolute;
  top: 1rem;
  right: 1rem;
}

.panel-cuerpo {
  width: min(31rem, 100%);
  margin-block: auto;
  animation: aparecer 0.3s var(--ease-salida);
}

@keyframes aparecer {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}

@media (prefers-reduced-motion: reduce) {
  .panel-cuerpo,
  .tarjeta {
    animation: none;
  }
}

.panel-cuerpo h2 {
  margin: 0 0 0.3rem;
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.panel-cuerpo .nota {
  margin: 0 0 1.4rem;
  color: var(--gris-texto);
}

.panel .credito-lenash {
  margin-top: 2rem;
}

/* --- Formularios, como en el LIMS ---------------------------------------- */
.rejilla {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.9rem;
}

.campo {
  min-width: 0;
}

.campo-ancho {
  grid-column: 1 / -1;
}

label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.8rem;
  font-weight: 600;
}

input:not([type='checkbox']),
textarea {
  display: block;
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--gris-borde);
  border-radius: var(--radio-sm);
  font-family: inherit;
  font-size: 0.9rem;
  background: var(--superficie);
  color: var(--texto);
  transition:
    border-color var(--dur-rapida) var(--ease-salida),
    box-shadow var(--dur-rapida) var(--ease-salida);
}

input:not([type='checkbox']) {
  height: 2.5rem;
}

textarea {
  resize: vertical;
}

textarea::placeholder {
  color: var(--gris-suave);
  opacity: 1;
}

input:not([type='checkbox']):hover:not(:focus),
textarea:hover:not(:focus) {
  border-color: var(--gris-suave);
}

input:not([type='checkbox']):focus,
textarea:focus {
  outline: none;
  border-color: var(--acento);
  box-shadow: var(--anillo);
}

.casilla {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  margin-top: 1.1rem;
}

.casilla input {
  flex: none;
  width: 1.05rem;
  height: 1.05rem;
  margin: 0.15rem 0 0;
  accent-color: var(--acento);
}

.casilla label {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 400;
}

button[type='submit'] {
  width: 100%;
  min-height: 2.75rem;
  margin-top: 1.1rem;
  padding: 0.6rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radio-sm);
  background: var(--accion-fondo);
  color: var(--blanco);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--sombra-sm);
  transition:
    background var(--dur-rapida) var(--ease-salida),
    transform var(--dur-rapida) var(--ease-salida);
}

button[type='submit']:hover {
  background: var(--accion-hover);
}

button[type='submit']:active {
  transform: scale(0.98);
}

button[type='submit']:focus-visible,
summary:focus-visible,
.ir-al-formulario:focus-visible,
.enlace-volver:focus-visible {
  outline: 2px solid var(--acento);
  outline-offset: 2px;
}

.error {
  margin: 0.25rem 0 0;
  color: var(--rojo);
  font-size: 0.82rem;
}

.errores {
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radio-sm);
  background: var(--rojo-fondo);
  color: var(--rojo);
  font-size: 0.85rem;
}

.errores p {
  margin: 0;
}

details {
  margin-top: 1rem;
  color: var(--gris-texto);
  font-size: 0.85rem;
}

summary {
  color: var(--texto);
  font-weight: 600;
  cursor: pointer;
}

details p {
  margin: 0.5rem 0 0;
}

/* Fuera de la vista: la llenan los robots que llenan todo. */
.trampa {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* --- La tarjeta: el ingreso y el gracias --------------------------------- */
.tarjeta {
  display: flex;
  flex-direction: column;
  width: min(360px, 100%);
  margin-block: auto;
  animation: aparecer 0.3s var(--ease-salida);
}

.tarjeta-marca {
  margin: 0 0 0.2rem;
  line-height: 0;
  text-align: center;
}

.tarjeta-marca img {
  width: min(176px, 64%);
  height: auto;
}

.tarjeta-subtitulo {
  margin: 0.5rem 0 1.2rem;
  color: var(--gris-texto);
  font-size: 0.85rem;
  text-align: center;
}

.tarjeta label {
  margin: 0.6rem 0 0.25rem;
}

.tarjeta .errores {
  margin-bottom: 0.4rem;
}

.tarjeta h2 {
  margin: 0.4rem 0 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  text-align: center;
  text-wrap: balance;
}

.tarjeta-texto {
  margin: 0;
  color: var(--gris-texto);
  text-align: center;
}

.tarjeta-texto b {
  color: var(--texto);
  overflow-wrap: anywhere;
}

.enlace-volver {
  align-self: center;
  margin-top: 1.25rem;
  padding: 0.6rem 1rem;
  color: var(--texto);
  font-size: 0.9rem;
  font-weight: 600;
  text-underline-offset: 3px;
}

/* --- Pantallas angostas: como el ingreso del LIMS -------------------------- */
@media (max-width: 860px) {
  .acceso {
    grid-template-columns: minmax(0, 1fr);
  }

  .presenta-foto {
    display: none;
  }

  .presenta {
    background: var(--fondo-login-movil);
  }

  .presenta-texto {
    position: static;
    min-height: 0;
    max-width: none;
    margin: 0;
    padding: 2rem 1.25rem 2.25rem;
  }

  .presenta-logo {
    width: 8rem;
    margin-bottom: 1.5rem;
  }

  .ir-al-formulario {
    display: block;
    margin-top: 1.5rem;
    padding: 0.7rem 1rem;
    border-radius: var(--radio-sm);
    background: #ffffff;
    color: var(--marca-noche);
    font-weight: 600;
    text-align: center;
    text-decoration: none;
  }

  .panel {
    padding: 4.5rem 1.25rem 1.25rem;
  }

  input:not([type='checkbox']) {
    height: 2.75rem;
    font-size: 1rem;
  }

  textarea {
    font-size: 1rem;
  }

  .con-tarjeta .presenta {
    display: none;
  }

  .con-tarjeta .panel {
    min-height: 100vh;
    background: var(--fondo-login-movil);
  }

  .con-tarjeta .tarjeta {
    padding: 2.2rem 1.8rem;
    border-radius: var(--radio-lg);
    background: var(--superficie);
    box-shadow: var(--sombra-md);
  }

  .con-tarjeta .credito-lenash {
    color: rgb(255 255 255 / 72%);
  }

  .con-tarjeta .credito-lenash:hover {
    color: #ffffff;
  }

  .con-tarjeta .tema-riel {
    background: var(--superficie);
  }
}

@media (max-width: 560px) {
  .rejilla {
    grid-template-columns: minmax(0, 1fr);
  }
}
