/* ═══════════════════════════════════════════════════════
   Login AVYX — Design System Hospitalar
   Dark Glass · Neuropol · Mobile/Tablet first
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.cdnfonts.com/css/neuropol');

/* ═══════════════════════════════════════════
   BASE
   ═══════════════════════════════════════════ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: #08080a;
  color: #e2e8f0;
  font-family: 'Nunito', 'Segoe UI', sans-serif;
  overflow-x: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}


/* ═══════════════════════════════════════════
   LAYOUT SPLIT
   ═══════════════════════════════════════════ */
.login-container {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ── Lado esquerdo: imagem/arte ── */
.login-visual {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #050507;
}

.login-visual-img {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.login-visual-img--loaded {
  opacity: 1;
}

/* Overlay gradiente sobre a imagem */
.login-visual::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(8,8,10,0.7) 0%, transparent 50%),
    linear-gradient(to right, rgba(8,8,10,0.9) 0%, transparent 30%);
  pointer-events: none;
}

/* Mesh decorativo sutil */
.login-visual::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(ellipse 600px 400px at 20% 80%, rgba(79,70,229,0.08), transparent),
    radial-gradient(ellipse 400px 300px at 80% 20%, rgba(99,102,241,0.05), transparent);
  z-index: 1;
  pointer-events: none;
}

/* ── Lado direito: formulário ── */
.login-form-side {
  flex: 0 0 480px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2.5rem 2rem;
  background: #0c0c0f;
  position: relative;
  z-index: 2;
}

/* Borda luminosa sutil à esquerda */
.login-form-side::before {
  content: '';
  position: absolute;
  top: 15%;
  bottom: 15%;
  left: 0;
  width: 1px;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(99, 102, 241, 0.25) 30%,
    rgba(99, 102, 241, 0.15) 70%,
    transparent
  );
}


/* ═══════════════════════════════════════════
   BRANDING
   ═══════════════════════════════════════════ */
.login-brand {
  text-align: center;
  margin-bottom: 2rem;
}

.login-brand-name {
  font-family: 'Neuropol', sans-serif;
  font-size: 2.4rem;
  font-weight: 400;
  color: #fff;
  letter-spacing: 0.08em;
  /* text-transform: uppercase; */
  margin: 0;
  line-height: 1;
}

.login-brand-tagline {
  font-size: 0.82rem;
  color: #64748b;
  margin-top: 6px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 500;
}

.login-brand-location {
  font-size: 0.72rem;
  color: #475569;
  margin-top: 10px;
  letter-spacing: 0.02em;
}


/* ═══════════════════════════════════════════
   CARD GLASS
   ═══════════════════════════════════════════ */
.login-card {
  width: 100%;
  max-width: 380px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 2rem 1.75rem;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow:
    0 4px 30px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.login-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: #e2e8f0;
  text-align: center;
  margin: 0 0 1.5rem;
  letter-spacing: 0.01em;
}


/* ═══════════════════════════════════════════
   FORM FIELDS
   ═══════════════════════════════════════════ */
.login-field {
  margin-bottom: 1.15rem;
}

.login-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 6px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.login-input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-size: 0.9rem;
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  outline: none;
  transition: all 0.25s ease;
  font-family: inherit;
}

.login-input::placeholder {
  color: #475569;
}

.login-input:focus {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Input group (senha + toggle) */
.login-input-group {
  display: flex;
  gap: 0;
}

.login-input-group .login-input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: none;
}

.login-toggle-pwd {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: none;
  border-radius: 0 10px 10px 0;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s;
}

.login-toggle-pwd:hover {
  color: #a5b4fc;
  background: rgba(255, 255, 255, 0.06);
}

.login-toggle-pwd .iconify {
  font-size: 1.1rem;
}


/* ═══════════════════════════════════════════
   BOTÕES
   ═══════════════════════════════════════════ */
.login-btn {
  width: 100%;
  padding: 0.7rem;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: inherit;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.25s ease;
  letter-spacing: 0.02em;
}

.login-btn .iconify {
  font-size: 1.1rem;
}

/* Principal */
.login-btn--primary {
  background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
  color: #fff;
  box-shadow:
    0 2px 12px rgba(79, 70, 229, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.login-btn--primary:hover {
  background: linear-gradient(135deg, #5b52f0 0%, #4338ca 100%);
  box-shadow:
    0 4px 20px rgba(79, 70, 229, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.login-btn--primary:active {
  transform: translateY(0);
  box-shadow: 0 1px 6px rgba(79, 70, 229, 0.2);
}

/* Facial (secundário glass) */
.login-btn--facial {
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.login-btn--facial:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.12);
}


/* ═══════════════════════════════════════════
   DIVIDER
   ═══════════════════════════════════════════ */
.login-divider {
  display: flex;
  align-items: center;
  margin: 1.25rem 0;
  color: #334155;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
}

.login-divider span {
  padding: 0 14px;
}


/* ═══════════════════════════════════════════
   LINKS
   ═══════════════════════════════════════════ */
.login-links {
  display: flex;
  justify-content: space-between;
  margin-top: 1.25rem;
}

.login-link {
  font-size: 0.75rem;
  color: #64748b;
  text-decoration: none;
  transition: color 0.2s;
  font-weight: 500;
}

.login-link:hover {
  color: #a5b4fc;
}


/* ═══════════════════════════════════════════
   FLASH ALERTS
   ═══════════════════════════════════════════ */
.login-alert {
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: login-alert-in 0.3s ease;
}

@keyframes login-alert-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.login-alert--danger {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.login-alert--success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
  color: #86efac;
}

.login-alert--warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: #fcd34d;
}

.login-alert--info {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}

.login-alert-close {
  margin-left: auto;
  background: none;
  border: none;
  color: inherit;
  opacity: 0.5;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0;
  line-height: 1;
}

.login-alert-close:hover {
  opacity: 1;
}


/* ═══════════════════════════════════════════
   CÂMERA MODAL
   ═══════════════════════════════════════════ */
.cam-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.97);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.cam-modal--active { display: flex; }

.cam-content {
  width: 100%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-height: 100dvh;
}

.cam-header {
  text-align: center;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.cam-header h3 {
  font-family: 'Neuropol', sans-serif;
  color: #fff;
  font-size: 1.3rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  margin: 0 0 6px;
}

.cam-header p {
  color: #64748b;
  margin: 0;
  font-size: 0.8rem;
}

/* Desafio liveness */
.cam-challenge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px 18px;
  margin-bottom: 14px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: cam-fadein 0.5s ease;
  width: 100%;
}

.cam-challenge .iconify {
  font-size: 1.3rem;
  color: #a5b4fc;
}

.cam-challenge span {
  color: #e2e8f0;
  font-size: 0.85rem;
  font-weight: 500;
}

@keyframes cam-fadein {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Video container */
.cam-video-wrap {
  width: 100%;
  max-height: 55dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 1;
  overflow: hidden;
  border-radius: 16px;
  position: relative;
}

.cam-video {
  width: 100%;
  max-height: 55dvh;
  border-radius: 16px;
  transform: scaleX(-1);
  -webkit-transform: scaleX(-1);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  object-fit: cover;
  display: block;
}

/* Guia facial oval */
.cam-face-guide {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 55%;
  max-width: 220px;
  pointer-events: none;
  animation: cam-guide-pulse 2.5s ease-in-out infinite;
}

.cam-face-guide svg {
  width: 100%;
  height: auto;
}

@keyframes cam-guide-pulse {
  0%, 100% { opacity: 0.5; }
  50%      { opacity: 0.9; }
}

/* Botões câmera */
.cam-controls {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 20px;
  flex-shrink: 0;
  padding-bottom: 20px;
}

.cam-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cam-btn--capture {
  background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
  color: #fff;
  border: 2px solid rgba(99, 102, 241, 0.4);
}

.cam-btn--capture:hover {
  box-shadow: 0 6px 24px rgba(79, 70, 229, 0.4);
}

.cam-btn--cancel {
  background: rgba(255, 255, 255, 0.06);
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.cam-btn--cancel:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.cam-btn:active {
  transform: scale(0.93);
}

/* Progresso liveness */
.cam-liveness {
  width: 100%;
  max-width: 400px;
  margin-top: 20px;
  text-align: center;
  display: none;
}

.cam-progress-track {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 10px;
}

.cam-progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #4f46e5, #a5b4fc);
  border-radius: 2px;
  transition: width 0.2s ease;
}

.cam-liveness-status {
  color: #64748b;
  font-size: 0.8rem;
  margin: 0;
}

/* Loading */
.cam-loading {
  text-align: center;
  color: #94a3b8;
  margin-top: 20px;
  display: none;
}

.cam-loading--active { display: block; }

.cam-spinner {
  width: 36px;
  height: 36px;
  border: 2px solid rgba(255, 255, 255, 0.06);
  border-top-color: #a5b4fc;
  border-radius: 50%;
  animation: cam-spin 0.7s linear infinite;
  margin: 0 auto 12px;
}

@keyframes cam-spin {
  to { transform: rotate(360deg); }
}


/* ═══════════════════════════════════════════
   SUCESSO OVERLAY
   ═══════════════════════════════════════════ */
.login-success {
  display: none;
  position: fixed;
  inset: 0;
  background: #08080a;
  z-index: 10000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  opacity: 0;
}

.login-success--show {
  display: flex;
  animation: login-success-in 0.5s ease forwards;
}

@keyframes login-success-in {
  to { opacity: 1; }
}

/* Grid tech background */
.login-success-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 60px 60px;
  animation: login-grid-move 25s linear infinite;
  opacity: 0.6;
}

@keyframes login-grid-move {
  0%   { transform: translate(0, 0); }
  100% { transform: translate(60px, 60px); }
}

.login-success-content {
  text-align: center;
  color: #fff;
  max-width: 480px;
  padding: 2.5rem;
  z-index: 1;
}

/* Círculo scanner */
.login-scan-ring {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 2.5rem;
  position: relative;
}

.login-scan-ring::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: #a5b4fc;
  animation: login-ring-rotate 1.8s linear infinite;
}

@keyframes login-ring-rotate {
  to { transform: rotate(360deg); }
}

.login-scan-ring .iconify {
  font-size: 3.2rem;
  color: #fff;
  animation: login-check-in 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) 0.3s both;
  z-index: 1;
}

@keyframes login-check-in {
  0%   { transform: scale(0); opacity: 0; }
  50%  { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

/* Scan line */
.login-scan-line {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 50%;
}

.login-scan-line::before {
  content: '';
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(165, 180, 252, 0.4), transparent);
  animation: login-scan-move 2.5s ease-in-out infinite;
}

@keyframes login-scan-move {
  0%, 100% { top: 0; opacity: 0; }
  50%      { top: 50%; opacity: 0.5; }
}

.login-success-label {
  font-size: 0.72rem;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  margin-bottom: 10px;
  animation: login-slide-up 0.4s ease 0.4s both;
}

.login-success-title {
  font-family: 'Neuropol', sans-serif;
  font-size: 1.6rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
  animation: login-slide-up 0.4s ease 0.5s both;
}

.login-success-msg {
  font-size: 0.95rem;
  color: #94a3b8;
  margin-bottom: 6px;
  animation: login-slide-up 0.4s ease 0.6s both;
}

.login-success-sub {
  font-size: 0.78rem;
  color: #334155;
  animation: login-slide-up 0.4s ease 0.7s both;
}

@keyframes login-slide-up {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}


/* ═══════════════════════════════════════════
   ERRO TOAST
   ═══════════════════════════════════════════ */
.login-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e1e1e;
  color: #fca5a5;
  padding: 0.75rem 1.25rem;
  border-radius: 10px;
  border: 1px solid rgba(239, 68, 68, 0.2);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  z-index: 10001;
  min-width: 280px;
  max-width: 90%;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 500;
  display: none;
  animation: login-toast-in 0.3s ease;
}

.login-toast--show { display: block; }

@keyframes login-toast-in {
  from { transform: translateX(-50%) translateY(-80px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0); opacity: 1; }
}


/* ═══════════════════════════════════════════
   RESPONSIVE — TABLET (< 1024px)
   ═══════════════════════════════════════════ */
@media (max-width: 1023px) {
  .login-container {
    flex-direction: column;
  }

  .login-visual {
    display: none;
  }

  .login-form-side {
    flex: 1;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 2rem 1.5rem;
  }

  .login-form-side::before {
    display: none;
  }

  .login-brand-name {
    font-size: 2rem;
  }

  .cam-content { max-width: 100%; }
  .cam-video-wrap { max-height: 45dvh; }
  .cam-video { max-height: 45dvh; }
  .cam-controls { margin-top: 14px; padding-bottom: 30px; }
}

/* ── Landscape tablet/mobile ── */
@media (max-width: 1023px) and (orientation: landscape) {
  .cam-video-wrap { max-height: 40dvh; }
  .cam-video { max-height: 40dvh; }
  .cam-header h3 { font-size: 1.1rem; }
  .cam-header p { font-size: 0.72rem; }
  .cam-btn { width: 56px; height: 56px; font-size: 1.2rem; }
}


/* ═══════════════════════════════════════════
   RESPONSIVE — MOBILE (< 576px)
   ═══════════════════════════════════════════ */
@media (max-width: 575px) {
  .login-form-side {
    padding: 1.5rem 1.15rem;
  }

  .login-brand-name {
    font-size: 1.8rem;
  }

  .login-brand-tagline {
    font-size: 0.72rem;
  }

  .login-card {
    padding: 1.5rem 1.25rem;
    border-radius: 14px;
  }

  .login-btn {
    padding: 0.65rem;
  }

  .login-success-title {
    font-size: 1.3rem;
  }

  .login-scan-ring {
    width: 100px;
    height: 100px;
  }

  .login-scan-ring .iconify {
    font-size: 2.5rem;
  }
}

/* ── iOS input zoom fix ── */
input[type="text"],
input[type="email"],
input[type="password"] {
  font-size: 16px !important;
}