/* ============================================================
   Formulário de Pesquisa — componentes visuais
   1) Dropdowns / Checkboxes (institucional, fundo claro)
   2) Escala de intensidade em "bolinhas" (Likert 1–5)
   ============================================================ */

.rf-wrap {
  color: #111827;
}

.rf-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Progresso ---------- */
.rf-progress-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #059669;
}

.rf-progress-track {
  margin-top: 0.5rem;
  height: 6px;
  width: 100%;
  background: #e5e7eb;
  border-radius: 9999px;
  overflow: hidden;
}

.rf-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #059669);
  transition: width 0.3s ease;
}

/* ---------- Cabeçalho de bloco ---------- */
.rf-block-title {
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  font-size: 1.3rem;
  color: #0f172a;
  margin-top: 1.1rem;
  line-height: 1.3;
}

.rf-block-desc {
  color: #6b7280;
  font-size: 0.85rem;
  margin-top: 0.4rem;
  line-height: 1.55;
}

/* ---------- Campo genérico ---------- */
.rf-field {
  margin-top: 1.6rem;
  padding-top: 1.4rem;
  border-top: 1px solid #eef0ef;
}

.rf-field:first-of-type {
  border-top: none;
  padding-top: 0;
}

/* a caixa de rolagem do TCLE também conta como <div>, então o campo
   seguinte a ela (a pergunta de consentimento) precisa da mesma exceção */
.rf-consent-scroll + .rf-field {
  border-top: none;
  padding-top: 0;
}

.rf-label {
  display: block;
  font-weight: 600;
  color: #1f2937;
  font-size: 0.925rem;
  line-height: 1.45;
}

.rf-required {
  color: #dc2626;
  margin-left: 0.2rem;
}

.rf-note {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 0.3rem;
}

/* ---------- Componente 1: Select / Dropdown ---------- */
.rf-select {
  margin-top: 0.65rem;
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background-color: #f9fafb;
  border: 1.5px solid #d1d5db;
  border-radius: 12px;
  padding: 0.75rem 2.6rem 0.75rem 1rem;
  font-size: 0.9rem;
  color: #111827;
  cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  background-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.rf-select:hover { border-color: #a7f3d0; }

.rf-select:focus {
  outline: none;
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.16);
}

/* ---------- Componente 1: Checkbox institucional ---------- */
.rf-checkbox-group {
  margin-top: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.rf-checkbox-input {
  opacity: 0;
  position: absolute;
  width: 0;
  height: 0;
  margin: 0;
  padding: 0;
  pointer-events: none;
}

.rf-checkbox-item {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.7rem 0.9rem;
  border: 1.5px solid #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.rf-checkbox-item:hover { border-color: #a7f3d0; }

.rf-checkbox-input:checked + .rf-checkbox-item {
  border-color: #10b981;
  background: #ecfdf5;
}

.rf-checkbox-input:focus-visible + .rf-checkbox-item {
  outline: 2px solid #10b981;
  outline-offset: 2px;
}

.rf-checkbox-box {
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 6px;
  border: 2px solid #9ca3af;
  flex-shrink: 0;
  margin-top: 0.05rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  transition: all 0.15s ease;
}

.rf-checkbox-input:checked + .rf-checkbox-item .rf-checkbox-box {
  background: #10b981;
  border-color: #10b981;
}

.rf-checkbox-box svg {
  width: 0.7rem;
  height: 0.7rem;
  color: #fff;
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.15s ease;
}

.rf-checkbox-input:checked + .rf-checkbox-item .rf-checkbox-box svg {
  opacity: 1;
  transform: scale(1);
}

.rf-checkbox-text {
  font-size: 0.875rem;
  color: #374151;
  line-height: 1.4;
}

/* ---------- Cartões de consentimento (TCLE) ---------- */
.rf-consent-scroll {
  margin-top: 0.9rem;
  max-height: 230px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1rem 1.1rem;
  background: #f9fafb;
  font-size: 0.8rem;
  color: #4b5563;
  line-height: 1.65;
}

.rf-consent-scroll p + p { margin-top: 0.75rem; }
.rf-consent-scroll strong { color: #1f2937; }

.rf-consent-input {
  opacity: 0;
  position: absolute;
  width: 0;
  height: 0;
  margin: 0;
  padding: 0;
  pointer-events: none;
}

.rf-consent-card {
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
  padding: 1rem 1.1rem;
  border: 1.5px solid #e5e7eb;
  border-radius: 14px;
  cursor: pointer;
  margin-top: 0.75rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.rf-consent-card:hover { border-color: #a7f3d0; }

.rf-consent-input:checked + .rf-consent-card {
  border-color: #10b981;
  background: #ecfdf5;
}

.rf-consent-radio {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 9999px;
  border: 2px solid #9ca3af;
  flex-shrink: 0;
  margin-top: 0.1rem;
  position: relative;
  background: #fff;
}

.rf-consent-input:checked + .rf-consent-card .rf-consent-radio {
  border-color: #10b981;
}

.rf-consent-input:checked + .rf-consent-card .rf-consent-radio::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 9999px;
  background: #10b981;
}

.rf-consent-text {
  font-size: 0.85rem;
  color: #374151;
  line-height: 1.5;
}

/* ============================================================
   Componente 2: Escala de intensidade em "bolinhas"
   Tamanho crescente da esquerda (menor) para a direita (maior).
   Cor: roxo (esquerda/menor) → cinza (centro) → verde (direita/maior).
   ============================================================ */

.rf-likert-row {
  padding: 1.1rem 0;
  border-bottom: 1px solid #f0f2f1;
}

.rf-likert-row:last-child { border-bottom: none; }

.rf-likert-row-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1f2937;
  line-height: 1.45;
}

.rf-likert-scales {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0.85rem;
}

@media (min-width: 640px) {
  .rf-likert-scales {
    flex-direction: row;
    gap: 2.5rem;
  }
}

.rf-likert-scale { flex: 1; min-width: 0; }

.rf-likert-scale-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #059669;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.rf-likert-dots-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.rf-likert-endlabel {
  font-size: 0.64rem;
  color: #9ca3af;
  flex-shrink: 0;
  max-width: 4.6rem;
  line-height: 1.25;
}

.rf-likert-endlabel.is-right { text-align: right; }

.rf-likert-dots {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  flex: 1;
  max-width: 260px;
}

.rf-likert-input {
  opacity: 0;
  position: absolute;
  width: 0;
  height: 0;
  margin: 0;
  padding: 0;
  pointer-events: none;
}

.rf-likert-dot {
  --rf-size: 22px;
  --rf-color: #9ca3af;
  position: relative; /* ancora o ::before de área de toque em mobile, ver media query */
  width: var(--rf-size);
  height: var(--rf-size);
  border-radius: 50%;
  border: 2.5px solid var(--rf-color);
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  transition: transform 0.15s ease, background 0.15s ease;
}

.rf-likert-dot:hover { transform: scale(1.15); }

.rf-likert-input:focus-visible + .rf-likert-dot {
  outline: 2px solid #059669;
  outline-offset: 3px;
}

.rf-likert-input:checked + .rf-likert-dot {
  background: var(--rf-color);
}

/* crescimento linear da esquerda (menor) para a direita (maior).
   nth-of-type (não nth-child): cada bolinha é um <label> precedido por um
   <input> irmão, então as posições reais no DOM são 2,4,6,8,10 — nth-of-type
   conta só entre os <label> irmãos e por isso mapeia corretamente para 1..5. */
.rf-likert-dots .rf-likert-dot:nth-of-type(1) { --rf-size: 16px; --rf-color: #8b5cf6; }
.rf-likert-dots .rf-likert-dot:nth-of-type(2) { --rf-size: 22px; --rf-color: #a08bd6; }
.rf-likert-dots .rf-likert-dot:nth-of-type(3) { --rf-size: 28px; --rf-color: #9ca3af; }
.rf-likert-dots .rf-likert-dot:nth-of-type(4) { --rf-size: 34px; --rf-color: #6ea98d; }
.rf-likert-dots .rf-likert-dot:nth-of-type(5) { --rf-size: 40px; --rf-color: #10b981; }

/* ---------- Escala de frequência (Bloco 5) — categórica, não gradiente ---------- */
.rf-freq-row {
  padding: 1.1rem 0;
  border-bottom: 1px solid #f0f2f1;
}

.rf-freq-row:last-child { border-bottom: none; }

.rf-freq-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.7rem;
}

.rf-freq-input {
  opacity: 0;
  position: absolute;
  width: 0;
  height: 0;
  margin: 0;
  padding: 0;
  pointer-events: none;
}

.rf-freq-option {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid #d1d5db;
  border-radius: 9999px;
  padding: 0.4rem 0.9rem;
  font-size: 0.76rem;
  color: #374151;
  cursor: pointer;
  background: #f9fafb;
  transition: all 0.15s ease;
}

.rf-freq-option:hover { border-color: #a7f3d0; }

.rf-freq-input:checked + .rf-freq-option {
  border-color: #10b981;
  background: #10b981;
  color: #fff;
  font-weight: 600;
}

.rf-freq-input:focus-visible + .rf-freq-option {
  outline: 2px solid #059669;
  outline-offset: 2px;
}

/* ---------- Navegação de etapas ---------- */
.rf-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid #e5e7eb;
}

.rf-btn {
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.7rem 1.5rem;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
  font-family: inherit;
}

.rf-btn-primary { background: #059669; color: #fff; }
.rf-btn-primary:hover:not(:disabled) { background: #047857; }
.rf-btn-primary:disabled { background: #d1d5db; color: #9ca3af; cursor: not-allowed; }

.rf-btn-ghost {
  background: transparent;
  color: #6b7280;
  border: 1.5px solid #d1d5db;
}

.rf-btn-ghost:hover:not(:disabled) { border-color: #9ca3af; color: #374151; }
.rf-btn-ghost:disabled { opacity: 0.35; cursor: not-allowed; }

.rf-btn-text {
  background: none;
  border: none;
  color: #059669;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  padding: 0.5rem;
  font-family: inherit;
}

.rf-nav-side { display: flex; align-items: center; gap: 0.5rem; }

.rf-error-msg {
  color: #dc2626;
  font-size: 0.76rem;
  margin-top: 1rem;
  text-align: right;
}

/* ---------- Encerramento ---------- */
.rf-end-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-top: 2.75rem;
  margin-top: 0.5rem;
}

.rf-end-icon {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 9999px;
  background: #ecfdf5;
  color: #059669;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.rf-end-title {
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  font-size: 2.1rem;
  line-height: 1.25;
  color: #0f172a;
  margin-top: 1.5rem;
}

.rf-end-desc {
  color: #4b5563;
  font-size: 1.05rem;
  line-height: 1.65;
  margin-top: 1rem;
  max-width: 32rem;
}

.rf-decline-box {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  border-radius: 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  font-size: 0.85rem;
  line-height: 1.5;
}

/* ============================================================
   TOUCH (<= 768px, inclusive — cobre tablets como iPad em retrato):
   alvos de toque ampliados para >= 44x44px (diretriz de usabilidade
   mobile), sem alterar o design visual. Sem conflito de especificidade
   com o Tailwind aqui (classes .rf-* são só nossas), então não precisa
   do corte em 767px usado no index.html pro layout do modal.
   ============================================================ */
@media (max-width: 768px) {
  .rf-btn { min-height: 44px; }

  .rf-btn-text {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .rf-checkbox-item,
  .rf-consent-card {
    min-height: 44px;
  }

  .rf-freq-option {
    min-height: 44px;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
    display: inline-flex;
    align-items: center;
  }

  /* Bolinhas Likert: a escadinha visual (16→40px) fica exatamente como está,
     mas cada bolinha ganha uma área de toque invisível de 44x44px centralizada
     por cima, pra evitar que o usuário acerte a opção vizinha sem querer. */
  .rf-likert-dot::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 44px;
    height: 44px;
    transform: translate(-50%, -50%);
  }
}
