/* ============================================================
   FERRAMENTAS DIGITAIS — Design System
   Dr. Vitor Ferreira
   Reutilizável por DTI, IDM, PEF, PSI, CSI
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Playfair+Display:wght@400;500;600;700&display=swap');

:root {
  --cor-fundo: #0f0f0f;
  --cor-fundo-card: #1a1a1a;
  --cor-fundo-card-hover: #222222;
  --cor-texto: #f5f5f5;
  --cor-texto-secundario: #a0a0a0;
  --cor-destaque: #c9a84c;
  --cor-destaque-hover: #d4b65c;
  --cor-verde: #22c55e;
  --cor-amarelo: #eab308;
  --cor-vermelho: #ef4444;
  --cor-borda: #2a2a2a;
  --cor-blur-overlay: rgba(15, 15, 15, 0.85);
  --radius: 12px;
  --font-principal: 'DM Sans', sans-serif;
  --font-display: 'Playfair Display', serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.ferramenta-page {
  background: var(--cor-fundo);
  color: var(--cor-texto);
  font-family: var(--font-principal);
  line-height: 1.6;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* ── Container principal ─────────────────────────────────────── */

.ferramenta-container {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 20px 120px;
  min-height: 100dvh;
  position: relative;
}

/* ── Tipografia ──────────────────────────────────────────────── */

.f-headline {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--cor-texto);
  margin-bottom: 8px;
}

.f-headline span {
  color: var(--cor-destaque);
}

.f-subheadline {
  font-size: 16px;
  color: var(--cor-texto-secundario);
  line-height: 1.5;
  margin-bottom: 32px;
}

.f-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--cor-texto-secundario);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

/* ── Logo / Header ───────────────────────────────────────────── */

.f-header {
  text-align: center;
  margin-bottom: 32px;
  padding-top: 16px;
}

.f-header-brand {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 400;
  color: var(--cor-destaque);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 24px;
}

/* ── Inputs ──────────────────────────────────────────────────── */

.f-input-group {
  margin-bottom: 20px;
}

.f-input-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--cor-texto-secundario);
  margin-bottom: 8px;
}

.f-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--cor-fundo-card);
  border: 1px solid var(--cor-borda);
  border-radius: var(--radius);
  color: var(--cor-texto);
  font-family: var(--font-principal);
  font-size: 16px;
  transition: border-color 0.2s;
  outline: none;
}

.f-input:focus {
  border-color: var(--cor-destaque);
}

.f-input::placeholder {
  color: #555;
}

.f-input.error {
  border-color: var(--cor-vermelho);
}

.f-error-msg {
  font-size: 13px;
  color: var(--cor-vermelho);
  margin-top: 6px;
  display: none;
}

.f-error-msg.visible {
  display: block;
}

/* ── Checkbox ────────────────────────────────────────────────── */

.f-checkbox-group {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  cursor: pointer;
}

.f-checkbox-group input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--cor-borda);
  border-radius: 4px;
  background: var(--cor-fundo-card);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: all 0.2s;
}

.f-checkbox-group input[type="checkbox"]:checked {
  background: var(--cor-destaque);
  border-color: var(--cor-destaque);
}

.f-checkbox-group input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #0f0f0f;
  font-size: 14px;
  font-weight: 700;
}

.f-checkbox-group label {
  font-size: 15px;
  color: var(--cor-texto);
  cursor: pointer;
}

/* ── Botões ──────────────────────────────────────────────────── */

.f-btn {
  display: block;
  width: 100%;
  padding: 16px 24px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-principal);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
  text-align: center;
  text-decoration: none;
}

.f-btn-primary {
  background: var(--cor-destaque);
  color: #0f0f0f;
}

.f-btn-primary:hover {
  background: var(--cor-destaque-hover);
  transform: translateY(-1px);
}

.f-btn-primary:active {
  transform: translateY(0);
}

.f-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.f-btn-secondary {
  background: transparent;
  color: var(--cor-texto-secundario);
  border: 1px solid var(--cor-borda);
}

.f-btn-secondary:hover {
  border-color: var(--cor-texto-secundario);
  color: var(--cor-texto);
}

.f-btn-outline-gold {
  background: transparent;
  color: var(--cor-destaque);
  border: 1.5px solid var(--cor-destaque);
}

.f-btn-outline-gold:hover {
  background: rgba(201, 168, 76, 0.1);
}

/* ── Barra de Progresso ──────────────────────────────────────── */

.f-progress-bar {
  width: 100%;
  height: 3px;
  background: var(--cor-borda);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 32px;
}

.f-progress-fill {
  height: 100%;
  background: var(--cor-destaque);
  border-radius: 2px;
  transition: width 0.3s ease;
  width: 0%;
}

/* ── Etapa info ──────────────────────────────────────────────── */

.f-etapa-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.f-etapa-titulo {
  font-size: 13px;
  font-weight: 500;
  color: var(--cor-destaque);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.f-etapa-contador {
  font-size: 13px;
  color: var(--cor-texto-secundario);
}

/* ── Questionário: Pergunta ──────────────────────────────────── */

.f-pergunta-container {
  position: relative;
  overflow: visible;
  min-height: 380px;
  padding-bottom: 80px;
}

.f-pergunta {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  opacity: 1;
  transform: translateX(0);
  transition: all 0.3s ease;
}

.f-pergunta.slide-out-left {
  opacity: 0;
  transform: translateX(-60px);
}

.f-pergunta.slide-in-right {
  opacity: 0;
  transform: translateX(60px);
}

.f-pergunta.slide-out-right {
  opacity: 0;
  transform: translateX(60px);
}

.f-pergunta.slide-in-left {
  opacity: 0;
  transform: translateX(-60px);
}

.f-pergunta-texto {
  font-size: 20px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--cor-texto);
  margin-bottom: 28px;
  min-height: 56px;
}

/* ── Botões de resposta ──────────────────────────────────────── */

.f-opcoes {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 24px;
}

.f-opcao-btn {
  display: block;
  width: 100%;
  padding: 16px 20px;
  background: transparent;
  border: 1.5px solid var(--cor-borda);
  border-radius: var(--radius);
  color: var(--cor-texto);
  font-family: var(--font-principal);
  font-size: 16px;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.f-opcao-btn:hover {
  border-color: var(--cor-destaque);
  background: rgba(201, 168, 76, 0.05);
}

.f-opcao-btn:active,
.f-opcao-btn.selected {
  border-color: var(--cor-destaque);
  background: var(--cor-destaque);
  color: #0f0f0f;
  font-weight: 500;
}

/* ── Voltar ──────────────────────────────────────────────────── */

.f-voltar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 24px;
  padding: 8px 0;
  background: none;
  border: none;
  color: var(--cor-texto-secundario);
  font-family: var(--font-principal);
  font-size: 14px;
  cursor: pointer;
  transition: color 0.2s;
}

.f-voltar:hover {
  color: var(--cor-texto);
}

.f-voltar svg {
  width: 16px;
  height: 16px;
}

/* ── Loading ─────────────────────────────────────────────────── */

.f-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 24px;
}

.f-loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--cor-borda);
  border-top-color: var(--cor-destaque);
  border-radius: 50%;
  animation: f-spin 0.8s linear infinite;
}

@keyframes f-spin {
  to { transform: rotate(360deg); }
}

.f-loading-text {
  font-size: 16px;
  color: var(--cor-texto-secundario);
  animation: f-pulse 1.5s ease-in-out infinite;
}

@keyframes f-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ── Resultado: Score Geral ──────────────────────────────────── */

.f-resultado-header {
  text-align: center;
  margin-bottom: 32px;
}

.f-score-circle {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 24px auto 16px;
  position: relative;
}

.f-score-circle::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 4px solid currentColor;
  opacity: 0.3;
}

.f-score-circle::after {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: radial-gradient(circle, currentColor 0%, transparent 70%);
  opacity: 0.06;
  z-index: -1;
}

.f-score-circle.verde { color: var(--cor-verde); }
.f-score-circle.amarelo { color: var(--cor-amarelo); }
.f-score-circle.vermelho { color: var(--cor-vermelho); }

.f-score-numero {
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 700;
  line-height: 1;
}

.f-score-label {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 4px;
  opacity: 0.8;
}

.f-score-descricao {
  font-size: 15px;
  color: var(--cor-texto-secundario);
  text-align: center;
}

/* ── Separador ───────────────────────────────────────────────── */

.f-separador {
  height: 1px;
  background: var(--cor-borda);
  margin: 28px 0;
}

/* ── Cards de Categoria ──────────────────────────────────────── */

.f-cat-card {
  background: var(--cor-fundo-card);
  border: 1px solid var(--cor-borda);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  transition: border-color 0.2s;
}

.f-cat-card:hover {
  border-color: #333;
}

.f-cat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 0;
}

.f-cat-header.has-content {
  margin-bottom: 16px;
}

.f-cat-semaforo {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.f-cat-semaforo.verde { background: var(--cor-verde); box-shadow: 0 0 8px rgba(34, 197, 94, 0.4); }
.f-cat-semaforo.amarelo { background: var(--cor-amarelo); box-shadow: 0 0 8px rgba(234, 179, 8, 0.4); }
.f-cat-semaforo.vermelho { background: var(--cor-vermelho); box-shadow: 0 0 8px rgba(239, 68, 68, 0.4); }

.f-cat-nome {
  font-size: 16px;
  font-weight: 600;
  color: var(--cor-texto);
  flex: 1;
}

.f-cat-score {
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-display);
}

.f-cat-score.verde { color: var(--cor-verde); }
.f-cat-score.amarelo { color: var(--cor-amarelo); }
.f-cat-score.vermelho { color: var(--cor-vermelho); }

/* ── Texto interpretativo ────────────────────────────────────── */

.f-cat-texto {
  font-size: 14px;
  line-height: 1.7;
  color: var(--cor-texto-secundario);
}

/* ── Texto bloqueado (blur) ──────────────────────────────────── */

.f-cat-bloqueado {
  position: relative;
  margin-top: 12px;
}

.f-cat-bloqueado-texto {
  font-size: 14px;
  line-height: 1.7;
  color: var(--cor-texto-secundario);
  filter: blur(5px);
  user-select: none;
  pointer-events: none;
}

.f-cat-bloqueado-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 15, 15, 0.3);
  border-radius: 8px;
}

.f-cat-bloqueado-icon {
  font-size: 20px;
  opacity: 0.6;
}

/* ── GPS de Módulos ──────────────────────────────────────────── */

.f-gps {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--cor-borda);
}

.f-gps-titulo {
  font-size: 12px;
  font-weight: 600;
  color: var(--cor-destaque);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.f-gps-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
}

.f-gps-prioridade {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(201, 168, 76, 0.15);
  color: var(--cor-destaque);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.f-gps-aula {
  font-size: 14px;
  color: var(--cor-texto);
  line-height: 1.4;
}

.f-gps-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(201, 168, 76, 0.15);
  color: var(--cor-destaque);
  margin-left: 6px;
  vertical-align: middle;
}

/* ── CTA Block ───────────────────────────────────────────────── */

.f-cta {
  background: linear-gradient(135deg, rgba(201, 168, 76, 0.08) 0%, rgba(201, 168, 76, 0.02) 100%);
  border: 1px solid rgba(201, 168, 76, 0.2);
  border-radius: var(--radius);
  padding: 24px 20px;
  margin-top: 28px;
  text-align: center;
}

.f-cta-titulo {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  color: var(--cor-texto);
  line-height: 1.3;
  margin-bottom: 12px;
}

.f-cta-texto {
  font-size: 14px;
  color: var(--cor-texto-secundario);
  line-height: 1.6;
  margin-bottom: 20px;
}

/* ── Disclaimer ──────────────────────────────────────────────── */

.f-disclaimer {
  font-size: 12px;
  color: #555;
  text-align: center;
  margin-top: 32px;
  line-height: 1.5;
}

/* ── Slide condicional ───────────────────────────────────────── */

.f-slide-down {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, opacity 0.35s ease;
  opacity: 0;
}

.f-slide-down.open {
  max-height: 120px;
  opacity: 1;
}

/* ── Telas (show/hide) ───────────────────────────────────────── */

.f-tela {
  display: none;
}

.f-tela.active {
  display: block;
  animation: f-fadeIn 0.4s ease;
}

@keyframes f-fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ──────────────────────────────────────────────── */

@media (max-width: 480px) {
  .ferramenta-container {
    padding: 16px 16px 120px;
  }

  .f-headline {
    font-size: 28px;
  }

  .f-pergunta-texto {
    font-size: 18px;
  }

  .f-score-circle {
    width: 120px;
    height: 120px;
  }

  .f-score-numero {
    font-size: 40px;
  }
}
