/* ==========================================================================
   Login.css — Diseño profesional con animaciones sutiles y modal de errores
   ========================================================================== */

/* ------------------ Variables y ajustes base ------------------ */
:root{
  --bg1:#0f172a;           /* azul noche */
  --bg2:#1e293b;           /* gris-azul */
  --acc:#5b9dff;           /* acento principal */
  --acc-2:#7ee3ff;         /* acento secundario */
  --ink:#e6eefc;           /* texto claro */
  --muted:#a4b2cc;         /* texto tenue */
  --danger:#ef4444;        /* error */
  --glass: rgba(255,255,255,0.08);
  --glass-bd: rgba(255,255,255,0.18);
  --shadow: 0 20px 60px rgba(0,0,0,.35);
  --radius-xl: 18px;
  --radius-md: 12px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial; }

/* ------------------ Lienzo y fondo animado ------------------ */
.login-body{
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--ink);
  background: radial-gradient(1200px 800px at 10% 10%, #1b2a4a 0%, transparent 60%),
              radial-gradient(1000px 600px at 85% 85%, #0a3a5e 0%, transparent 65%),
              linear-gradient(135deg, var(--bg1), var(--bg2));
}

/* partículas/acentos */
.login-body::before,
.login-body::after{
  content:"";
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: .55;
  pointer-events: none;
}
.login-body::before{
  width: 460px; height: 460px;
  background: radial-gradient(circle, var(--acc), transparent 60%);
  top: -120px; left: -120px;
  animation: floatA 16s ease-in-out infinite;
}
.login-body::after{
  width: 520px; height: 520px;
  background: radial-gradient(circle, var(--acc-2), transparent 60%);
  bottom: -140px; right: -140px;
  animation: floatB 20s ease-in-out infinite;
}

@keyframes floatA{
  0%,100%{ transform: translate(0,0) scale(1); }
  50%    { transform: translate(30px, -20px) scale(1.05); }
}
@keyframes floatB{
  0%,100%{ transform: translate(0,0) scale(1); }
  50%    { transform: translate(-25px, 25px) scale(0.98); }
}

/* ------------------ Tarjeta (glassmorphism) ------------------ */
.login-card{
  position: relative;
  width: 94%;
  max-width: 420px;
  padding: 28px;
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.06));
  border: 1px solid var(--glass-bd);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transform: translateY(6px);
  animation: cardIn .7s cubic-bezier(.2,.7,.2,1) both;
}
@keyframes cardIn{
  from { transform: translateY(18px); opacity: 0; }
  to   { transform: translateY(6px);  opacity: 1; }
}

/* acento top */
.login-card::before{
  content:"";
  position:absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(91,157,255,.55), rgba(126,227,255,.35), rgba(255,255,255,0));
  -webkit-mask: 
    linear-gradient(#000 0 0) content-box, 
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events:none;
}

/* ------------------ Encabezado ------------------ */
.login-logo{
  display:flex; align-items:center; gap:12px; margin-bottom: 4px;
  font-weight: 800; font-size: 20px; letter-spacing:.3px;
}
.login-desc{
  margin: 0 0 14px 0; color: var(--muted); font-size: 13px;
}

/* ------------------ Campos con label flotante ------------------ */
.form{
  display: grid;
  gap: 14px;
}

.form-field{
  position: relative;
}
.input{
  width: 100%;
  padding: 14px 14px 14px 44px;   /* espacio para ícono */
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(12,18,32,.45);
  color: var(--ink);
  outline: none;
  transition: border .2s ease, box-shadow .2s ease, background .2s ease;
}
.input::placeholder{ color: transparent; } /* para label flotante */
.input:focus{
  border-color: rgba(126,227,255,.75);
  box-shadow: 0 0 0 4px rgba(126,227,255,.18);
  background: rgba(12,18,32,.62);
}

/* label flotante */
.label{
  position:absolute; left: 44px; top: 50%;
  transform: translateY(-50%);
  font-size: 14px; color: #c6d4ef;
  transition: all .18s ease;
  pointer-events: none;
  background: transparent;
  padding: 0 6px;
}
.input:focus + .label,
.input:not(:placeholder-shown) + .label{
  top: 0; transform: translateY(-50%) scale(.92);
  background: linear-gradient(180deg, rgba(15,23,42,0), rgba(15,23,42,.65));
  color: #e6f2ff;
}

/* ícono dentro del campo */
.field-icon{
  position:absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: #9fb6db; font-size: 18px;
}

/* ayuda/errores pequeños bajo campo (no modal) */
.help{
  margin-top: 6px; font-size: 12px; color: #cbd5e1;
}
.help.error-inline{ color: #ffc7c7; }

/* ------------------ Acciones ------------------ */
.actions{
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 6px; gap: 10px; flex-wrap: wrap;
}
.remember{
  display:flex; align-items:center; gap:8px; font-size: 13px; color: var(--muted);
}
.link{
  font-size: 13px; color: #b5d3ff; text-decoration: none;
}
.link:hover{ text-decoration: underline; }

/* botón principal */
.btn-login{
  margin-top: 6px;
  width: 100%;
  padding: 12px 14px;
  border: none; border-radius: 12px;
  background: linear-gradient(135deg, #4891ff, #2d6bff 60%, #6cc9ff);
  color: white; font-weight: 800; letter-spacing: .2px;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(77,139,255,.25);
  transition: transform .06s ease, box-shadow .15s ease, filter .2s ease;
}
.btn-login:hover{ box-shadow: 0 16px 38px rgba(77,139,255,.35); filter: brightness(1.03); }
.btn-login:active{ transform: translateY(1px); }

/* pie de la tarjeta */
.login-footer{
  margin-top: 16px; text-align: center; color: var(--muted); font-size: 12px;
}

/* ------------------ Modal de error (emergente) ------------------ */
.alert-overlay{
  position: fixed; inset: 0;
  background: rgba(8,12,22,0.54);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: none; align-items: center; justify-content: center;
  z-index: 9999;
}
.alert-overlay.is-open{ display: flex; }

.alert-modal{
  background: linear-gradient(180deg, rgba(255,255,255,.12), rgba(255,255,255,.07));
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 16px;
  box-shadow: 0 18px 60px rgba(0,0,0,.45);
  width: min(460px, 92vw);
  color: #fef2f2;
  overflow: hidden;
  animation: alertIn .22s ease-out both, shake .42s cubic-bezier(.36,.07,.19,.97) 1;
}
@keyframes alertIn{
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}
@keyframes shake{
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* header del modal */
.alert-head{
  display:flex; align-items:center; gap:10px;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(239,68,68,.25), rgba(239,68,68,.15));
  border-bottom: 1px solid rgba(255,255,255,.18);
}
.alert-icon{
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: rgba(239,68,68,.25);
  color: #ffb4b4; font-weight: 900; font-size: 18px;
}
.alert-title{ margin:0; font-weight: 800; letter-spacing:.2px; }

/* cuerpo y acciones */
.alert-body{ padding: 14px 16px; color: #ffecec; font-size: 14px; }
.alert-actions{
  display:flex; gap:10px; justify-content:flex-end; padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.18);
}
.btn-danger{
  background: #ef4444; color: #fff; border: none; padding: 10px 14px;
  border-radius: 10px; font-weight: 800; cursor: pointer;
}
.btn-ghost{
  background: transparent; color: #e6eefc; border: 1px solid rgba(255,255,255,.22);
  padding: 10px 14px; border-radius: 10px; font-weight: 700; cursor: pointer;
}
.btn-danger:hover{ filter: brightness(1.05); }
.btn-ghost:hover{ background: rgba(255,255,255,.06); }

/* ------------------ Estados y accesibilidad ------------------ */
.input.error{
  border-color: rgba(239,68,68,.85);
  box-shadow: 0 0 0 4px rgba(239,68,68,.18);
}
:focus-visible{ outline: 3px solid rgba(126,227,255,.45); outline-offset: 2px; }

/* ------------------ Responsive fino ------------------ */
@media (max-width: 420px){
  .login-card { padding: 22px; border-radius: 16px; }
  .input { padding: 13px 13px 13px 42px; }
  .label { left: 42px; }
}

/* ------------------ Reduce motion ------------------ */
@media (prefers-reduced-motion: reduce){
  .login-body::before, .login-body::after{ animation: none; }
  .login-card{ animation: none; }
  .alert-modal{ animation: alertIn .22s ease-out both; }
}
