/* IUSLEAD — Login minimal premium v5 */

.auth-overlay {
  --auth-navy: #0a1628;
  --auth-navy-soft: #132a47;
  --auth-accent: #3d7ab8;
  --auth-gold: #c9923f;
  --auth-text: #0f1c2e;
  --auth-muted: #64748b;
  --auth-line: rgba(15, 28, 46, 0.08);
  --auth-card: rgba(255, 255, 255, 0.92);
  --auth-font: var(--font-ui);

  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  overflow: auto;
  font-family: var(--auth-font);
  background: #060d18;
}

.auth-overlay[hidden]:not(.show) {
  display: none;
}

.auth-overlay.show {
  display: flex;
}

/* Fondo fotográfico municipal + oscurecido */
.auth-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('/img/login-bg.png') center center / cover no-repeat;
  transform: scale(1.04);
  filter: saturate(0.92) brightness(0.72);
}

.auth-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.auth-bg-gradient {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      180deg,
      rgba(6, 13, 24, 0.55) 0%,
      rgba(10, 22, 40, 0.72) 42%,
      rgba(6, 13, 24, 0.84) 100%
    ),
    radial-gradient(ellipse 80% 60% at 20% 0%, rgba(61, 122, 184, 0.22), transparent 55%),
    radial-gradient(ellipse 70% 50% at 100% 100%, rgba(201, 146, 63, 0.14), transparent 50%);
}

.auth-bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.22;
  animation: auth-orb 24s ease-in-out infinite;
}

.auth-bg-orb--1 {
  width: 420px;
  height: 420px;
  left: -8%;
  top: 10%;
  background: rgba(61, 122, 184, 0.45);
}

.auth-bg-orb--2 {
  width: 360px;
  height: 360px;
  right: -5%;
  bottom: 5%;
  background: rgba(201, 146, 63, 0.3);
  animation-delay: -10s;
}

.auth-bg-orb--3 {
  display: none;
}

.auth-bg-shine {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.06), transparent 42%);
}

.auth-bg-grid {
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 90% 80% at 50% 30%, #000 20%, transparent 75%);
}

@keyframes auth-orb {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(16px, -12px); }
}

/* Contenedor único */
.auth-shell {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  animation: auth-rise 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes auth-rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-panel {
  padding: 40px 36px 32px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow:
    0 0 0 1px rgba(15, 28, 46, 0.06),
    0 24px 64px rgba(0, 0, 0, 0.55),
    0 8px 24px rgba(10, 22, 40, 0.18);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

/* Cabecera: logo + admin */
.auth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
}

.auth-logo {
  display: block;
  height: 32px;
  width: auto;
  max-width: 140px;
  object-fit: contain;
  object-position: left center;
}

.auth-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--auth-muted);
  font-family: var(--auth-font);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
  white-space: nowrap;
}

.auth-mode-btn:hover {
  color: var(--auth-text);
  background: rgba(15, 28, 46, 0.05);
}

.auth-mode-btn-icon {
  width: 14px;
  height: 14px;
  opacity: 0.85;
}

.auth-overlay[data-auth-mode="admin"] .auth-mode-btn {
  color: #8a6420;
  background: rgba(201, 146, 63, 0.12);
}

.auth-overlay[data-auth-mode="admin"] .auth-mode-btn:hover {
  background: rgba(201, 146, 63, 0.2);
}

/* Título */
.auth-card-head {
  margin-bottom: 28px;
}

.auth-mode-badge {
  display: none;
}

.auth-card-head h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--auth-text);
  line-height: 1.2;
}

.auth-sub {
  display: none;
}

/* Formulario */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.auth-field span {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.auth-input-wrap {
  position: relative;
}

.auth-input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: #94a3b8;
  pointer-events: none;
}

.auth-field input {
  width: 100%;
  box-sizing: border-box;
  padding: 14px 16px 14px 42px;
  border-radius: 12px;
  border: 1px solid var(--auth-line);
  background: #f8fafc;
  color: var(--auth-text);
  font-family: var(--auth-font);
  font-size: 15px;
  font-weight: 400;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.auth-field input::placeholder {
  color: #94a3b8;
}

.auth-field input:hover {
  border-color: rgba(61, 122, 184, 0.25);
  background: #fff;
}

.auth-field input:focus {
  outline: none;
  border-color: var(--auth-accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(61, 122, 184, 0.12);
}

.auth-submit-btn {
  width: 100%;
  margin-top: 8px;
  padding: 14px 20px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(180deg, #132a47 0%, var(--auth-navy) 100%);
  color: #fff;
  font-family: var(--auth-font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
  box-shadow: 0 4px 16px rgba(10, 22, 40, 0.25);
}

.auth-overlay[data-auth-mode="admin"] .auth-submit-btn {
  background: linear-gradient(180deg, #a67c2e 0%, var(--auth-gold) 100%);
  box-shadow: 0 4px 16px rgba(201, 146, 63, 0.35);
}

.auth-submit-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(10, 22, 40, 0.3);
}

.auth-overlay[data-auth-mode="admin"] .auth-submit-btn:hover:not(:disabled) {
  box-shadow: 0 8px 24px rgba(201, 146, 63, 0.4);
}

.auth-submit-btn:active:not(:disabled) {
  transform: translateY(0);
}

.auth-submit-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.auth-submit-btn svg {
  width: 16px;
  height: 16px;
  opacity: 0.9;
}

.auth-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  color: #b91c1c;
  background: rgba(220, 38, 38, 0.06);
  border: 1px solid rgba(220, 38, 38, 0.12);
}

.auth-error:empty {
  display: none;
}

.auth-hint {
  display: none;
}

.auth-foot {
  margin: 24px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--auth-line);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.auth-fundacion-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 11px 16px;
  border-radius: 10px;
  border: 1px solid #1a365d;
  background: #fff;
  color: #1a365d;
  font-family: var(--auth-font);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}

.auth-fundacion-btn:hover {
  background: #1a365d;
  color: #fff;
}

.auth-foot > span:first-child {
  font-size: 11px;
  font-weight: 600;
  color: var(--auth-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.auth-version {
  font-size: 12px;
  font-weight: 500;
  color: #94a3b8;
  letter-spacing: 0.02em;
}

/* Ocultar panel lateral legacy si queda en DOM */
.auth-brand-panel {
  display: none !important;
}

body.auth-locked #splash-screen,
body.auth-locked #topbar,
body.auth-locked #content,
body.auth-locked #dock-wrapper,
body.auth-locked #titlebar,
body.auth-locked #demo-banner,
body.auth-locked #platform-bar,
body.auth-locked #impersonation-bar,
body.auth-locked #wa-setup-overlay,
body.auth-locked #mobile-bottom-nav {
  visibility: hidden;
}

/* Alineación con visual-refine — marca navy + oro */
.auth-overlay {
  --auth-gold: #C9A055;
  --auth-gold-l: #E2C078;
}

.auth-submit-btn {
  background: linear-gradient(180deg, #7a9af5 0%, #7094F0 100%);
  box-shadow: 0 4px 16px rgba(112, 148, 240, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.auth-submit-btn:hover {
  box-shadow: 0 6px 22px rgba(112, 148, 240, 0.4);
}

.auth-input-wrap:focus-within {
  border-color: rgba(201, 160, 85, 0.45);
  box-shadow: 0 0 0 3px rgba(201, 160, 85, 0.14);
}

@media (max-width: 768px) {
  .auth-overlay {
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  }

  .auth-panel {
    border-radius: 0;
    min-height: 100dvh;
    max-width: none;
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .auth-panel {
    padding: 32px 24px 28px;
    border-radius: 20px;
  }

  .auth-header {
    margin-bottom: 28px;
  }

  .auth-logo {
    height: 28px;
    max-width: 120px;
  }

  .auth-mode-btn {
    padding: 6px 10px;
    font-size: 11px;
  }

  .auth-card-head h2 {
    font-size: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-bg-orb,
  .auth-shell {
    animation: none;
  }

  .auth-submit-btn:hover:not(:disabled) {
    transform: none;
  }
}
