/* ==========================================================================
   CSS: TELAS DE ENTRADA — CONSTRUTORA FUTURE
   Login, Aceitar Convite e Redefinir Senha (Claro e Escuro)
   WCAG AA/AAA (contraste >= 4.5:1), alvos >= 44px, responsivo 1440/390px.
   ========================================================================== */

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--display);
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 24px 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Topo e Alternar Tema */
.auth-topbar { width: 100%; max-width: 440px; display: flex; justify-content: flex-end; margin-bottom: 12px; }
.theme-toggle-btn {
  width: 44px; height: 44px; border-radius: var(--radius-full);
  border: 1px solid var(--line); background-color: var(--surface);
  color: var(--text); box-shadow: var(--shadow-sm); display: grid;
  place-items: center; cursor: pointer; transition: transform 0.15s;
}
.theme-toggle-btn:hover { background-color: var(--soft); color: var(--brand); }
.theme-toggle-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle-btn .icon { width: 20px; height: 20px; stroke: currentColor; stroke-width: 2; fill: none; }

/* Cartão Central */
.auth-card {
  width: 100%; max-width: 440px; background-color: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-lg); padding: 36px 32px; margin: auto 0;
}
.auth-header { text-align: center; margin-bottom: 28px; }
.brand-badge { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 16px; text-decoration: none; }
.brand-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background-color: var(--brand); color: var(--sidebar-text);
  font-weight: 800; font-size: 22px; display: grid; place-items: center;
}
:root[data-theme='dark'] .brand-icon { background-color: var(--brand); color: var(--brand-night); }
.brand-title { font-size: 22px; font-weight: 700; letter-spacing: 0.05em; color: var(--brand); }
.auth-header h1 { font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.auth-header p { font-size: 13.5px; color: var(--muted); }

/* Formulário e Campos */
.auth-form { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.field label { font-size: 13px; font-weight: 600; color: var(--text); }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap input {
  width: 100%; min-height: 48px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background-color: var(--soft);
  color: var(--text); padding: 12px 14px; font-family: inherit; font-size: 14.5px;
}
.input-wrap input.has-toggle { padding-right: 48px; }
.input-wrap input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--line); }

.btn-toggle-pass {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  background: none; border: none; color: var(--muted);
  cursor: pointer; display: grid; place-items: center; padding: 0;
}
.btn-toggle-pass:hover { color: var(--text); }
.btn-toggle-pass:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn-toggle-pass .icon { width: 20px; height: 20px; stroke: currentColor; stroke-width: 2; fill: none; }

/* Regras de Senha */
.pass-rules { background-color: var(--soft); border-radius: var(--radius-sm); padding: 12px 14px; border: 1px solid var(--line); }
.pass-rules-title { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; }
.rules-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.rule-item { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.rule-dot {
  width: 16px; height: 16px; border-radius: 50%; background-color: var(--line-strong);
  display: grid; place-items: center; font-size: 10px; font-weight: 700; color: var(--surface); flex-shrink: 0;
}
.rule-item.is-valid { color: var(--tone-green-text); font-weight: 600; }
.rule-item.is-valid .rule-dot { background-color: var(--tone-green); color: #FFFFFF; }
:root[data-theme='dark'] .rule-item.is-valid .rule-dot { color: var(--brand-night); }

/* Alertas de Mensagem */
.auth-alert {
  padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13.5px;
  font-weight: 500; display: flex; align-items: flex-start; gap: 10px; border: 1px solid transparent;
}
.auth-alert[hidden] { display: none; }
.auth-alert--error { background-color: var(--tone-red-bg); color: var(--tone-red-text); border-color: var(--tone-red); }
.auth-alert--success { background-color: var(--tone-green-bg); color: var(--tone-green-text); border-color: var(--tone-green); }
.auth-alert--info { background-color: var(--tone-blue-bg); color: var(--tone-blue-text); border-color: var(--tone-blue); }

/* Botões */
.btn-submit {
  min-height: 48px; padding: 10px 20px; border-radius: var(--radius-md);
  font-family: inherit; font-size: 15px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; cursor: pointer; border: 1px solid transparent;
  background-color: var(--brand); color: var(--sidebar-text);
  width: 100%; margin-top: 4px; transition: transform 0.15s;
}
:root[data-theme='dark'] .btn-submit { background-color: var(--brand); color: var(--brand-night); }
.btn-submit:hover:not(:disabled) { background-color: var(--brand-oliva); }
:root[data-theme='dark'] .btn-submit:hover:not(:disabled) { filter: brightness(1.08); }
.btn-submit:active:not(:disabled) { transform: scale(0.98); }
.btn-submit:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-submit:disabled, .btn-submit.is-loading { opacity: 0.75; cursor: not-allowed; }

/* Botão Google (só aparece com data-google="1" no body) */
.google-auth-wrap { display: none; flex-direction: column; gap: 16px; margin-top: 8px; }
body[data-google="1"] .google-auth-wrap { display: flex; }
.auth-divider {
  display: flex; align-items: center; gap: 12px; color: var(--muted);
  font-size: 12.5px; font-weight: 500; text-transform: uppercase;
}
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background-color: var(--line); }
.btn-google {
  min-height: 48px; padding: 10px 18px; border-radius: var(--radius-md);
  border: 1px solid var(--line-strong); background-color: var(--surface);
  color: var(--text); font-family: inherit; font-size: 14.5px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  cursor: pointer; width: 100%; transition: transform 0.15s;
}
.btn-google:hover { background-color: var(--soft); }
.btn-google:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-google .google-icon { width: 18px; height: 18px; }

/* Links de Navegação */
.auth-links { margin-top: 20px; text-align: center; display: flex; flex-direction: column; gap: 10px; }
.auth-link { font-size: 13.5px; font-weight: 600; color: var(--accent-text); text-decoration: none; display: inline-block; }
.auth-link:hover { text-decoration: underline; }
.auth-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* Painel de Demonstração (só com ?demo=1) */
.demo-panel {
  display: none; margin-top: 24px; padding: 14px; background-color: var(--soft);
  border: 1px dashed var(--accent); border-radius: var(--radius-md); text-align: center;
}
.demo-panel.is-active { display: block; }
.demo-panel-title { font-size: 11px; font-weight: 700; color: var(--accent-text); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.demo-btns-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.demo-btn {
  min-height: 36px; padding: 6px 10px; font-size: 12px; font-weight: 600;
  border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background-color: var(--surface); color: var(--text); cursor: pointer;
}
.demo-btn:hover { background-color: var(--tint); }

/* Rodapé */
.auth-footer {
  margin-top: 24px; text-align: center; font-size: 12px;
  color: var(--muted); display: flex; align-items: center; gap: 6px; justify-content: center;
}
.auth-footer .icon { width: 14px; height: 14px; stroke: var(--accent); }

@media (max-width: 440px) {
  .auth-card { padding: 28px 20px; border-radius: 20px; }
  .auth-header h1 { font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Área onde o Google desenha o botão oficial */
.google-botao { display: flex; justify-content: center; min-height: 44px; }

/* Logo oficial: versão clara no tema claro, branco+dourado no escuro */
.brand-badge img { display: block; width: 200px; max-width: 70%; height: auto; margin-inline: auto; }
.brand-badge .logo-escuro { display: none; }
:root[data-theme='dark'] .brand-badge .logo-claro { display: none; }
:root[data-theme='dark'] .brand-badge .logo-escuro { display: block; }
