/* Tela de login. Usa as variáveis de cor do style.css. */

body.login-page {
  padding: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--bg);
}

/* ---------- Fundo: brilhos desfocados + grade sutil ---------- */

.login-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
  animation: drift 18s ease-in-out infinite alternate;
}

.orb-1 {
  width: 520px;
  height: 520px;
  top: -160px;
  left: -120px;
  background: radial-gradient(circle, #6366f1, transparent 70%);
}

.orb-2 {
  width: 440px;
  height: 440px;
  bottom: -140px;
  right: -100px;
  background: radial-gradient(circle, #22c55e, transparent 70%);
  opacity: 0.28;
  animation-duration: 22s;
  animation-delay: -6s;
}

.orb-3 {
  width: 360px;
  height: 360px;
  top: 40%;
  left: 55%;
  background: radial-gradient(circle, #a855f7, transparent 70%);
  opacity: 0.3;
  animation-duration: 26s;
  animation-delay: -12s;
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at center, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 20%, transparent 75%);
}

@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(60px, 40px) scale(1.12); }
}

/* ---------- Card ---------- */

.login-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 24px 16px;
  display: grid;
  place-items: center;
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 36px 32px 28px;
  border-radius: 20px;
  background: linear-gradient(160deg, rgba(30, 34, 45, 0.78), rgba(18, 20, 27, 0.82));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 0 0 1px rgba(99, 102, 241, 0.06),
    0 30px 80px -20px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  animation: rise 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.login-card.shake {
  animation: shake 0.42s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-6px); }
  40%, 60% { transform: translateX(6px); }
}

/* ---------- Marca ---------- */

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  box-shadow: 0 8px 24px -6px rgba(99, 102, 241, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.brand-mark svg {
  width: 30px;
  height: 30px;
}

.pulse-line {
  stroke-dasharray: 80;
  stroke-dashoffset: 80;
  animation: trace 2.4s ease-in-out infinite;
}

@keyframes trace {
  0% { stroke-dashoffset: 80; opacity: 0.4; }
  45% { stroke-dashoffset: 0; opacity: 1; }
  80% { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: -80; opacity: 0.4; }
}

.brand-eyebrow {
  margin: 0 0 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #a5b4fc;
}

.brand-title {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff, #b4b9c8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.login-subtitle {
  margin: 0 0 26px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-muted);
}

/* ---------- Campos ---------- */

.login-form {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 7px;
}

.field-label {
  font-size: 12px;
  font-weight: 600;
  color: #c3c8d4;
}

.field-control {
  position: relative;
  display: flex;
  align-items: center;
  border-radius: 11px;
  background: rgba(8, 10, 14, 0.55);
  border: 1px solid var(--border);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.field-control:hover {
  border-color: #353b4a;
}

.field-control:focus-within {
  border-color: var(--accent);
  background: rgba(8, 10, 14, 0.8);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18);
}

.field-icon {
  width: 18px;
  height: 18px;
  margin-left: 13px;
  flex-shrink: 0;
  color: #6b7385;
  transition: color 0.15s ease;
}

.field-control:focus-within .field-icon {
  color: #a5b4fc;
}

.field-control input {
  flex: 1;
  min-width: 0;
  padding: 13px 12px 13px 10px;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.field-control input::placeholder {
  color: #545b6b;
}

/* Autofill do Chrome pinta o campo de amarelo/branco: mantém o tema escuro. */
.field-control input:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px #0d0f14 inset;
  caret-color: var(--text);
}

.toggle-password {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-right: 4px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #6b7385;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.toggle-password:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.toggle-password:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.toggle-password svg {
  width: 18px;
  height: 18px;
}

.toggle-password .eye-closed,
.toggle-password[aria-pressed="true"] .eye-open {
  display: none;
}

.toggle-password[aria-pressed="true"] .eye-closed {
  display: block;
}

.caps-warning {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--yellow);
}

/* ---------- Erro ---------- */

.login-error {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.login-error::before {
  content: "";
  width: 6px;
  height: 6px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 8px var(--red);
}

.login-error[hidden],
.caps-warning[hidden] {
  display: none;
}

/* ---------- Botão ---------- */

.login-submit {
  position: relative;
  margin-top: 6px;
  height: 46px;
  border: 0;
  border-radius: 11px;
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  box-shadow: 0 10px 26px -10px rgba(99, 102, 241, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: transform 0.12s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

.login-submit:hover {
  filter: brightness(1.08);
  box-shadow: 0 14px 30px -10px rgba(99, 102, 241, 1), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.login-submit:active {
  transform: translateY(1px) scale(0.99);
}

.login-submit:focus-visible {
  outline: 2px solid #c7d2fe;
  outline-offset: 3px;
}

.login-submit:disabled {
  cursor: progress;
  filter: saturate(0.8) brightness(0.95);
}

.spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  opacity: 0;
  animation: spin 0.7s linear infinite;
}

.login-submit.loading .submit-label {
  opacity: 0;
}

.login-submit.loading .spinner {
  opacity: 1;
}

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

/* ---------- Rodapé ---------- */

.login-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 12px;
  color: #6b7385;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse 2s ease-in-out infinite;
}

/* ---------- Ajustes ---------- */

@media (max-width: 440px) {
  .login-card {
    padding: 28px 22px 22px;
    border-radius: 16px;
  }

  .brand-title {
    font-size: 19px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .orb,
  .pulse-line,
  .status-dot,
  .login-card,
  .login-card.shake {
    animation: none;
  }

  .pulse-line {
    stroke-dashoffset: 0;
  }
}
