/* Login del Panel Copivalencia — split screen de marca, azul corporativo #285575 */

:root {
  --brand: #285575;
  --brand-dark: #1f4560;
  --brand-deep: #16344d;
  --bg: #f4f6f9;
  --card: #ffffff;
  --border: #dbe2ea;
  --border-strong: #c6d0da;
  --ink: #1d2733;
  --ink-2: #46525f;
  --muted: #64707d;
  --error: #b42318;
  --error-bg: #fdf0ef;
  --error-border: #f0c8c3;
  --warn: #92600a;
  --warn-bg: #fdf3e0;
  --warn-border: #ecd9ab;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.split {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ---------- Lado de marca ---------- */
.brand {
  position: relative;
  flex: 1 1 46%;
  display: flex;
  align-items: center;
  overflow: hidden;
  color: #fff;
  background: linear-gradient(168deg, #2f6288 0%, #285575 34%, #16344d 100%);
}
/* Brillo sutil arriba a la izquierda */
.brand::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 90% at 18% 8%, rgba(255, 255, 255, .10), transparent 55%);
  pointer-events: none;
}
.brand-deco { position: absolute; inset: 0; pointer-events: none; }
/* Gran «C» insinuada, fuera de plano */
.ring {
  position: absolute;
  left: -230px; bottom: -230px;
  width: 620px; height: 620px;
  border-radius: 50%;
  border: 68px solid rgba(255, 255, 255, .045);
}
/* Rayas de escáner (lado derecho, como en el icono) */
.scan {
  position: absolute;
  right: 0; top: 50%;
  transform: translateY(-50%);
  width: clamp(200px, 46%, 380px);
  height: auto;
}
.brand-inner {
  position: relative;
  padding: 48px 9%;
  max-width: 560px;
}
.brand-logo {
  display: block;
  width: min(320px, 78%);
  height: auto;
}
.brand-tagline {
  display: inline-block;
  margin: 24px 0 0;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, .25);
  font-size: 15.5px;
  font-weight: 400;
  letter-spacing: .01em;
  color: rgba(255, 255, 255, .85);
}

/* ---------- Lado del formulario ---------- */
.acceso {
  flex: 1 1 54%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}
.acceso-inner { width: 100%; max-width: 420px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 14px 40px rgba(22, 52, 77, .10), 0 2px 6px rgba(22, 52, 77, .05);
  padding: 36px 38px 34px;
  animation: rise .45s cubic-bezier(.16, 1, .3, 1) both;
}
.card h1 {
  margin: 0 0 6px;
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -.01em;
}
.sub {
  margin: 0 0 20px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}

/* ---------- Mensajes (error / bloqueo / info) ---------- */
.alert {
  margin: 0 0 16px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.45;
}
.alert:empty { display: none; }
.alert-error { background: var(--error-bg); border-color: var(--error-border); color: var(--error); }
.alert-warn {
  background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn);
  font-variant-numeric: tabular-nums;
}
.alert-info { background: #eef2f6; border-color: #d7dfe7; color: #3c4a57; }

/* ---------- Campo de contraseña ---------- */
.field-label {
  display: block;
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}
.pw-wrap { position: relative; }
#password {
  width: 100%;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 11px 44px 11px 13px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
#password:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(40, 85, 117, .16);
}
#password[aria-invalid="true"] { border-color: #d47b73; }
#password[aria-invalid="true"]:focus {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, .12);
}

.pw-toggle {
  position: absolute;
  top: 50%; right: 6px;
  transform: translateY(-50%);
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border: none;
  background: none;
  border-radius: 7px;
  color: var(--muted);
  cursor: pointer;
}
.pw-toggle:hover { color: var(--ink); background: #eef2f6; }
.pw-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.pw-toggle svg { width: 19px; height: 19px; }

/* ---------- Recordarme ---------- */
.remember {
  display: flex; align-items: center; gap: 9px;
  margin: 14px 0 20px;
  font-size: 13.5px;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.remember input {
  width: 16px; height: 16px;
  margin: 0;
  accent-color: var(--brand);
  cursor: pointer;
  flex: 0 0 auto;
}

/* ---------- Botón ---------- */
.btn-entrar {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: var(--brand);
  border: 1px solid var(--brand);
  border-radius: 8px;
  padding: 11px 16px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(22, 52, 77, .18);
  transition: background-color .15s ease, border-color .15s ease;
}
.btn-entrar:hover:not(:disabled) { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-entrar:active:not(:disabled) { background: var(--brand-deep); border-color: var(--brand-deep); }
.btn-entrar:focus-visible { outline: 2px solid var(--brand-dark); outline-offset: 2px; }
.btn-entrar:disabled { opacity: .6; cursor: not-allowed; }

.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
  flex: 0 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Footer ---------- */
.pie {
  margin: 22px 4px 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- Animaciones ---------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
.shake { animation: shake .4s cubic-bezier(.36, .07, .19, .97); }
@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

@media (prefers-reduced-motion: reduce) {
  .card, .shake { animation: none !important; }
  #password, .btn-entrar { transition: none !important; }
  /* Sin rotación continua: el spinner pasa a un anillo uniforme con pulso suave de opacidad. */
  .spinner {
    animation: pulso-suave 1.4s ease-in-out infinite !important;
    border-color: rgba(255, 255, 255, .85);
    border-top-color: rgba(255, 255, 255, .85);
  }
  @keyframes pulso-suave {
    0%, 100% { opacity: 1; }
    50% { opacity: .35; }
  }
}

/* ---------- Móvil: columna única con cabecera de marca compacta ---------- */
@media (max-width: 860px) {
  .split { flex-direction: column; }
  .brand {
    flex: 0 0 auto;
    justify-content: center;
    min-height: 150px;
    padding: 30px 22px;
  }
  .brand-inner {
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .brand-logo { width: 200px; }
  .brand-tagline { margin-top: 12px; padding-top: 10px; font-size: 13px; }
  .ring { display: none; }
  .scan { width: 190px; opacity: .75; }
  .acceso { align-items: flex-start; padding: 28px 18px 36px; }
  .card { padding: 26px 22px 24px; }
}
