/* ==========================================================================
   Tecmetra — telas de autenticação (redesign)
   Porte dos comps tecmetra-login-desktop.html / tecmetra-login-mobile.html.
   Cobre login, cadastro, recuperação de senha e definição de nova senha.
   O login.css antigo só atende as páginas geradas dentro do AuthController.
   ========================================================================== */

:root {
  --purple: #814ECD;
  --purple-deep: #6B3FB0;
  --cyan: #2FA8E0;
  --navy-deep: #0A2540;
  --ink: #16213A;
  --ink-soft: #6B7684;
  --line: #E1E6ED;
  --field-bg: #F3F6FA;
  --paper: #FFFFFF;
  --canvas: #EEF1F6;
  --radius: 12px;
  --radius-lg: 14px;
  --hero-gradient: linear-gradient(150deg, #814ECD 0%, #5E7FDB 48%, #2FA8E0 100%);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body.auth-page {
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

.auth-shell {
  display: flex;
  min-height: 100vh;
}

/* ====== PAINEL DE MARCA ====== */

.auth-brand {
  width: 46%;
  background: var(--hero-gradient);
  color: #fff;
  padding: 64px 56px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.auth-brand::before,
.auth-brand::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.auth-brand::before {
  left: -100px;
  top: -100px;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.12), transparent 70%);
}

.auth-brand::after {
  right: -140px;
  bottom: -140px;
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.16), transparent 70%);
}

.auth-brand > * { position: relative; z-index: 1; }

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

/* A logo é colorida; sobre o gradiente ela é achatada para branco puro. */
.brand-logo {
  width: 230px;
  max-width: 100%;
  height: auto;
  display: block;
  filter: brightness(0) invert(1);
}

.brand-headline {
  margin: 64px 0 0;
  font-size: 40px;
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.5px;
  max-width: 460px;
}

.brand-lede {
  margin: 18px 0 0;
  font-size: 16px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.85);
  max-width: 420px;
}

.brand-meterline { display: none; }

.brand-features {
  margin-top: 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brand-feature { display: flex; gap: 14px; align-items: flex-start; }

.brand-feature .icon {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-feature h3 { margin: 0 0 3px; font-size: 15px; font-weight: 700; }
.brand-feature p { margin: 0; font-size: 13.5px; line-height: 1.5; color: rgba(255, 255, 255, 0.78); }

.brand-stats {
  margin-top: auto;
  padding-top: 48px;
  display: flex;
  gap: 40px;
  flex-wrap: wrap;
}

.brand-stat b { display: block; font-size: 26px; font-weight: 800; }
.brand-stat span { font-size: 12.5px; color: rgba(255, 255, 255, 0.75); }

/* ====== LADO DO FORMULÁRIO ====== */

.auth-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.auth-main__body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.auth-card { width: 100%; max-width: 400px; }

/* Único h1 da página. No login ele assume o papel do antigo par "Entrar" +
   subtítulo: o botão principal já diz "Entrar", repetir seria redundante. */
.auth-card h1 {
  font-size: 27px;
  line-height: 1.3;
  margin: 0 0 26px;
  font-weight: 800;
  letter-spacing: -0.3px;
}

/* Telas que precisam explicar o que fazer mantêm um subtítulo; nesse caso o
   título cede o espaçamento de baixo para ele. */
.auth-card h1:has(+ .sub) { margin-bottom: 8px; }

.auth-card .sub {
  margin: 0 0 26px;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink-soft);
}

/* ====== CAMPOS ====== */

.field { margin-bottom: 18px; }

.field label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 7px;
}

.field .control {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--field-bg);
  border: 1.5px solid var(--field-bg);
  border-radius: var(--radius);
  padding: 13px 14px;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}

.field .control:focus-within {
  border-color: var(--purple);
  background: var(--paper);
  box-shadow: 0 0 0 4px rgba(129, 78, 205, 0.12);
}

.field .control > svg { flex-shrink: 0; color: var(--ink-soft); }

.field input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
  width: 100%;
  min-width: 0;
  color: var(--ink);
  font-family: inherit;
}

.field input::placeholder { color: #9AA7B8; }

.password-toggle {
  border: none;
  background: transparent;
  padding: 0;
  display: flex;
  align-items: center;
  cursor: pointer;
  color: var(--ink-soft);
}

.password-toggle:hover { color: var(--purple); }

/* ====== OPÇÕES ====== */

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 26px;
}

.remember {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
}

/* Aceite dos termos: mesmo checkbox do "lembrar de mim", mas o texto quebra
   em várias linhas, então a caixa alinha pelo topo. */
.terms {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 22px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
}

.terms .checkbox { margin-top: 1px; }
.terms a { color: var(--purple); font-weight: 700; text-decoration: none; }
.terms a:hover { text-decoration: underline; }

.remember input,
.terms input { position: absolute; opacity: 0; width: 0; height: 0; }

.remember .checkbox,
.terms .checkbox {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1.5px solid #C4CCD9;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease, border-color .15s ease;
}

.remember .checkbox::after,
.terms .checkbox::after {
  content: "";
  width: 9px;
  height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
  opacity: 0;
}

.remember input:checked + .checkbox,
.terms input:checked + .checkbox {
  background: var(--purple);
  border-color: var(--purple);
}

.remember input:checked + .checkbox::after,
.terms input:checked + .checkbox::after { opacity: 1; }

.remember input:focus-visible + .checkbox,
.terms input:focus-visible + .checkbox { box-shadow: 0 0 0 4px rgba(129, 78, 205, 0.18); }

.forgot { font-size: 14px; font-weight: 700; color: var(--purple); text-decoration: none; }
.forgot:hover { text-decoration: underline; }

/* ====== BOTÕES ====== */

.btn-primary {
  width: 100%;
  border: none;
  border-radius: var(--radius);
  padding: 14px 0;
  background: linear-gradient(135deg, var(--purple) 0%, var(--purple-deep) 100%);
  color: #fff;
  font-size: 15.5px;
  font-weight: 800;
  font-family: inherit;
  letter-spacing: 0.2px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 12px 20px -8px rgba(129, 78, 205, 0.5);
  transition: transform .15s ease, box-shadow .15s ease;
}

.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 16px 26px -8px rgba(129, 78, 205, 0.6); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; transform: none; }

/* .btn-primary também é usado em <a> nas telas de status. */
a.btn-primary { text-decoration: none; }

.btn-secondary {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: border-color .15s ease, background .15s ease;
}

.btn-secondary:hover { border-color: #C9D2DE; background: #FAFBFD; }

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
  color: #9AA7B8;
  font-size: 13px;
  font-weight: 600;
}

.divider::before,
.divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.social-row {
  display: grid;
  /* auto-fit: um provedor ocupa a linha inteira; dois ficam lado a lado */
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.btn-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 0;
  background: var(--paper);
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

.btn-social:hover { border-color: #C9D2DE; background: #FAFBFD; transform: translateY(-2px); }
.btn-social:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }
.btn-social svg { flex-shrink: 0; }

/* ====== AVISOS DENTRO DO CARD ====== */

/* Diferente de .auth-alert, que flutua no topo da janela: este fica junto do
   campo que causou o erro. */
.inline-alert {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 13.5px;
  line-height: 1.5;
}

.inline-alert svg { flex-shrink: 0; margin-top: 1px; }

.inline-alert--error { background: #FDECEE; border: 1px solid #F3C3CA; color: #8A1C2B; }
.inline-alert--success { background: #E8F7EF; border: 1px solid #B6E3CB; color: #14683F; }
.inline-alert--pending { background: #FFF4E0; border: 1px solid #F0DCB4; color: #8A5A08; }

.info-list {
  list-style: none;
  margin: 22px 0 0;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--field-bg);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.info-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--ink-soft);
}

.info-list svg { flex-shrink: 0; color: var(--purple); }

.info-list--plain { background: transparent; padding: 0; margin: 0; }
.info-list--plain li { align-items: flex-start; text-align: left; line-height: 1.5; }
.info-list--plain svg { margin-top: 3px; }

/* Popup do login social: janela pequena, sem o painel de marca. */
.auth-page--popup {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.popup-card { max-width: 340px; text-align: center; }
.popup-card h1 { font-size: 21px; margin: 0 0 8px; font-weight: 800; }
.popup-card .spinner { margin: 20px auto 0; }
.popup-card .status-help a { color: var(--purple); font-weight: 700; }

/* ====== TELAS DE STATUS ====== */

.auth-card--status { text-align: center; max-width: 440px; }

.auth-card--status h1 {
  font-size: 25px;
  margin: 0 0 14px;
}

.status-badge {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 22px;
}

.status-badge--success { background: #E8F7EF; color: #17794C; }
.status-badge--info    { background: rgba(129, 78, 205, 0.12); color: var(--purple); }
.status-badge--warning { background: #FFF4E0; color: #A96A08; }
.status-badge--error   { background: #FDECEE; color: #B32438; }

.status-highlight {
  display: inline-block;
  margin: 0 0 16px;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--field-bg);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  word-break: break-word;
}

.status-lead {
  margin: 0 0 12px;
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--ink);
}

.status-text {
  margin: 0 0 12px;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.status-panel {
  margin-top: 22px;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--field-bg);
  text-align: left;
}

.status-panel h2 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
}

.status-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.status-steps li {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 10px 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-soft);
  text-align: left;
}

.status-steps li + li { border-top: 1px solid #E4E9F0; }
.status-steps b { color: var(--ink); font-weight: 800; }

.step-marker {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  margin-top: 1px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  background: var(--purple);
}

.step-marker--done { background: #17794C; }
.step-marker--wait { background: #C4830B; }

.status-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 26px;
}

.status-help {
  margin: 18px 0 0;
  font-size: 13px;
  line-height: 1.55;
  color: #9AA7B8;
}

.signup { text-align: center; margin: 28px 0 0; font-size: 14px; color: var(--ink-soft); }
.signup a { color: var(--purple); font-weight: 800; text-decoration: none; }
.signup a:hover { text-decoration: underline; }

/* ====== RODAPÉ ====== */

.auth-footer {
  border-top: 1px solid var(--line);
  padding: 18px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.auth-footer .copy { margin: 0; font-size: 12px; color: #9AA7B8; }
.auth-footer__right { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.stores { display: flex; gap: 10px; }
.stores img { height: 34px; width: auto; display: block; }

/* seletor de idioma */
.lang-dropdown { position: relative; }

.lang-dropdown-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  color: var(--ink);
  background: var(--paper);
  cursor: pointer;
}

.lang-dropdown-btn:hover { border-color: #C9D2DE; }
.lang-dropdown-btn .chevron { transition: transform .2s ease; }
.lang-dropdown-btn.active .chevron { transform: rotate(180deg); }
.lang-flag { border-radius: 2px; display: block; }

.lang-dropdown-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 40px -12px rgba(10, 37, 64, 0.28);
  padding: 6px;
  display: none;
  z-index: 50;
}

.lang-dropdown-menu.show { display: block; }

.lang-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.lang-option:hover { background: var(--field-bg); }
.lang-option.active { background: rgba(129, 78, 205, 0.1); font-weight: 700; color: var(--purple); }

/* ====== AVISOS E OVERLAY ====== */

.auth-alert {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  max-width: 520px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 12px;
  background: #FDECEE;
  border: 1px solid #F3C3CA;
  color: #8A1C2B;
  font-size: 14px;
  box-shadow: 0 16px 40px -12px rgba(10, 37, 64, 0.3);
}

.auth-alert button {
  border: none;
  background: transparent;
  color: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 37, 64, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.loading-spinner {
  background: var(--paper);
  border-radius: 16px;
  padding: 28px 36px;
  text-align: center;
}

.loading-spinner p { margin: 14px 0 0; font-size: 14px; font-weight: 600; color: var(--ink-soft); }

.spinner {
  width: 38px;
  height: 38px;
  margin: 0 auto;
  border: 3px solid var(--line);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: auth-spin .8s linear infinite;
}

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

.noscript-warn {
  margin: 0;
  padding: 12px 16px;
  background: #FFF6E5;
  border-bottom: 1px solid #F0DCB4;
  font-size: 14px;
  color: #7A5A12;
  text-align: center;
}

/* ==========================================================================
   MOBILE — o painel de marca vira um hero compacto acima do formulário
   ========================================================================== */

@media (max-width: 900px) {
  .auth-shell { flex-direction: column; }

  /* Topo enxuto: os botões sociais precisam caber acima da dobra, senão
     o usuário nem descobre que existe login com Google. */
  .auth-brand {
    width: 100%;
    padding: 16px 26px 18px;
  }

  .auth-brand::before { display: none; }

  .auth-brand::after {
    right: -60px;
    top: -60px;
    bottom: auto;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.20), transparent 70%);
  }

  .brand-logo { width: 148px; }

  /* headline, features e stats são exclusivos do desktop */
  .brand-headline,
  .brand-features,
  .brand-stats { display: none; }

  .brand-lede {
    margin-top: 10px;
    font-size: 14px;
    line-height: 1.45;
    max-width: 300px;
  }

  .brand-meterline { display: block; margin-top: 12px; }
  .brand-meterline svg { display: block; width: 100%; height: 14px; }

  .auth-main__body { padding: 20px 26px; align-items: flex-start; }
  .auth-card { max-width: 440px; margin: 0 auto; }
  .auth-card h1 { font-size: 23px; margin-bottom: 18px; }
  .auth-card h1:has(+ .sub) { margin-bottom: 6px; }
  .auth-card .sub { margin-bottom: 18px; font-size: 14px; }

  .field { margin-bottom: 12px; }
  .terms { margin-bottom: 18px; }
  .info-list { margin-top: 16px; padding: 14px; }

  .auth-card--status h1 { font-size: 22px; }
  .status-badge { width: 62px; height: 62px; margin-bottom: 18px; }
  .status-badge svg { width: 26px; height: 26px; }
  .btn-secondary { border-radius: var(--radius-lg); font-size: 15.5px; }
  .field .control { border-radius: var(--radius-lg); }
  .field input { font-size: 16px; } /* 16px evita o zoom automático no iOS */
  .row-between { margin: 2px 0 16px; }
  .btn-primary { border-radius: var(--radius-lg); padding: 13px 0; font-size: 16px; }
  .divider { margin: 14px 0; }
  .btn-social { border-radius: var(--radius-lg); padding: 12px 0; }
  .signup { margin-top: 18px; }
  .remember .checkbox { width: 20px; height: 20px; border-radius: 6px; }

  .auth-footer {
    flex-direction: column;
    justify-content: center;
    text-align: center;
    padding: 22px 26px;
  }

  .auth-footer__right { flex-direction: column; gap: 14px; }
  .lang-dropdown-menu { left: 50%; right: auto; transform: translateX(-50%); }
}

@media (max-width: 380px) {
  .auth-brand { padding: 22px 20px 26px; }
  .auth-main__body { padding: 26px 20px; }
  .social-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .btn-primary, .btn-social { transition: none; }
  .btn-primary:hover, .btn-social:hover { transform: none; }
  .spinner { animation-duration: 2s; }
}
