/* ============================================================
   WCAG 2.2 AA / eMAG — correções globais
   Carregado em base.html e base_gestores.html.
   ============================================================ */

/* 1.4.3 Contraste — .text-muted do Bootstrap (#6c757d) falha ~3,5:1
   sobre os cards escuros. Forçar o token acessível do tema. */
.text-muted,
.text-body-secondary {
  color: var(--color-text-muted, #b5b6b8) !important;
}

/* 1.4.3 Contraste — inputs do form admin (.form-control) ficavam com texto
   escuro sobre fundo cinza (~2,99:1). Força input escuro + texto claro,
   coerente com o tema escuro do painel admin (≥ 4,5:1). */
.admin-form-card .form-control,
.admin-form-card .form-control:focus {
  background-color: #1a1a1e !important;
  color: #f5f6fa !important;
  border: 1px solid #232325;
}
.admin-form-card .form-control::placeholder {
  color: #b5b6b8 !important;
  opacity: 1;
}

/* Rótulo de campo com destaque laranja (substitui style inline nos forms).
   O laranja sobre os fundos escuros do tema passa AA. */
.form-label-accent {
  color: var(--primary, #ff9000);
  font-weight: 600;
}

/* 2.4.7 Foco visível — fallback global (alguns inputs zeram o outline).
   Usa o laranja da marca; contraste do indicador ≥ 3:1 nos fundos do tema. */
:focus-visible {
  outline: 2px solid var(--primary, #ff9000);
  outline-offset: 2px;
}
/* 2.4.11 (2.2) — foco não obscurecido por barras fixas */
:focus {
  scroll-margin-top: 90px;
  scroll-margin-bottom: 60px;
}

/* 2.5.8 (2.2) Tamanho de alvo — mínimo 24×24px para botões compactos.
   (Checkboxes/radios nativos são isentos; toggles custom têm o label como
   alvo, que já é grande.) */
.btn-sm,
.btn-group-sm > .btn {
  min-height: 24px;
}

/* 2.1.1 / 2.4.7 Toggles custom: o input nativo é escondido visualmente mas
   precisa permanecer focável por teclado e mostrar foco visível no slider. */
.switch input:focus-visible + .slider,
.objetivo-toggle input:focus-visible + .toggle-slider {
  outline: 2px solid var(--primary, #ff9000);
  outline-offset: 2px;
}
.objetivo-toggle:focus-within,
.step8-meta-card:focus-within {
  outline: 2px solid var(--primary, #ff9000);
  outline-offset: 2px;
}

/* 2.3 prefers-reduced-motion — global (o site público herda só do Bootstrap) */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 1200;
  transform: translateY(-180%);
  padding: 0.8rem 1rem;
  border-radius: 0.9rem;
  background: #111827;
  color: #fff7eb;
  border: 1px solid rgba(255, 144, 0, 0.55);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.28);
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.18s ease;
}

.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0);
  outline: 3px solid rgba(255, 144, 0, 0.28);
  outline-offset: 2px;
}

/* ── Máscara de telefone: feedback visual profissional ── */

input.phone-mask {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input.phone-mask.phone-valid {
  border-color: #78d1c0 !important;
  box-shadow: 0 0 0 3px rgba(120, 209, 192, 0.15) !important;
}

input.phone-mask.phone-invalid {
  border-color: #e57373 !important;
  box-shadow: 0 0 0 3px rgba(229, 115, 115, 0.1) !important;
}

.phone-display {
  color: #78d1c0;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.15s ease;
}

.phone-display:hover {
  color: #5fb8a5;
  text-decoration: underline;
}

.phone-link {
  display: inline-block;
  margin-top: 4px;
  color: #78d1c0;
  text-decoration: none;
  font-size: 0.9em;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 4px;
  background: rgba(120, 209, 192, 0.08);
  transition: all 0.15s ease;
}

.phone-link:hover {
  background: rgba(120, 209, 192, 0.15);
  color: #5fb8a5;
  text-decoration: none;
}

/* ── VLibras: posição fixa no canto inferior direito + z-index seguro ── */

body.has-vlibras div[vw] {
  position: fixed !important;
  right: 1rem !important;
  bottom: 1rem !important;
  left: auto !important;
  top: auto !important;
  z-index: 1100 !important;
}

body.has-vlibras [vw-access-button] {
  z-index: 1101 !important;
}

body.has-vlibras [vw-access-button] img {
  border-radius: 50% !important;
}

body.has-vlibras [vw-plugin-wrapper] {
  z-index: 1102 !important;
}

@media (max-width: 768px) {
  body.has-vlibras div[vw] {
    right: 0.75rem !important;
    bottom: 0.75rem !important;
  }
}
