@import url('/assets/components/gsp-theme.css');

/* ─────────────────────────────────────────────
   login.css · GSP · Tema espacial corporativo
   Tokens vêm de assets/components/gsp-theme.css (fonte única).
   ───────────────────────────────────────────── */

/* ── Tokens ─────────────────────────────────── */
:root {
  --accent:       var(--gsp-accent);
  --accent-text:  var(--gsp-accent-text);
  --bg:           var(--gsp-bg);
  --bg2:          var(--gsp-bg2);
  --surface:      var(--gsp-surface);
  --surface2:     var(--gsp-surface2);
  --surface3:     var(--gsp-surface3);
  --border:       var(--gsp-border);
  --border2:      var(--gsp-border2);
  --text:         var(--gsp-text);
  --text2:        var(--gsp-text2);
  --muted:        var(--gsp-muted);
  --muted2:       var(--gsp-muted2);
  --red:          var(--gsp-red);
  --gold:         var(--gsp-gold);
  --blue:         var(--gsp-blue);
  --violet:       var(--gsp-violet);
  --panel:        var(--gsp-panel);
  --border-hi:    var(--border);
  --hint:         var(--muted2);
  --blue-hi:      var(--blue);
  --blue-glow:    var(--gsp-accent-glow);
  --green:        var(--accent);
  --badge-bg:     var(--gsp-badge-bg);
  --badge-border: var(--gsp-badge-border);
  --shadow-sm:    var(--gsp-shadow-sm);
  --shadow:       var(--gsp-shadow);
  --decor-center: var(--gsp-accent-d);
  --decor-edge:   var(--gsp-pink-d);
  --radius:       8px;
  --radius-sm:    8px;
  --font-body:    'Space Grotesk', sans-serif;
  --font-mono:    'IBM Plex Mono', monospace;
  --transition:   0.2s ease;
}

:root.dark {
  --decor-center: var(--gsp-accent-glow);
  --decor-edge:   rgba(11,15,26,0.18);
}

/* ── Reset mínimo ───────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Corpo ──────────────────────────────────── */
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color .32s ease, color .32s ease;
}

/* Gradiente radial sutil ao centro */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 55% at 50% 40%, var(--decor-center) 0%, transparent 70%),
    radial-gradient(ellipse 100% 80% at 50% 100%, var(--decor-edge) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ── Shell ──────────────────────────────────── */
.login-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

/* ── Card ───────────────────────────────────── */
@keyframes card-in {
  from { opacity: 0; transform: translateY(22px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.login-card {
  position: relative;
  overflow: hidden;
  width: min(420px, 100%);
  padding: 36px 32px 28px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.03) inset,
    0 24px 60px rgba(0,0,0,0.35),
    0 0 80px var(--gsp-accent-glow);
  animation: card-in 0.5s cubic-bezier(0.22,1,0.36,1) both;
}

/* Faixa da bandeira do Espírito Santo no topo do cartão: rosa, branco,
   azul. É a primeira coisa que se vê no sistema. */
.login-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--gsp-faixa);
}

/* ── Logo / Marca ───────────────────────────── */
.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.brand-logo {
  height: 152px;
  width: auto;
  object-fit: contain;
}

/* Fallback caso a imagem não carregue */
.brand-fallback {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--blue-hi);
}

/* ── Cabeçalho ──────────────────────────────── */
.card-header { margin-bottom: 28px; text-align: center; }

h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.subtitle {
  margin-top: 6px;
  font-size: 14px;
  color: var(--muted);
}

/* ── Aviso LDAP ─────────────────────────────── */
.ldap-notice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 14px;
  padding: 10px 12px;
  background: var(--badge-bg);
  border: 1px solid var(--badge-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--accent-text);
  line-height: 1.45;
}

.ldap-notice svg { flex-shrink: 0; margin-top: 2px; }
.ldap-notice strong { color: var(--blue-hi); }

/* ── Campos ─────────────────────────────────── */
.field-group {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 6px;
  cursor: default;
}

.field-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

input {
  width: 100%;
  min-height: 44px;
  padding: 10px 44px 10px 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 14.5px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

input::placeholder { color: var(--hint); }

input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-glow);
}

input:user-invalid {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(240,82,82,0.2);
}

/* ── Botão de ajuda (?) ─────────────────────── */
.help-btn {
  position: absolute;
  right: 10px;
  width: 26px;
  height: 26px;
  border: 1px solid var(--border-hi);
  border-radius: 50%;
  background: var(--bg);
  color: var(--blue-hi);
  font: 700 13px/1 var(--font-mono);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background var(--transition), color var(--transition), border-color var(--transition), box-shadow var(--transition);
  flex-shrink: 0;
}

.help-btn:hover,
.help-btn:focus-visible {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-glow);
  outline: none;
}

/* ── Botão mostrar/ocultar senha ─────────────── */
.toggle-pw {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--hint);
  padding: 4px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  transition: color var(--transition);
}

.toggle-pw:hover,
.toggle-pw:focus-visible {
  color: var(--blue-hi);
  outline: none;
}

.eye-icon { width: 18px; height: 18px; }

/* ── Hint sob o campo ─────────────────────────── */
.field-hint {
  font-size: 11.5px;
  color: var(--hint);
}

/* ── Botão Entrar ───────────────────────────── */
.btn-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 46px;
  margin-top: 24px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--blue);
  color: #fff;
  font: 700 15px/1 var(--font-body);
  letter-spacing: 0.02em;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
}

.btn-submit::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.12) 0%, transparent 60%);
  pointer-events: none;
}

.btn-submit:hover {
  background: var(--blue-hi);
  box-shadow: 0 4px 20px rgba(58,123,213,0.45);
  transform: translateY(-1px);
}

.btn-submit:active  { transform: translateY(0); }
.btn-submit:focus-visible { outline: 3px solid var(--blue-glow); outline-offset: 2px; }

.btn-submit:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

.btn-arrow { width: 18px; height: 18px; flex-shrink: 0; }

/* ── Divisor + login Microsoft ─────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0;
  color: var(--muted2);
  font-size: 12px;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-microsoft {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: 700 14px/1 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}
.btn-microsoft:hover { background: var(--surface2); border-color: var(--border-hi); transform: translateY(-1px); }
.btn-microsoft:active { transform: translateY(0); }
.btn-microsoft:focus-visible { outline: 3px solid var(--blue-glow); outline-offset: 2px; }

/* ── Mensagem de erro/sucesso ──────────────── */
.message {
  min-height: 18px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--red);
  text-align: center;
}

/* ── Rodapé do card ─────────────────────────── */
.card-footer {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--hint);
  text-align: center;
}

.card-footer a {
  color: var(--blue-hi);
  text-decoration: none;
  transition: color var(--transition);
}
.card-footer a:hover { color: #fff; text-decoration: underline; }

/* ── Badge LDAP pequeno (modal) ────────────── */
.ldap-badge-sm {
  display: inline-block;
  padding: 2px 7px;
  background: var(--badge-bg);
  border: 1px solid var(--badge-border);
  border-radius: 4px;
  font: 700 10px/1.6 var(--font-mono);
  letter-spacing: 0.08em;
  color: var(--blue-hi);
  vertical-align: middle;
  margin-right: 6px;
}

/* ── Modal de Ajuda ─────────────────────────── */
.help-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 10, 20, 0.78);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
}

.help-overlay[hidden] { display: none; }

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.94) translateY(16px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}

.help-modal {
  position: relative;
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  padding: 32px 28px 26px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.7);
  animation: modal-in 0.3s cubic-bezier(0.22,1,0.36,1) both;
}

.help-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background var(--transition), color var(--transition);
}
.help-close:hover { background: var(--border); color: var(--text); }

.help-icon {
  font-size: 30px;
  margin-bottom: 12px;
}

.help-modal h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 18px;
}

.help-steps {
  display: grid;
  gap: 14px;
  padding-left: 20px;
  counter-reset: step;
  list-style: none;
}

.help-steps li {
  position: relative;
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.55;
  padding-left: 0;
}

.help-steps li::before {
  content: counter(step);
  counter-increment: step;
  position: absolute;
  left: -22px;
  top: 0;
  width: 18px;
  height: 18px;
  background: var(--badge-bg);
  border: 1px solid var(--badge-border);
  border-radius: 50%;
  font: 700 10px/18px var(--font-mono);
  color: var(--blue-hi);
  text-align: center;
}

.help-steps strong {
  display: block;
  color: var(--text);
  font-size: 13px;
  margin-bottom: 3px;
}

kbd {
  display: inline-block;
  padding: 1px 6px;
  background: var(--bg);
  border: 1px solid var(--border-hi);
  border-radius: 4px;
  font: 500 12px/1.6 var(--font-mono);
  color: var(--text);
}

code {
  padding: 1px 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  font: 500 12px/1.6 var(--font-mono);
  color: var(--green);
}

.help-note {
  margin-top: 18px;
  padding: 11px 13px;
  background: var(--badge-bg);
  border: 1px solid var(--badge-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--accent-text);
}

/* ── Responsivo ─────────────────────────────── */
@media (max-width: 560px) {
  .login-shell {
    padding: 0;
    display: flex;
    align-items: stretch;
    justify-content: center;
    height: 100vh;   /* fallback p/ navegadores sem dvh/svh */
    height: 100svh;  /* usa a menor altura visível, sem barra do navegador cortando o layout */
    overflow: hidden;
  }

  /* Em mobile o "cartão" deixa de flutuar sobre o fundo: preenche a tela
     inteira, sem borda/sombra/raio, pra parecer uma tela nativa em vez de
     um quadrado sobreposto. Altura vem do .login-shell (stretch) em vez de
     um 100svh próprio — dois cálculos independentes de svh podem arredondar
     pra valores diferentes e sobrar 1px de scroll fantasma. Fundo usa --bg
     (não --panel) pra casar com o resto do app, já que aqui ele ocupa a tela
     toda em vez de flutuar como um card. */
  .login-card {
    width: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 18px 20px 14px;
    border: none;
    border-radius: 0;
    box-shadow: none;
    animation: none;
    background: var(--bg);
    overflow-y: auto;
  }

  .brand        { margin-bottom: 10px; }
  .brand-logo   { height: clamp(56px, 13svh, 96px); }
  .card-header  { margin-bottom: 16px; }
  .divider      { margin: 14px 0; }
  .field-group  { gap: 14px; }
  .btn-submit   { margin-top: 16px; }
  .message      { min-height: 0; margin-top: 6px; }
  .card-footer  { margin-top: 14px; padding-top: 14px; }

  .help-modal   { padding: 26px 20px 22px; }
}

/* ── Foco acessível global ──────────────────── */
:focus-visible {
  outline: 2px solid var(--blue-hi);
  outline-offset: 3px;
}

.card-footer .efficiency-credit {
  margin-top: 6px;
  margin-bottom: 0;
  font: inherit;
  color: inherit;
  opacity: 1;
}

/* ── Botão de alternar tema (canto sup. direito) ───────────────── */
.theme-btn {
  position: fixed; right: 14px; top: 14px; z-index: 999;
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 36px; padding: 0;
  border-radius: 8px; background: transparent;
  border: 1px solid var(--border); color: var(--text2);
  cursor: pointer; font-size: 16px;
  transition: background .2s ease, border-color .2s ease, color .2s ease, transform .12s ease;
}
.theme-btn:hover { background: var(--surface3); border-color: var(--blue); color: var(--blue); transform: translateY(-1px); }
.theme-btn:active { transform: translateY(0); }