/* greb-portal · la pantalla de entrada (greb_portal/login.cljc).
 *
 * Traducción a CSS plano del login de agrobiotek.com, que antes eran clases
 * de Tailwind desde la CDN. Sin Tailwind, para que el LIMS (antd + sus
 * temas) la cargue sin traerse otro framework entero.
 *
 * Todo cuelga de `.greb-login` y los campos van con dos clases: el host
 * puede tener sus propias reglas para `input[type=text]` (el LIMS las
 * tiene), y con (0,2,0) éstas les ganan sin `!important`.
 *
 * El host fija la foto del fondo con `--greb-login-fondo`: la imagen pesa
 * 1,3 MB y cada app ya la sirve desde su sitio.
 */

@keyframes greb-login-flota {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-20px) rotate(5deg); }
}
@keyframes greb-login-brillo-tarjeta {
  0%, 100% { box-shadow: 0 0 20px rgba(255,255,255,.3), 0 25px 50px -12px rgba(0,0,0,.25); }
  50%      { box-shadow: 0 0 40px rgba(255,255,255,.6), 0 25px 50px -12px rgba(0,0,0,.25); }
}
@keyframes greb-login-aparece { from { opacity: 0; } to { opacity: 1; } }
@keyframes greb-login-sube {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
@keyframes greb-login-barrido {
  0%   { transform: translateX(-150%); }
  100% { transform: translateX(150%); }
}

.greb-login {
  --greb-login-fondo: none;
  position: relative; overflow: hidden;
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px; box-sizing: border-box;
  font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  line-height: 1.5;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  background:
    linear-gradient(135deg, rgba(14,165,233,.85) 0%, rgba(37,99,235,.9) 100%),
    var(--greb-login-fondo);
  background-size: cover; background-position: center; background-attachment: fixed;
  opacity: 0; animation: greb-login-aparece .4s ease-out forwards;
}
.greb-login *, .greb-login *::before, .greb-login *::after { box-sizing: border-box; }

/* ── Las franjas de luz ─────────────────────────────────────────────── */
.greb-login__fondo { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.greb-login__franja {
  position: absolute; width: 4px; height: 100%;
  background: linear-gradient(to bottom, transparent, rgba(255,255,255,.1), transparent);
  opacity: 0;
  animation: greb-login-aparece 1s ease-out .3s forwards, greb-login-flota 4s ease-in-out 1.3s infinite;
}
.greb-login__franja--1 { left: 10%; animation-delay: .3s, 1.3s; }
.greb-login__franja--2 { left: 30%; animation-delay: 1.3s, 2.3s; }
.greb-login__franja--3 { left: 50%; animation-delay: 2.3s, 3.3s; }
.greb-login__franja--4 { left: 70%; animation-delay: 1.8s, 2.8s; }
.greb-login__franja--5 { left: 90%; animation-delay: .8s, 1.8s; }

/* ── La tarjeta de cristal ──────────────────────────────────────────── */
.greb-login__caja { position: relative; z-index: 10; width: 100%; max-width: 28rem; }
.greb-login__tarjeta {
  overflow: hidden; border-radius: 24px;
  background: rgba(255,255,255,.4);
  -webkit-backdrop-filter: blur(40px); backdrop-filter: blur(40px);
  border: 1px solid rgba(255,255,255,.5);
  opacity: 0;
  animation: greb-login-sube .8s cubic-bezier(.16,1,.3,1) forwards,
             greb-login-brillo-tarjeta 2s ease-in-out .8s infinite;
}
.greb-login__cuerpo { padding: 32px; }
.greb-login__cabeza { text-align: center; }

.greb-login__iconos {
  display: flex; justify-content: center; align-items: center; gap: 12px;
  margin-bottom: 24px;
}
.greb-login__flota { animation: greb-login-flota 3s ease-in-out infinite; }
.greb-login__flota--2 { animation-delay: .3s; }
.greb-login__flota--3 { animation-delay: .6s; }
.greb-login__flota img { display: block; width: 100%; height: 100%; }
.greb-login__flota--lado   { width: 64px; height: 64px; }
.greb-login__flota--centro { width: 80px; height: 80px; }

/* El logo lo pone el host; esta clase le da el tamaño del de agrobiotek. */
.greb-login__marca {
  display: block; margin: 0 auto; height: 120px; width: auto; max-width: 100%;
  filter: drop-shadow(0 4px 3px rgba(0,0,0,.07)) drop-shadow(0 2px 2px rgba(0,0,0,.06));
}
.greb-login__marca-texto {
  margin: 0; font-size: 40px; font-weight: 800; letter-spacing: .04em; color: #0e5f8a;
}
.greb-login__sub { margin: 0; font-size: 14px; font-weight: 500; color: #1e3a8a; }

/* ── El formulario ──────────────────────────────────────────────────── */
.greb-login__form { margin: 40px 0 0; display: flex; flex-direction: column; gap: 24px; }

.greb-login__anim { opacity: 0; animation: greb-login-sube .8s cubic-bezier(.16,1,.3,1) forwards; }
.greb-login__anim--2 { animation-delay: .2s; }
.greb-login__anim--3 { animation-delay: .3s; }
.greb-login__anim--4 { animation-delay: .4s; }
.greb-login__anim--5 { animation-delay: .5s; }
.greb-login__anim--6 { animation-delay: .6s; }

.greb-login__campo { position: relative; }
.greb-login__icono {
  position: absolute; left: 20px; top: 50%; transform: translateY(-50%);
  font-size: 24px; line-height: 1; transition: transform .15s;
  pointer-events: none;
}
.greb-login__campo:hover .greb-login__icono { transform: translateY(-50%) scale(1.1); }

.greb-login .greb-login__input {
  display: block; width: 100%; margin: 0;
  padding: 16px 24px 16px 56px;
  font: inherit; font-size: 16px; line-height: 24px; color: #2563eb;
  background: rgba(255,255,255,.3);
  border: 1px solid rgba(255,255,255,.2); border-radius: 16px;
  box-shadow: none; outline: none;
  transition: background .3s, box-shadow .3s;
}
.greb-login .greb-login__input:focus {
  background: rgba(255,255,255,.4);
  box-shadow: 0 0 0 4px rgba(34,211,238,.5);
  border-color: rgba(255,255,255,.2);
}
.greb-login .greb-login__input::placeholder { color: #1e40af; opacity: 1; }
/* Con algo a la derecha (el ojo del LIMS) el texto no se mete debajo. */
.greb-login__campo:has(.greb-login__extra) .greb-login__input { padding-right: 56px; }
.greb-login__extra {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  display: inline-flex; padding: 6px; border: 0; border-radius: 8px;
  background: transparent; color: #1e3a8a; cursor: pointer;
}
.greb-login__extra:hover { background: rgba(255,255,255,.3); }
.greb-login__extra svg { width: 20px; height: 20px; }

/* ── Recordarme · ¿Olvidaste tu contraseña? ─────────────────────────── */
.greb-login__fila {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-size: 14px; color: #1e3a8a;
}
.greb-login__recordar {
  position: relative; display: inline-flex; align-items: center; gap: 12px;
  cursor: pointer; font-weight: 500;
}
.greb-login__check {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.greb-login__pista {
  position: relative; flex-shrink: 0; width: 44px; height: 24px; border-radius: 9999px;
  background: rgba(255,255,255,.3); transition: background .15s;
}
.greb-login__pista::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; border-radius: 9999px;
  background: #fff; border: 1px solid #d1d5db; transition: transform .15s;
}
.greb-login__recordar:hover .greb-login__pista { background: rgba(255,255,255,.4); }
.greb-login__check:checked + .greb-login__pista { background: #06b6d4; }
.greb-login__check:checked + .greb-login__pista::after { transform: translateX(100%); border-color: #fff; }
.greb-login__check:focus-visible + .greb-login__pista { box-shadow: 0 0 0 3px rgba(34,211,238,.6); }

.greb-login .greb-login__olvide {
  padding: 8px 16px; border-radius: 9999px; font-weight: 500; text-decoration: none;
  color: #1e3a8a; background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.2);
  transition: background .15s;
}
.greb-login .greb-login__olvide:hover { background: rgba(255,255,255,.3); }

/* ── El botón ───────────────────────────────────────────────────────── */
.greb-login__entrar {
  position: relative; overflow: hidden; width: 100%; margin: 0;
  padding: 16px 0; border: 0; border-top: 1px solid rgba(255,255,255,.2); border-radius: 16px;
  font: inherit; font-size: 20px; line-height: 28px; font-weight: 700; color: #fff;
  background: linear-gradient(to right, #06b6d4, #2563eb);
  box-shadow: 0 10px 15px -3px rgba(59,130,246,.3), 0 4px 6px -4px rgba(59,130,246,.3);
  cursor: pointer;
  transition: transform .3s, box-shadow .3s;
}
.greb-login__entrar:hover {
  transform: scale(1.02);
  box-shadow: 0 10px 15px -3px rgba(34,211,238,.4), 0 4px 6px -4px rgba(34,211,238,.4);
}
.greb-login__entrar:disabled { cursor: progress; filter: saturate(.7); transform: none; }
.greb-login__brillo {
  position: absolute; inset: 0; z-index: 1; transform: translateX(-100%);
  background: linear-gradient(to right, transparent, rgba(255,255,255,.25), transparent);
}
.greb-login__entrar:hover .greb-login__brillo { animation: greb-login-barrido 1.5s infinite; }
.greb-login__entrar-texto { position: relative; z-index: 2; letter-spacing: .025em; }

/* El rojo claro de agrobiotek (#fca5a5) no se leía sobre el cristal. */
.greb-login__error { margin-top: -12px; text-align: center; font-size: 14px; font-weight: 500; color: #b91c1c; }
.greb-login__error:empty { display: none; }

.greb-login__registro { margin-top: 24px; text-align: center; font-size: 14px; color: #1e3a8a; }
.greb-login .greb-login__registro a {
  color: #2563eb; font-weight: 600; text-decoration: underline; text-decoration-color: #2563eb;
}

/* ── El pie ─────────────────────────────────────────────────────────── */
.greb-login__pie {
  padding: 24px 40px; text-align: center; font-size: 14px; color: #1e3a8a;
  background: rgba(255,255,255,.05);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255,255,255,.1);
}
.greb-login__pie-titulo {
  display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 8px;
  font-weight: 600; letter-spacing: .025em;
}
.greb-login__pie p { margin: 0; color: #3b82f6; }
.greb-login__pie-greb { display: inline-flex; align-items: center; gap: 6px; color: #3b82f6; }
.greb-login__pie-greb img { height: 14px; width: auto; }

@media (max-width: 480px) {
  .greb-login__cuerpo { padding: 24px 20px; }
  .greb-login__pie { padding: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .greb-login, .greb-login * {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* El icono del ojo que no toca. abt lo alterna con `style.display` desde
   login.js, que pisa esta regla; en Reagent la clase cambia sola. */
.greb-login__extra .greb-login__oculto { display: none; }
