/*
 * PCD-01 — campo "Sou pessoa com deficiência (PcD)" (js/deficiencia.js).
 * Visual do Switch default do shadcn convertido para CSS puro.
 * Independe de Bootstrap.
 * Também dá o visual de switch ao aceite de comunicações (.pcd-switch).
 */

.pcd-field,
.pcd-switch {
  --pcd-primary: #120363;
  /* Track desligado: #d1d5db (1.47:1) e #9ca3af (2.54:1) não chegam a 3:1 no branco; #878e98 = 3.31:1 */
  --pcd-input: #878e98;
  --pcd-danger: #dc2626;
  --pcd-texto: #1f2937;
  --pcd-muted: #4b5563;
  --pcd-borda: #d1d5db;
}

.pcd,
.pcd-switch {
  color: var(--pcd-texto);
  text-align: left;
}

/* Área de toque: a label inteira, com altura mínima de 44px */
.pcd__switch-row {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin: 0;
  cursor: pointer;
  font-weight: 600;
  user-select: none;
}

/* Input nativo visualmente oculto (sr-only próprio, sem depender do BS) */
.pcd__input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
}

.pcd__track {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  box-sizing: border-box;
  width: 32px;
  height: 18.4px;
  border-radius: 9999px;
  border: 1px solid transparent;
  background: var(--pcd-input);
  transition: background-color 0.15s, box-shadow 0.15s;
}

.pcd__thumb {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 9999px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transform: translateX(0);
  transition: transform 0.15s;
  pointer-events: none;
}

.pcd__input:checked + .pcd__track {
  background: var(--pcd-primary);
}

.pcd__input:checked + .pcd__track .pcd__thumb {
  transform: translateX(calc(100% - 2px));
}

.pcd__input:focus-visible + .pcd__track {
  box-shadow: 0 0 0 3px rgba(18, 3, 99, 0.35);
}

.pcd__label {
  font-size: 0.95rem;
  line-height: 1.3;
}

/* Fieldset de opções */
.pcd__opcoes {
  min-width: 0;
  margin: 10px 0 0;
  padding: 10px 14px 12px;
  border: 1px solid var(--pcd-borda);
  border-radius: 8px;
  background: #fff;
}

.pcd__opcoes[hidden] {
  display: none !important;
}

.pcd__opcoes[aria-invalid="true"] {
  border-color: var(--pcd-danger);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2);
}

/* Neutraliza o legend do BS4 (1.5rem) e do BS5 (float + font-size fluido) */
.pcd__opcoes > legend {
  float: none;
  display: block;
  width: auto;
  max-width: 100%;
  margin: 0 0 6px;
  padding: 0 4px;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--pcd-texto);
  white-space: normal;
}

.pcd__opcoes > legend:focus {
  outline: 2px solid var(--pcd-primary);
  outline-offset: 2px;
}

.pcd__opcoes > legend:focus:not(:focus-visible) {
  outline: none;
}

.pcd__legend-hint {
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--pcd-muted);
}

.pcd__status:empty {
  display: none;
}

.pcd__status {
  margin: 4px 0 8px;
  font-size: 0.85rem;
  color: var(--pcd-muted);
}

.pcd__retry {
  min-height: 32px;
  padding: 4px 12px;
  border: 1px solid var(--pcd-primary);
  border-radius: 6px;
  background: #fff;
  color: var(--pcd-primary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.pcd__retry:hover,
.pcd__retry:focus-visible {
  background: var(--pcd-primary);
  color: #fff;
}

.pcd__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px 16px;
}

@media (min-width: 576px) {
  .pcd__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.pcd__opcao {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.pcd__opcao input[type="checkbox"] {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin: 3px 0 0;
  accent-color: var(--pcd-primary);
  cursor: pointer;
}

.pcd__opcao label {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1.4;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.pcd__erro {
  margin: 8px 0 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--pcd-danger);
}

.pcd__erro[hidden] {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .pcd__track,
  .pcd__thumb {
    transition: none;
  }
}

/* Aceite do formulário de contato do rodapé (#contact-footer): fundo escuro e regras próprias do tema */
.pcd-switch--footer {
  color: #fff;
}

.pcd-switch--footer .pcd__label {
  color: #fff;
}

/* Ligado: #120363 some no fundo #190c6d; track branco e thumb na cor da marca */
.pcd-switch--footer .pcd__input:checked + .pcd__track {
  background: #fff;
}

.pcd-switch--footer .pcd__input:checked + .pcd__track .pcd__thumb {
  background: var(--pcd-primary);
}

.pcd-switch--footer .pcd__input:focus-visible + .pcd__track {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.6);
}

#contact-footer #gridCheckAcceptFaleSubscribe.pcd__input {
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
}

#contact-footer .pcd-switch--footer .pcd__switch-row {
  white-space: normal;
  padding-right: 0;
}

