/* ─────────────────────────────────────────────────────────────
 * EducaSaude · Login Page · v0.3
 * Split panel: 54% brand / 46% form
 * Dark mode: data-theme="dark" on <html>
 * ───────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  font-family: var(--es-font-sans, "Inter", system-ui, sans-serif);
  -webkit-font-smoothing: antialiased;
  background: var(--es-surface, #fff);
}

/* ─── Wrap ─── */
.es-login-wrap {
  display: flex;
  min-height: 100vh;
}

/* ══════════════════════════════════════════
   LEFT — brand panel (always dark navy)
   ══════════════════════════════════════════ */
.es-login-brand {
  width: 54%;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  color: #fff;
  background:
    /* 1 — leve vinheta nas bordas para profundidade */
    radial-gradient(ellipse at 30% 60%, rgba(14,165,183,0.18) 0%, transparent 65%),
    /* 2 — gradiente direcional que escurece da esquerda ao centro (legibilidade) */
    linear-gradient(
      105deg,
      rgba(7,18,62,0.88) 30%,
      rgba(15,31,92,0.72) 100%,
      rgba(30,58,138,0.55) 100%
    ),
    /* 3 — pattern de bolinhas sobre a foto */
    url('/img/bg-dotted.png') repeat 3px,
    /* 4 — foto de fundo */
    url('/img/hero-foto.jpg') center center / cover no-repeat;
  padding: 44px 56px;
  display: flex;
  flex-direction: column;
}

/* decorative SVG overlay */
.es-login-deco {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.35;
  pointer-events: none;
}

/* brand top */
.es-login-brand-top {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Logo do hospital no topo do painel de marca (fundo escuro → logo_light) */
.es-login-logo { height: 46px; width: auto; display: block; }

/* hero copy — centralizado verticalmente entre brand-top e brand-bottom */
.es-login-hero {
  position: relative;
  margin-top: auto;
  margin-bottom: auto;
  max-width: 460px;
}

.es-login-edition {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: #0EA5B7;
  font-weight: 600;
  margin-bottom: 22px;
}

.es-login-edition-line {
  display: inline-block;
  width: 26px;
  height: 1px;
  background: #0EA5B7;
}

.es-login-h1 {
  margin: 0;
  font-weight: 700;
  font-size: 48px;
  line-height: 1.05;
  letter-spacing: -1.4px;
  color: #fff;
}

.es-login-h1-accent { color: #0EA5B7; }

.es-login-desc {
  margin: 22px 0 0;
  font-size: 15.5px;
  line-height: 1.6;
  color: rgba(255,255,255,0.72);
}

/* wrapper do rodapé do painel de marca */
.es-login-brand-bottom { position: relative; }

/* stats strip */
.es-login-stats {
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.es-login-stat-n {
  font-family: var(--es-font-sans);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.6px;
  color: #fff;
}

.es-login-stat-l {
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  margin-top: 4px;
  letter-spacing: 0.2px;
}

/* tenant footer */
.es-login-tenant {
  position: relative;
  margin-top: 36px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12.5px;
  color: rgba(255,255,255,0.6);
}

.es-login-tenant-logo {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  background: #fff;
  color: #0F1F5C;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: -0.4px;
  flex-shrink: 0;
}

.es-login-tenant-name { color: #fff; font-weight: 600; }
.es-login-tenant-sub  { font-size: 11.5px; }

.es-login-tenant-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  margin-left: auto;
}

.es-login-status-dot {
  width: 6px;
  height: 6px;
  background: #3DD68C;
  border-radius: 3px;
  box-shadow: 0 0 0 3px rgba(61,214,140,0.18);
  flex-shrink: 0;
}

/* ══════════════════════════════════════════
   RIGHT — form panel (reacts to theme)
   ══════════════════════════════════════════ */
.es-login-form-panel {
  flex: 1;
  min-height: 100vh;
  padding: 44px 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--es-surface, #fff);
  transition: background .15s, color .15s;
}

/* topbar */
.es-login-topbar {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  color: var(--es-muted, #6B7794);
}

.es-login-topbar-sep {
  width: 1px;
  height: 14px;
  background: var(--es-line, #E1E6F0);
}

.es-login-request-link {
  color: var(--es-primary, #1E3A8A);
  font-weight: 600;
  text-decoration: none;
}
.es-login-request-link:hover { text-decoration: underline; }

/* form area — centralizada nos dois eixos */
.es-login-form-area {
  margin: auto 0;
  max-width: 420px;
  width: 100%;
  flex-shrink: 0;
}

/* security badge */
.es-secure-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px 5px 8px;
  background: var(--es-primary-light, #EEF2FE);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--es-primary, #1E3A8A);
  font-weight: 600;
  margin-bottom: 22px;
}

.es-form-title {
  margin: 0 0 8px;
  font-family: var(--es-font-sans);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.8px;
  color: var(--es-ink, #0B1733);
  line-height: 1.1;
}

.es-form-sub {
  margin: 0 0 28px;
  font-size: 14.5px;
  color: var(--es-ink-soft, #3B4863);
  line-height: 1.55;
}

/* ─── Field ─── */
.es-field { margin-bottom: 16px; }

.es-field-label {
  font-family: var(--es-font-sans);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--es-ink-soft, #3B4863);
  letter-spacing: 0.1px;
  display: block;
  margin-bottom: 7px;
}

.es-field-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 7px;
}
.es-field-label-row .es-field-label { margin-bottom: 0; }

.es-field-recover {
  background: transparent;
  border: none;
  padding: 0;
  font-family: var(--es-font-sans);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--es-primary, #1E3A8A);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.es-field-recover:hover { text-decoration: underline; }
.es-field-recover:focus { outline: none; box-shadow: var(--es-focus-ring, 0 0 0 3px rgba(30,58,138,0.18)); border-radius: 4px; }

.es-field-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 50px;
  padding: 0 14px;
  background: var(--es-surface, #fff);
  border: 1.5px solid var(--es-line, #E1E6F0);
  border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
}

.es-field-wrap:focus-within {
  border-color: var(--es-primary, #1E3A8A);
  box-shadow: var(--es-focus-ring, 0 0 0 3px rgba(30,58,138,0.18));
}

.es-field-icon {
  font-size: 18px;
  color: var(--es-muted, #6B7794);
  flex-shrink: 0;
}

.es-field-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
  font-weight: 500;
  color: var(--es-ink, #0B1733);
  font-family: var(--es-font-sans);
  padding: 0;
  min-width: 0;
}
.es-field-input::placeholder { color: var(--es-muted, #6B7794); font-weight: 400; }

/* Remove o fundo azul nativo de autofill do browser */
.es-field-input:-webkit-autofill,
.es-field-input:-webkit-autofill:hover,
.es-field-input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #fff inset;
  -webkit-text-fill-color: var(--es-ink, #0B1733);
  transition: background-color 9999s ease-in-out 0s;
}

/* Dark mode: sobrescreve o fundo branco do autofill nativo */
[data-theme="dark"] .es-field-input:-webkit-autofill,
[data-theme="dark"] .es-field-input:-webkit-autofill:hover,
[data-theme="dark"] .es-field-input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #141A3A inset;
  -webkit-text-fill-color: #EAEEF8;
}

/* validation pills */
.es-field-pill {
  display: none; /* shown via JS */
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 5px;
  flex-shrink: 0;
  white-space: nowrap;
}
.es-field-pill.is-visible { display: inline-flex; }
.es-field-pill--valid   { color: var(--es-success, #0F8C5E); background: var(--es-success-soft, #E5F4ED); }
.es-field-pill--invalid { color: var(--es-danger,  #C03A2F); background: var(--es-danger-soft,  #FCE8E5); }

/* show/hide password toggle */
.es-field-eye {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--es-muted, #6B7794);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--es-radius, 8px);
  transition: color .15s;
  font-size: 18px;
}
.es-field-eye:hover { color: var(--es-ink-soft, #3B4863); }
.es-field-eye:focus { outline: none; box-shadow: var(--es-focus-ring); }

.es-field-error {
  display: block;
  font-size: 12px;
  color: var(--es-danger, #C03A2F);
  margin-top: 5px;
}

/* ─── Remember checkbox ─── */
.es-remember {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  color: var(--es-ink-soft, #3B4863);
  font-size: 13.5px;
  margin: 4px 0 20px;
  user-select: none;
}

.es-remember-input { position: absolute; opacity: 0; width: 0; height: 0; }

.es-remember-box {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1.5px solid var(--es-line, #E1E6F0);
  background: var(--es-surface, #fff);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  transition: background .12s, border-color .12s;
  font-size: 11px;
}

.es-remember-input:checked ~ .es-remember-box {
  border-color: var(--es-primary, #1E3A8A);
  background: var(--es-primary, #1E3A8A);
}

/* ─── Primary button ─── */
.es-btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  width: 100%;
  background: var(--es-primary, #1E3A8A);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: var(--es-font-sans);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 8px 20px -8px rgba(30,58,138,0.5);
  transition: background .15s;
  text-decoration: none;
}
.es-btn-primary:hover { background: var(--es-primary-deep, #0F1F5C); color: #fff; }
.es-btn-primary:focus { outline: none; box-shadow: var(--es-focus-ring, 0 0 0 3px rgba(30,58,138,0.18)); }

.es-btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  width: 100%;
  background: var(--es-surface, #fff);
  color: var(--es-primary, #1E3A8A);
  border: 1.5px solid var(--es-primary, #1E3A8A);
  border-radius: 10px;
  font-family: var(--es-font-sans);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  text-decoration: none;
  margin-top: 12px;
}
.es-btn-secondary:hover { background: var(--es-primary-light, #EEF2FE); color: var(--es-primary, #1E3A8A); }
.es-btn-secondary:focus { outline: none; box-shadow: var(--es-focus-ring, 0 0 0 3px rgba(30,58,138,0.18)); }
.es-btn-secondary:active { transform: scale(0.98); }
.es-btn-primary:active { transform: scale(0.98); }

/* ─── OR divider ─── */
.es-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--es-muted, #6B7794);
  margin: 16px 0 12px;
}
.es-divider::before,
.es-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--es-line, #E1E6F0);
}

/* ─── SSO button ─── */
.es-btn-sso {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 48px;
  width: 100%;
  background: var(--es-surface, #fff);
  color: var(--es-ink, #0B1733);
  border: 1.5px solid var(--es-line, #E1E6F0);
  border-radius: 10px;
  font-family: var(--es-font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.es-btn-sso:hover {
  background: var(--es-panel, #FAFBFE);
  border-color: var(--es-ink-soft, #3B4863);
}
.es-btn-sso:focus { outline: none; box-shadow: var(--es-focus-ring); }

/* ─── Page footer ─── */
.es-login-footer {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-family: var(--es-font-mono, "JetBrains Mono", monospace);
  font-size: 11.5px;
  color: var(--es-muted, #6B7794);
  margin-top: 28px;
}

/* ─── Dark mode toggle ─── */
.es-theme-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--es-muted, #6B7794);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--es-radius, 8px);
  font-size: 18px;
  margin-right: auto;
  transition: color .15s, background .15s;
}
.es-theme-toggle:hover  { color: var(--es-primary, #1E3A8A); background: var(--es-primary-light, #EEF2FE); }
.es-theme-toggle:focus  { outline: none; box-shadow: var(--es-focus-ring); }

.es-login-footer-right {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.es-login-footer-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* ══════════════════════════════════════════
   RECOVER PAGE SPECIFICS
   ══════════════════════════════════════════ */
.es-login-brand--narrow { width: 46%; }

.es-lock-box {
  width: 72px; height: 72px; border-radius: 18px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  display: flex; align-items: center; justify-content: center;
  color: #0EA5B7; font-size: 28px;
  box-shadow: 0 0 0 8px rgba(14,165,183,0.06), 0 20px 40px -10px rgba(14,165,183,0.33);
  flex-shrink: 0;
}

.es-recover-title {
  margin: 0; font-size: 36px; font-weight: 800;
  letter-spacing: -0.9px; line-height: 1.1; color: #fff;
}

.es-recover-desc {
  margin: 14px 0 0; font-size: 15px; line-height: 1.55;
  color: rgba(255,255,255,0.72);
}

.es-recover-steps {
  display: flex; align-items: center;
  font-size: 12px; color: rgba(255,255,255,0.7);
}

.es-recover-step { display: flex; align-items: center; gap: 8px; white-space: nowrap; }

.es-recover-step-num {
  width: 22px; height: 22px; border-radius: 99px;
  background: rgba(255,255,255,0.1); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; flex-shrink: 0;
}

.es-recover-step--active .es-recover-step-num { background: #0EA5B7; color: #0F1F5C; }
.es-recover-step--active .es-recover-step-label { color: #fff; font-weight: 700; }

.es-recover-step-connector {
  flex: 1; height: 1px; background: rgba(255,255,255,0.15);
  margin: 0 8px; min-width: 12px;
}

.es-recover-back {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13.5px; color: var(--es-primary, #1E3A8A); font-weight: 600;
  padding: 8px 12px 8px 8px; border-radius: 8px;
  background: var(--es-primary-light, #EEF2FE);
  text-decoration: none; margin-bottom: 24px; align-self: flex-start;
  transition: filter .12s;
}
.es-recover-back:hover { filter: brightness(0.95); text-decoration: none; color: var(--es-primary); }

.es-field-hint {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--es-muted, #6B7794); margin-top: 7px;
}

.es-info-card {
  display: flex; align-items: flex-start; gap: 12px;
  margin-top: 14px; padding: 14px; border-radius: 10px;
  background: var(--es-panel, #FAFBFE);
  border: 1px solid var(--es-line, #E1E6F0);
  font-size: 13px; color: var(--es-ink-soft, #3B4863); line-height: 1.5;
}

.es-info-card-icon { color: var(--es-accent, #0EA5B7); margin-top: 2px; flex-shrink: 0; font-size: 16px; }

.es-success-card {
  display: none; align-items: flex-start; gap: 14px;
  padding: 24px; border-radius: 12px;
  background: var(--es-success-soft, #E5F4ED);
  border: 1px solid var(--es-success, #0F8C5E);
}
.es-success-card.is-visible { display: flex; }

.es-success-card-icon { color: var(--es-success, #0F8C5E); font-size: 20px; flex-shrink: 0; }
.es-success-card-title { font-weight: 700; color: var(--es-ink, #0B1733); margin-bottom: 4px; }
.es-success-card-text { font-size: 13.5px; color: var(--es-ink-soft, #3B4863); line-height: 1.5; }

/* ══════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════ */
@media (max-width: 960px) {
  .es-login-brand { display: none; }
  .es-login-form-panel { padding: 32px 24px; }
}

@media (max-width: 480px) {
  .es-login-form-panel  { padding: 24px 16px; }
  .es-form-title        { font-size: 26px; }
}
