/* ============================================================
   TELA DE LOGIN
   ============================================================ */
#login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 20% 20%, #5865f244, transparent 50%),
              radial-gradient(circle at 80% 80%, #eb459e33, transparent 50%),
              var(--bg-tertiary);
  z-index: 100;
}

/* ----- Splash de restauração de sessão (voltar do 2º plano sem flash do login) ----- */
#auth-splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 20% 20%, #5865f244, transparent 50%),
              radial-gradient(circle at 80% 80%, #eb459e33, transparent 50%),
              var(--bg-tertiary);
  color: var(--text);
}
#auth-splash.hidden { display: none; }
.auth-splash-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.auth-splash-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid color-mix(in srgb, var(--text) 18%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: jdSpin 0.9s linear infinite;
}
.auth-splash-inner p { margin: 0; opacity: 0.7; }

/* ----- Splash de CARREGAMENTO dos apps nativos (cobre o login até a sessão ser validada) -----
   Fica FORA do app: no navegador o login aparece direto (html.jd-app é marcado no <head>). */
#boot-splash {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000; /* acima de #login-screen (100) e de #auth-splash (9999) */
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 20% 20%, #5865f244, transparent 50%),
              radial-gradient(circle at 80% 80%, #eb459e33, transparent 50%),
              var(--bg-tertiary);
  color: var(--text);
}
html.jd-app #boot-splash { display: flex; }
#boot-splash.hidden { display: none !important; }
#boot-splash.jd-boot-fade { animation: jdBootFadeOut 0.22s ease forwards; }
.boot-splash-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.boot-splash-logo {
  width: calc(96px * var(--ui-scale));
  height: calc(96px * var(--ui-scale));
  object-fit: contain;
}
.boot-splash-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid color-mix(in srgb, var(--text) 18%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: jdSpin 0.9s linear infinite;
}
.boot-splash-inner p { margin: 0; opacity: 0.7; }
@keyframes jdBootFadeOut {
  to { opacity: 0; visibility: hidden; }
}

.login-box {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 40px;
  width: 420px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  text-align: center;
}

.login-logo {
  font-size: calc(64px * var(--font-scale));
  margin-bottom: 12px;
}

.login-logo img {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: 20px;
  display: block;
  margin: 0 auto;
}

.login-box h1 {
  font-size: calc(24px * var(--font-scale));
  font-weight: 700;
  margin-bottom: 6px;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: calc(14px * var(--font-scale));
  margin-bottom: 24px;
}

.login-box label {
  display: block;
  text-align: left;
  font-size: calc(11px * var(--font-scale));
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
}

.login-box input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--bg-input2);
  background: var(--bg-tertiary);
  color: var(--text-normal);
  border-radius: var(--radius);
  font-size: calc(16px * var(--font-scale));
  outline: none;
  margin-bottom: 16px;
}

.login-box input:focus {
  border-color: var(--blurple);
}

.login-box button {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: var(--radius);
  background: var(--blurple);
  color: #fff;
  font-size: calc(15px * var(--font-scale));
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.login-box button:hover {
  background: var(--blurple-hover);
}

.login-section {
  margin-bottom: 14px;
}

.login-section-title {
  display: block;
  text-align: left;
  font-size: calc(11px * var(--font-scale));
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin: 18px 0 8px;
}

.login-section-title:first-child {
  margin-top: 0;
}

.login-box .oauth-btn {
  background: #57f287;
  color: #0b1c14;
}

.login-box .oauth-btn:hover {
  background: #3ba55d;
  color: #fff;
}

.login-box .discord-btn {
  background: #5865f2;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.login-box .discord-btn:hover {
  background: #4752c4;
}

.discord-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.login-hint {
  color: var(--text-muted);
  font-size: calc(12px * var(--font-scale));
  margin-top: 8px;
  text-align: left;
  line-height: 1.45;
}

.login-error {
  color: var(--red);
  font-size: calc(13px * var(--font-scale));
  margin-top: 12px;
  min-height: 18px;
}

/* ---------- 2FA (código do autenticador / aprovação no app) ---------- */
.login-2fa-hint {
  color: var(--text-muted);
  font-size: calc(12px * var(--font-scale));
  margin: 0 0 12px;
  text-align: left;
  line-height: 1.45;
}

.login-2fa-wait {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  margin-bottom: 12px;
}
.login-2fa-wait .auth-splash-spinner {
  width: 30px;
  height: 30px;
  border-width: 3px;
}
.login-2fa-wait .login-2fa-hint {
  text-align: center;
  margin: 0;
}

.login-back-btn {
  width: 100%;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--bg-input);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  font-size: calc(14px * var(--font-scale));
  cursor: pointer;
  transition: background 0.15s;
}

.login-back-btn:hover {
  background: var(--bg-input);
  color: var(--text);
}

/* Canais de RECUPERAÇÃO de acesso (perdeu o autenticador): WhatsApp / SMS / e-mail */
.login-2fa-channel {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 11px 12px;
  border: 1px solid var(--bg-input);
  border-radius: var(--radius);
  background: var(--bg-input);
  color: var(--text);
  font-size: calc(14px * var(--font-scale));
  text-align: left;
  cursor: pointer;
  transition: filter 0.15s, border-color 0.15s;
}

.login-2fa-channel:hover {
  filter: brightness(1.2);
  border-color: var(--accent, #5865f2);
}

.login-divider {
  height: 1px;
  background: var(--bg-input);
  margin: 18px 0 14px;
}

/* Esconde o fallback por padrão */
.fallback-icon {
  display: none;
}

/* Mostra o fallback apenas se o SVG não carregar */
.app-download-btn svg:not(:only-child) {
  display: inline-block;
}

.app-download-btn svg:not(:only-child) + .fallback-icon {
  display: none;
}

/* Fallback para quando o SVG falha */
.app-download-btn svg:only-child {
  display: none;
}

.app-download-btn svg:only-child + .fallback-icon {
  display: inline-block;
}

.app-download-divider {
  height: 1px;
  background: var(--bg-input);
  margin: 18px 0 14px;
}
.app-download-title {
  font-size: calc(12px * var(--font-scale));
  font-weight: 700;
  color: var(--text-normal);
  margin-bottom: 12px;
}
.app-download-platforms {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.app-download-btn {
  display: inline-flex;
  flex-direction: column; /* Muda de row (padrão) para column */
  align-items: center; /* Centraliza horizontalmente */
  justify-content: center; /* Centraliza verticalmente */
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  padding: 10px 16px;
  gap: 2px; /* Espaço entre o SVG e o texto */
}

.app-download-btn svg {
  width: 3em;
  height: 3em; /* Adiciona altura para manter proporção */
}

.app-download-btn span {
  font-size: 0.8em; /* Texto um pouco menor que o ícone */
  text-align: center;
}

.app-download-btn:hover { opacity: 0.9; }
