/* Rehabit Auth — pure HTML/CSS/JS mirror of the React version */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --brand: #1565D8;
  --brand-hover: #0F56BC;
  --ink: #000000;
  --ink-muted: #5F6C7B;
  --hairline: #CFCFCF;
  --danger: #DC2626;
  --danger-soft: rgba(220, 38, 38, 0.14);
}

* { box-sizing: border-box; }
/* O atributo hidden do HTML perde para qualquer regra de display do próprio
   site (.form-content é flex, por exemplo). Sem este !important, um bloco
   marcado como hidden continua aparecendo na tela. */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: #fff;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(21,101,216,.22); color: inherit; }

/* ---- Shell ---- */
.shell {
  position: relative;
  margin: 0 auto;
  min-height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
}

/* ---- Photo panel ---- */
.photo {
  position: relative;
  display: none;
  width: 100%;
  min-height: 260px;
}
.photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Curved white divider sitting on the form-facing edge of the photo */
.divider {
  pointer-events: none;
  position: absolute;
  top: 0;
  bottom: 0;
  width: 120px;
  height: 100%;
  color: #fff;
}
.divider svg { width: 100%; height: 100%; display: block; }
.divider.right { right: -1px; }
.divider.left  { left: -1px; }

/* ---- Form panel ---- */
.form-side {
  display: flex;
  width: 100%;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  background: #fff;
  padding: 40px 24px;
}
.form-wrap {
  width: 100%;
  max-width: 440px;
}

/* Center content on mobile, left-align on desktop */
.form-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.logo {
  display: block;
  width: 280px;
  height: auto;
  /* Nunca passa da coluna: entre 768 e ~1100px ela fica estreita. */
  max-width: 100%;
  margin-bottom: 35px;
}

h1 {
  font-size: 32px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #000;
  margin: 0;
}
.subtitle {
  font-size: 18px;
  color: var(--ink-muted);
  margin: 8px 0 0;
}

/* ---- Fields ---- */
.fields {
  width: 100%;
  margin-top: 32px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.field label {
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: #000;
  margin-bottom: 8px;
}
.field input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  font-size: 16px;
  font-family: inherit;
  color: #000;
  background: #fff;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  outline: none;
  box-shadow: 0 1px 2px rgba(16,24,40,.03);
  transition: border-color .15s, box-shadow .15s;
}
.field input::placeholder { color: rgba(95,108,123,.6); }
.field input:hover { border-color: #B7C0CC; }
.field input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(21,101,216,.15);
}

/* ---- Campos obrigatórios ----
   O asterisco sai do atributo required, mas só nos formulários que trazem a
   legenda que o explica (o de cadastro). No login e na recuperação de senha
   todo campo é obrigatório, e marcar cada um seria só ruído. O "/ ''" tira o
   asterisco da leitura de tela, que já anuncia "obrigatório". O segundo
   seletor cobre a senha, que fica dentro do botão de mostrar/ocultar. */
form:has(.legenda-obrigatorio) .field:has(> input:required) > label::after,
form:has(.legenda-obrigatorio) .field:has(> * > input:required) > label::after {
  content: " *";
  content: " *" / "";
  color: var(--danger);
  font-weight: 700;
}
.legenda-obrigatorio {
  margin: 12px 0 0;
  font-size: 14px;
  color: var(--ink-muted);
}
.legenda-obrigatorio span { color: var(--danger); font-weight: 700; }
/* !important: o tema escuro redefine borda e sombra com seletor mais forte. */
.field input[aria-invalid="true"] {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 4px var(--danger-soft) !important;
}
.campo-erro {
  margin: 6px 0 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--danger);
}

/* ---- Mostrar/ocultar senha ---- */
.rh-pwd-wrap { position: relative; }
.rh-pwd-wrap input { padding-right: 44px; }
.rh-pwd-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
}
.rh-pwd-toggle:hover { color: #000; }
.rh-pwd-toggle svg { width: 20px; height: 20px; }

/* ---- Primary button ---- */
.btn-primary {
  margin-top: 32px;
  width: 100%;
  height: 46px;
  border: none;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 6px 18px -8px rgba(21,101,216,.55);
  transition: background .2s, transform .15s, box-shadow .15s;
}
.btn-primary:hover {
  background: var(--brand-hover);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px -8px rgba(21,101,216,.6);
}
.btn-primary:active { transform: translateY(0); box-shadow: 0 4px 12px -6px rgba(21,101,216,.55); }
.btn-primary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(21,101,216,.25);
}

/* ---- Footer link ---- */
.footer-link {
  margin-top: 24px;
  width: 100%;
  text-align: center;
  font-size: 16px;
  color: var(--ink-muted);
}
.footer-link a,
.forgot-link a {
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
  border-radius: 4px;
}
.footer-link a:hover,
.forgot-link a:hover { color: var(--brand-hover); }
.footer-link a:focus-visible,
.forgot-link a:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(21,101,216,.25);
}

.forgot-link {
  width: 100%;
  text-align: right;
  margin-top: 10px;
  font-size: 14px;
}

.form-hint {
  font-size: 14px;
  color: var(--ink-muted);
  margin: 6px 0 0;
}

/* ---- Account type selector (register) ---- */
.account-type-wrap {
  width: 100%;
  margin-top: 32px;
  text-align: left;
}
.account-type-label {
  font-size: 15px;
  color: var(--ink-muted);
  margin: 0 0 8px;
}
.account-type {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 46px;
  width: 100%;
  max-width: 370px;
  overflow: hidden;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: #fff;
}
.account-type button {
  height: 100%;
  width: 100%;
  border: none;
  background: #fff;
  color: var(--ink-muted);
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.account-type button:hover { color: #000; }
.account-type button:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(21,101,216,.4);
}
.account-type button.active {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 2px 8px -2px rgba(21,101,216,.5);
}

.after-account { margin-top: 24px; }

/* ---- Desktop split layout (>= 768px) ---- */
@media (min-width: 768px) {
  .shell { flex-direction: row; }

  .photo {
    display: block;
    width: 52%;
    min-height: 100vh;
  }
  .form-side {
    width: 48%;
    padding: 60px 65px;
    min-height: 100vh;
  }

  /* imageSide="left"  => photo left, form right */
  .shell.image-left  .photo     { order: 1; }
  .shell.image-left  .form-side { order: 2; }
  /* imageSide="right" => photo right, form left */
  .shell.image-right .photo     { order: 2; }
  .shell.image-right .form-side { order: 1; }

  /* Left-align form contents on desktop */
  .form-content {
    align-items: flex-start;
    text-align: left;
  }

  h1 { font-size: 36px; }
  .logo { width: 340px; }
}

/* ---------- Toastify — corrige mensagem cortada/sobreposta ----------
   O padrão da lib usa max-width:calc(50% - 20px), que em telas de
   celular vira uma coluna estreita demais e deixa o texto sobrepondo
   o próprio card; aqui garantimos uma largura legível e quebra de
   linha correta em qualquer tamanho de tela. */
.toastify {
  max-width: min(420px, calc(100vw - 32px));
  width: max-content;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.45;
  padding: 14px 18px;
}
@media (max-width: 480px) {
  .toastify.toastify-right,
  .toastify.toastify-left {
    left: 16px !important;
    right: 16px !important;
    max-width: none;
    width: auto;
    margin: 0;
  }
}

/* ---------- Desktop estreito (768–1199) ----------
   A coluna do formulário é 48% menos 130px de respiro: numa janela de 865px
   sobram 285px, e o logo de 340px transbordava dela, cortado na borda. */
@media (min-width: 768px) and (max-width: 1199px) {
  .form-side { padding: 48px 40px; }
  .logo { width: 260px; }
  h1 { font-size: 30px; }
}
