/* ============================================================
   FacilitaPJ — ferramentas.css
   Estilo das 5 calculadoras. Usa as mesmas variáveis do style.css.
   ============================================================ */

.calc {
  max-width: 860px;
  margin: 0 auto;
}

.calc__card {
  background: var(--white);
  border: 1px solid var(--gray-line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 36px;
}

@media (max-width: 640px) {
  .calc__card { padding: 24px 20px; }
}

.calc__legend {
  font-family: 'Sora', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-line);
}

/* ── Campos ─────────────────────────────────────────────── */
.calc__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 640px) {
  .calc__grid { grid-template-columns: 1fr; }
}

.calc__field {
  display: flex;
  flex-direction: column;
}

.calc__field--full { grid-column: 1 / -1; }

.calc__label {
  font-size: .875rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 6px;
}

.calc__hint {
  font-size: .78rem;
  color: var(--gray-mid);
  margin-top: 5px;
  line-height: 1.5;
}

.calc__input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.calc__prefix {
  position: absolute;
  left: 14px;
  font-size: .95rem;
  font-weight: 600;
  color: var(--gray-mid);
  pointer-events: none;
}

.calc__input,
.calc__select {
  width: 100%;
  padding: 13px 14px;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  color: var(--text);
  background: var(--white);
  border: 2px solid var(--gray-line);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.calc__input--money { padding-left: 42px; }

.calc__input:focus,
.calc__select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26,111,212,.12);
}

.calc__select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
  padding-right: 40px;
}

.calc__actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.calc__error {
  display: none;
  margin-top: 16px;
  padding: 12px 16px;
  background: #FEF2F2;
  border-left: 3px solid #DC2626;
  border-radius: var(--radius-sm);
  color: #991B1B;
  font-size: .875rem;
}

.calc__error--show { display: block; }

/* ── Resultado ──────────────────────────────────────────── */
.calc__result {
  display: none;
  margin-top: 32px;
  scroll-margin-top: 90px;
}

.calc__result--show {
  display: block;
  animation: calcFade .35s ease;
}

@keyframes calcFade {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Destaque principal do resultado */
.calc__headline {
  text-align: center;
  padding: 32px 24px;
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
}

.calc__headline--good {
  background: linear-gradient(135deg, #065F46, #059669);
  color: var(--white);
}

.calc__headline--bad {
  background: linear-gradient(135deg, #7F1D1D, #B91C1C);
  color: var(--white);
}

.calc__headline--neutral {
  background: linear-gradient(135deg, var(--navy), var(--blue));
  color: var(--white);
}

.calc__headline-label {
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  opacity: .85;
  margin-bottom: 8px;
}

.calc__headline-value {
  font-family: 'Sora', sans-serif;
  font-size: clamp(1.9rem, 5vw, 2.8rem);
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 8px;
}

.calc__headline-sub {
  font-size: .95rem;
  opacity: .9;
  max-width: 520px;
  margin: 0 auto;
  color: rgba(255,255,255,.9);
}

/* Comparação lado a lado */
.calc__compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 640px) {
  .calc__compare { grid-template-columns: 1fr; }
}

.calc__col {
  border: 2px solid var(--gray-line);
  border-radius: var(--radius-md);
  padding: 20px;
  background: var(--white);
}

.calc__col--winner {
  border-color: #059669;
  background: #F0FDF4;
}

.calc__col-title {
  font-family: 'Sora', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.calc__badge {
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 20px;
  background: #059669;
  color: var(--white);
  white-space: nowrap;
}

.calc__col-value {
  font-family: 'Sora', sans-serif;
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--navy);
  margin: 10px 0 14px;
}

/* Linhas de detalhe */
.calc__lines { border-top: 1px solid var(--gray-line); padding-top: 12px; }

.calc__line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 7px 0;
  font-size: .875rem;
}

.calc__line span:first-child { color: var(--text-soft); }
.calc__line span:last-child  { font-weight: 600; color: var(--navy); white-space: nowrap; }

.calc__line--total {
  border-top: 1px solid var(--gray-line);
  margin-top: 6px;
  padding-top: 12px;
  font-size: .95rem;
}

.calc__line--total span:first-child { color: var(--navy); font-weight: 600; }

.calc__line--positive span:last-child { color: #059669; }
.calc__line--negative span:last-child { color: #DC2626; }

/* Caixa explicativa */
.calc__note {
  background: var(--blue-pale);
  border-left: 3px solid var(--blue);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  margin-bottom: 20px;
}

.calc__note p {
  font-size: .875rem;
  line-height: 1.65;
  color: var(--text-soft);
  margin: 0;
}

.calc__note p + p { margin-top: 10px; }

.calc__note strong { color: var(--navy); }

.calc__note--warn {
  background: #FFFBEB;
  border-left-color: #F59E0B;
}

.calc__note--danger {
  background: #FEF2F2;
  border-left-color: #DC2626;
}

/* Barra de progresso (usada no MEI) */
.calc__bar {
  height: 14px;
  background: var(--gray-line);
  border-radius: 20px;
  overflow: hidden;
  margin: 14px 0 8px;
}

.calc__bar-fill {
  height: 100%;
  border-radius: 20px;
  background: #059669;
  transition: width .6s ease;
}

.calc__bar-fill--warn   { background: #F59E0B; }
.calc__bar-fill--danger { background: #DC2626; }

.calc__bar-legend {
  display: flex;
  justify-content: space-between;
  font-size: .78rem;
  color: var(--gray-mid);
}

/* CTA dentro do resultado */
.calc__cta {
  text-align: center;
  padding: 28px 24px;
  background: var(--navy);
  border-radius: var(--radius-md);
  margin-top: 24px;
}

.calc__cta h3 {
  color: var(--white);
  margin-bottom: 8px;
  font-size: 1.2rem;
}

.calc__cta p {
  color: rgba(255,255,255,.7);
  font-size: .9rem;
  margin-bottom: 20px;
  max-width: 460px;
  margin-left: auto;
  margin-right: auto;
}

/* Aviso legal */
.calc__disclaimer {
  margin-top: 20px;
  padding: 14px 16px;
  background: var(--gray-bg);
  border-radius: var(--radius-sm);
  font-size: .78rem;
  line-height: 1.6;
  color: var(--gray-mid);
}

.calc__disclaimer strong { color: var(--text-soft); }

/* Tabela de referência */
.calc__table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
  margin-top: 8px;
}

.calc__table th,
.calc__table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--gray-line);
}

.calc__table th {
  font-family: 'Sora', sans-serif;
  font-size: .8rem;
  color: var(--navy);
  background: var(--gray-bg);
  font-weight: 600;
}

.calc__table td { color: var(--text-soft); }
.calc__table tr:last-child td { border-bottom: none; }
.calc__table tr.is-active td {
  background: var(--blue-pale);
  color: var(--navy);
  font-weight: 600;
}

/* Grade de outras ferramentas */
.tools__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.tool-card {
  display: block;
  background: var(--white);
  border: 1px solid var(--gray-line);
  border-radius: var(--radius-md);
  padding: 24px;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.tool-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--blue);
}

.tool-card__icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--blue-pale);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.tool-card__icon svg {
  width: 22px;
  height: 22px;
  stroke: var(--blue);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tool-card h3 {
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.tool-card p {
  font-size: .875rem;
  line-height: 1.6;
  margin: 0;
}

/* ── Aviso de escopo da ferramenta (topo do formulário) ─────── */
.calc__escopo {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--blue-pale);
  border-left: 3px solid var(--blue);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 24px;
}

.calc__escopo svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 2px;
  stroke: var(--blue);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.calc__escopo p {
  font-size: .85rem;
  line-height: 1.6;
  color: var(--text-soft);
  margin: 0;
}

.calc__escopo strong { color: var(--navy); }

/* ── Campo que só aparece em certas condições (ex.: Anexo V) ── */
.calc__condicional {
  display: none;
  grid-column: 1 / -1;
}

.calc__condicional--show {
  display: block;
  animation: calcFade .3s ease;
}

/* destaque visual para o campo que apareceu */
.calc__condicional .calc__label { color: var(--blue); }

.calc__condicional-box {
  border: 2px dashed var(--blue);
  border-radius: var(--radius-md);
  padding: 18px;
  background: var(--blue-pale);
}
