/* Mega Clean — widget anti-robô ("I'm not a robot"). Usado no site público e no login do painel. */

.hc {
  --hc-ink: var(--navy, #102A43);
  --hc-accent: var(--blue, #2563EB);
  --hc-ok: #1E9E6F;        /* caixa preenchida e ícones (gráficos: basta 3:1) */
  --hc-ok-text: #0F7A53;   /* texto "Verificado": 5,0:1 em #F0FAF5, 5,1:1 em #F8FAFC, 5,3:1 em #fff (AA) */
  --hc-ok-bg: #F0FAF5;
  --hc-ok-border: #BFE6D2;
  --hc-err: #B3261E;
  --hc-err-bg: #FFF6F5;
  --hc-err-border: #F3C6C6;
  --hc-muted: #5B6B7C;
  --hc-border: #DCE3EA;
  position: relative;
  margin: 6px 0 20px;
  font-family: inherit;
  /* O layout se adapta à largura do próprio formulário (não à da tela). */
  container: hc / inline-size;
}

/* ---------- modo caixa ("I'm not a robot") ---------- */
.hc-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  width: 100%;
  max-width: 440px;
  min-height: 68px;
  padding: 8px 14px 8px 8px;
  background: #F8FAFC;
  border: 1px solid var(--hc-border);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(16, 42, 67, .05);
  transition: background-color .25s ease, border-color .25s ease;
}
.hc-control {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 48px;
  margin: 0;
  padding: 6px 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--hc-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.hc-control:focus { outline: none; }
.hc-control:focus-visible { outline: 3px solid rgba(37, 99, 235, .4); outline-offset: 1px; }
.hc-box {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border: 2px solid #8C9BAB;
  border-radius: 7px;
  background: #fff;
  color: #fff;
  transition: background-color .2s ease, border-color .2s ease, transform .2s ease;
}
.hc-control:hover .hc-box { border-color: var(--hc-accent); }
.hc-ico { display: none; width: 20px; height: 20px; }
.hc-spinner {
  display: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid rgba(37, 99, 235, .18);
  border-top-color: var(--hc-accent);
  animation: hc-spin .75s linear infinite;
}
.hc-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
/* Rótulo sempre numa linha (o cartão tem altura mínima para rótulo + status: sem "pulo" de layout). */
.hc-label { font-size: 15px; font-weight: 600; line-height: 1.25; color: var(--hc-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hc-status { font-size: 12.5px; line-height: 1.3; color: var(--hc-muted); }
.hc-status:empty { display: none; }

.hc-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
  color: var(--hc-muted);
  font-size: 10.5px;
  line-height: 1.2;
  text-align: right;
}
.hc-brand .hc-ico-shield { display: block; width: 24px; height: 24px; color: var(--hc-ok); }
.hc-brand-text { display: flex; flex-direction: column; }
.hc-brand-text strong { color: var(--hc-ink); font-size: 11px; font-weight: 700; letter-spacing: .01em; }

/* estados */
.hc[data-state="verifying"] .hc-box { border-color: transparent; background: transparent; }
.hc[data-state="verifying"] .hc-spinner { display: block; }
.hc[data-state="verified"] .hc-card { background: var(--hc-ok-bg); border-color: var(--hc-ok-border); }
.hc--checkbox[data-state="verified"] .hc-box { background: var(--hc-ok); border-color: var(--hc-ok); animation: hc-pop .28s ease-out; }
.hc--checkbox[data-state="verified"] .hc-ico-check { display: block; }
.hc--checkbox[data-state="verified"] .hc-control { cursor: default; }
.hc[data-state="verified"] .hc-status { color: var(--hc-ok-text); font-weight: 600; }
.hc[data-state="error"] .hc-card { background: var(--hc-err-bg); border-color: var(--hc-err-border); }
.hc--checkbox[data-state="error"] .hc-box { border-color: var(--hc-err); color: var(--hc-err); }
.hc--checkbox[data-state="error"] .hc-ico-retry { display: block; width: 18px; height: 18px; }
.hc[data-state="error"] .hc-status { color: var(--hc-err); }

/* ---------- modo automático (linha discreta) ---------- */
.hc--auto { margin: 2px 0 14px; }
.hc-line {
  display: flex;
  align-items: center;
  gap: 6px 8px;
  margin: 0;
  min-height: 24px;
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--hc-muted);
}
.hc--auto .hc-box { width: 18px; height: 18px; border: 0; border-radius: 0; background: transparent; color: var(--hc-ok); }
.hc-line .hc-status { flex: 0 1 auto; min-width: 0; }
.hc--auto .hc-ico { width: 18px; height: 18px; }
.hc--auto .hc-ico-shield { display: block; }
.hc--auto .hc-spinner { width: 16px; height: 16px; border-width: 2px; }
.hc--auto[data-state="verifying"] .hc-ico-shield,
.hc--auto[data-state="verified"] .hc-ico-shield,
.hc--auto[data-state="error"] .hc-ico-shield { display: none; }
.hc--auto[data-state="verified"] .hc-ico-check,
.hc--auto[data-state="error"] .hc-ico-alert { display: block; }
.hc--auto[data-state="error"] .hc-box { color: var(--hc-err); }
.hc--auto[data-state="verified"] .hc-status { font-weight: 600; }
/* "Tentar de novo" compacto (link), na mesma linha do aviso: o erro não empurra o botão de entrar. */
.hc-retry {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 24px;
  margin: 0;
  padding: 0 4px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--hc-err);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.hc-retry[hidden] { display: none; }
.hc-retry .hc-ico { display: block; width: 14px; height: 14px; }
.hc-retry:hover { background: var(--hc-err-bg); }
.hc-retry:focus-visible { outline: 3px solid rgba(179, 38, 30, .3); outline-offset: 1px; }

/* ---------- comuns ---------- */
.hc-live {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.hc-noscript {
  margin: 8px 0 0;
  padding: 10px 14px;
  border: 1px solid #F1D9A6;
  border-radius: 10px;
  background: #FFF8E6;
  color: #6B4A06;
  font-size: 13.5px;
  line-height: 1.45;
}

@keyframes hc-spin { to { transform: rotate(360deg); } }
@keyframes hc-pop { 0% { transform: scale(.7); } 70% { transform: scale(1.08); } 100% { transform: scale(1); } }

@media (prefers-reduced-motion: reduce) {
  .hc-spinner { animation-duration: 1.6s !important; animation-iteration-count: infinite !important; }
  .hc--checkbox[data-state="verified"] .hc-box { animation: none; }
}

/* Formulário estreito (celular): marca compacta (escudo + nome) e altura reservada para 2 linhas de status. */
@container hc (max-width: 420px) {
  .hc-card { min-height: 78px; padding: 6px 10px 6px 6px; gap: 8px; }
  .hc-status { line-height: 1.25; }
  .hc-control { gap: 10px; padding: 6px; }
  .hc-brand { flex-direction: column; gap: 3px; text-align: center; }
  .hc-brand .hc-ico-shield { width: 22px; height: 22px; }
  .hc-brand-text span { display: none; }
  .hc-brand-text strong { font-size: 10px; }
}
@container hc (max-width: 300px) {
  .hc-brand-text { display: none; }
  .hc-label { font-size: 14.5px; }
}
/* Linha automática (login) em tela bem estreita: espaço para 2 linhas, sem "pulo" entre os estados. */
@container hc (max-width: 360px) {
  .hc-line { min-height: 34px; }
}
/* Toque (celular/tablet): "Tentar de novo" com área de toque maior; a linha já reserva essa altura
   em todos os estados, então o botão aparecer não empurra o formulário. */
@media (pointer: coarse) {
  .hc-retry { min-height: 40px; padding: 0 10px; }
  .hc--auto .hc-line { min-height: 40px; }
}
/* Navegadores sem container queries: mesma ideia pela largura da tela. */
@supports not (container-type: inline-size) {
  @media (max-width: 480px) {
    .hc-card { min-height: 78px; padding: 6px 10px 6px 6px; gap: 8px; }
    .hc-status { line-height: 1.25; }
    .hc-control { gap: 10px; padding: 6px; }
    .hc-brand { flex-direction: column; gap: 3px; text-align: center; }
    .hc-brand-text span { display: none; }
    .hc-brand-text strong { font-size: 10px; }
  }
}
