/* ============================================================
   CLIENTSTAY — Login (redesign minimalista)
   Alinhado à identidade do Painel Geral (Inter, verde #0db37e,
   fundo claro com grade de pontos, cards claros e arredondados).
   ============================================================ */

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; min-height: 100%; }

:root {
  --green:        #0db37e;
  --green-hover:  #0a8e64;
  --green-light:  #19cf93;
  --bg:           #ebeff1;
  --card-bg:      #ffffff;
  --text-title:   rgba(0, 0, 0, 0.9);
  --text-body:    rgba(0, 0, 0, 0.7);
  --text-muted:   rgba(0, 0, 0, 0.5);
  --field-border: rgba(0, 0, 0, 0.12);
  --logo-gradient: linear-gradient(90deg, #41c99a 0%, #20a77c 32%, #2f3a3c 64%, #24272b 100%);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

/* ── Fundo (mesma linguagem da dashboard) ── */
body {
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: var(--text-body);
  background:
    radial-gradient(circle at 100% 0%, rgba(13, 179, 126, 0.05) 0%, transparent 42%),
    radial-gradient(circle at 0% 100%, rgba(47, 107, 237, 0.04) 0%, transparent 45%),
    var(--bg);
  min-height: 100vh;
}

/* Grade de pontos sutil ao fundo (substitui o canvas animado) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(13, 179, 126, 0.14) 1px, transparent 0),
    linear-gradient(rgba(35, 54, 79, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(35, 54, 79, 0.045) 1px, transparent 1px);
  background-size: 28px 28px, 72px 72px, 72px 72px;
  opacity: 0.5;
}

/* ── Grade interativa: holofote verde que segue o mouse ──
   Mesma grade da base, porém em verde e revelada só por uma máscara
   radial na posição do cursor (--mx/--my atualizadas em JS). */
.grid-glow {
  --mx: -1000px;
  --my: -1000px;
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(25, 207, 147, 0.85) 1px, transparent 0),
    linear-gradient(rgba(25, 207, 147, 0.55) 1px, transparent 1px),
    linear-gradient(90deg, rgba(25, 207, 147, 0.55) 1px, transparent 1px);
  background-size: 28px 28px, 72px 72px, 72px 72px;
  -webkit-mask: radial-gradient(240px circle at var(--mx) var(--my), #000 0%, rgba(0, 0, 0, 0.6) 42%, transparent 72%);
          mask: radial-gradient(240px circle at var(--mx) var(--my), #000 0%, rgba(0, 0, 0, 0.6) 42%, transparent 72%);
  opacity: 0;
  transition: opacity 0.3s ease;
  will-change: mask-position, -webkit-mask-position;
}

.grid-glow.is-active { opacity: 1; }

/* ── Container principal ── */
#app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}

.login-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  animation: fadeSlideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Logo ── */
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
}

.logo img {
  height: 44px;
  width: 44px;
  border-radius: 50%;            /* a marca já é um círculo verde; recorta limpo */
  box-shadow: 0 10px 24px -6px rgba(13, 179, 126, 0.45), 0 2px 6px rgba(0, 0, 0, 0.10);
}

.logo-word {
  font-weight: 600;
  font-size: 20px;
  color: #24272b;
  white-space: nowrap;
}

.logo-accent {
  background: var(--logo-gradient);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

/* ── Card ── */
.card {
  width: 100%;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 24px;
  box-shadow: 0px 1px 10px 0px rgba(20, 55, 40, 0.28), 0 2px 10px rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  padding: 40px 34px;
}

/* ── Telas (login / cadastro) ── */
.screen { display: block; }
.screen[hidden] { display: none; }   /* vence o .screen ao alternar via JS */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Títulos ── */
.screen h1 {
  color: var(--text-title);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 15px;
  margin-bottom: 26px;
}

.link-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--green);
  font-weight: 600;
  font-size: inherit;
  font-family: inherit;
  padding: 0;
}

.link-btn:hover { color: var(--green-hover); text-decoration: underline; }

.link-btn:focus-visible,
.btn-submit:focus-visible {
  outline: 3px solid rgba(13, 179, 126, 0.26);
  outline-offset: 3px;
}

/* ── Campos ── */
.fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fields[hidden] { display: none; }

.field-help {
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.45;
  margin: -5px 2px 1px;
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field {
  width: 100%;
  height: 46px;
  border-radius: 12px;
  border: 1.5px solid var(--field-border);
  background: #fff;
  color: #24272b;
  font-size: 15px;
  font-family: inherit;
  padding: 0 15px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field::placeholder { color: #9aa4a0; }

.field:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(13, 179, 126, 0.14);
}

/* Código de 6 dígitos da verificação em duas etapas */
.field-code {
  text-align: center;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 10px;
  text-indent: 10px; /* compensa o espaço que o letter-spacing sobra à direita */
  height: 58px;
}

.field-code::placeholder {
  letter-spacing: 10px;
  font-weight: 500;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--text-muted);
  padding: 2px 2px 0;
}

.checkbox-row input {
  width: 17px;
  height: 17px;
  flex: none;
  accent-color: var(--green);
  cursor: pointer;
}

.password-field {
  position: relative;
  width: 100%;
}

.password-field .field {
  padding-right: 50px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  transform: translateY(-50%);
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #69736f;
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s;
}

.password-toggle:hover {
  color: var(--green-hover);
  background: rgba(13, 179, 126, 0.09);
}

.password-toggle:focus-visible {
  outline: 3px solid rgba(13, 179, 126, 0.22);
  outline-offset: 1px;
}

.password-toggle__icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.password-toggle__icon[hidden] {
  display: none;
}

select.field {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23777' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 15px center;
  padding-right: 38px;
  cursor: pointer;
}

select.field option[value=""] { color: #9aa4a0; }

/* ── Botão principal ── */
.btn-submit {
  width: 100%;
  height: 46px;
  border-radius: 12px;
  background: var(--green);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  font-family: inherit;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 8px -6px rgba(13, 179, 126, 0.6);
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  margin-top: 6px;
}

.btn-submit:hover {
  background: var(--green-hover);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px -8px rgba(13, 179, 126, 0.7);
}

.btn-submit:active { transform: translateY(0); }
.btn-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none; }

/* ── Link "Esqueci minha senha" ── */
.forgot {
  align-self: center;
  margin-top: 4px;
  font-size: 14px;
}

.reset-success {
  margin-top: 18px;
}

.reset-back {
  display: block;
  margin: 18px auto 0;
}

/* ── Mensagens ── */
.error-msg,
.success-msg,
.notice-msg {
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 13.5px;
  line-height: 1.45;
}

.error-msg {
  background: rgba(224, 50, 46, 0.08);
  border: 1px solid rgba(224, 50, 46, 0.28);
  color: #b81313;
}

.success-msg {
  background: rgba(13, 179, 126, 0.10);
  border: 1px solid rgba(13, 179, 126, 0.32);
  color: #0a8e64;
}

.notice-msg {
  background: rgba(216, 154, 29, 0.10);
  border: 1px solid rgba(216, 154, 29, 0.34);
  color: #a5731a;
}

/* ── Rodapé ── */
.login-footer {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ── Responsivo ── */
@media (max-width: 480px) {
  .card { padding: 32px 22px; border-radius: 20px; }
  .screen h1 { font-size: 23px; }
  .logo img { height: 40px; width: 40px; }
  .logo-word { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .login-shell { animation: none; }
  .grid-glow,
  .field,
  .btn-submit { transition: none; }
}
