/* =========================================================================
 * /confronto-rischio-chimico/confronto.css
 *
 * Stili dedicati per il tool Confronto MoVaRisCh ↔ Al.Pi.Ris.Ch.
 * Tutte le regole sono prefissate .cnf- per evitare conflitti.
 * Lo scoping è sotto .confronto-tool (classe applicata al body).
 * ========================================================================= */

/* --------- Step titles e section titles ---------------------------- */

.confronto-tool .cnf-step-title {
  font-family: var(--ff-display);
  font-weight: 400;
  margin-bottom: 0.5rem;
}

.confronto-tool .cnf-section-title {
  font-family: var(--ff-display);
  font-weight: 500;
  font-size: 1.05rem;
  margin: 1.5rem 0 0.75rem;
  text-transform: none;
  color: var(--c-cobalto, #1a3a9e);
}

/* --------- Question card --------------------------------------------- */

.confronto-tool .cnf-question {
  background: #fafaf6;
  border: 1px solid #e3ebe3;
  border-left: 4px solid var(--c-cobalto, #1a3a9e);
  border-radius: 4px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.confronto-tool .cnf-question-title {
  margin: 0 0 0.5rem 0;
  font-family: var(--ff-display);
  font-weight: 500;
  font-size: 1.05rem;
  color: var(--c-cobalto, #1a3a9e);
  text-transform: none;
}

.confronto-tool .cnf-question-text {
  margin: 0 0 1rem 0;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--c-ink-s);
}

/* --------- Choice grid ----------------------------------------------- */

.confronto-tool .choice-grid-2 { grid-template-columns: 1fr 1fr; }
.confronto-tool .choice-grid-3 { grid-template-columns: 1fr 1fr 1fr; }

/* --------- Frasi H ricerca/selezione --------------------------------- */

.confronto-tool .cnf-frasi-h-search { position: relative; margin-bottom: 1rem; }

.confronto-tool .cnf-frasi-results {
  position: absolute;
  top: 100%; left: 0; right: 0;
  background: #fff;
  border: 1px solid #e0e0d8;
  border-top: none;
  max-height: 250px;
  overflow-y: auto;
  z-index: 10;
  display: none;
}

.confronto-tool .cnf-frasi-results.is-open { display: block; }

.confronto-tool .cnf-frasi-result-item {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid #f5f5f0;
  font-size: 0.92rem;
}

.confronto-tool .cnf-frasi-result-item:hover { background: #fafaf6; }

.confronto-tool .cnf-frase-code {
  font-family: var(--ff-mono);
  font-weight: 500;
  color: var(--c-cobalto, #1a3a9e);
  margin-right: 0.5rem;
}

.confronto-tool .cnf-frasi-selected {
  background: #fff;
  border: 1px solid #e0e0d8;
  border-radius: 4px;
  padding: 0.75rem;
  min-height: 3rem;
}

.confronto-tool .cnf-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #1a3a9e;
  color: #fff;
  font-family: var(--ff-mono);
  font-size: 0.8rem;
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  margin: 0.2rem 0.3rem 0.2rem 0;
}

.confronto-tool .cnf-chip-remove {
  cursor: pointer;
  font-weight: 700;
  opacity: 0.7;
}

.confronto-tool .cnf-chip-remove:hover { opacity: 1; }

/* --------- Sezioni algoritmo (tab espandibili) ---------------------- */

.confronto-tool .cnf-algo-section {
  border: 1px solid #e0e0d8;
  border-radius: 4px;
  margin-bottom: 1.25rem;
  background: #fff;
}

.confronto-tool .cnf-algo-section[open] {
  border-color: #c0c8c0;
}

.confronto-tool .cnf-algo-section summary {
  padding: 0.85rem 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--ff-display);
  font-weight: 500;
  list-style: none;
  user-select: none;
  background: #fafaf6;
  border-radius: 4px;
}

.confronto-tool .cnf-algo-section[open] summary {
  border-bottom: 1px solid #e0e0d8;
  border-radius: 4px 4px 0 0;
}

.confronto-tool .cnf-algo-section summary::-webkit-details-marker { display: none; }

.confronto-tool .cnf-algo-section summary::before {
  content: '▶';
  font-size: 0.7rem;
  transition: transform 0.2s;
  opacity: 0.5;
}

.confronto-tool .cnf-algo-section[open] summary::before { transform: rotate(90deg); }

.confronto-tool .cnf-algo-badge {
  font-family: var(--ff-mono);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.confronto-tool .cnf-badge-mv {
  background: #1a3a9e;
  color: #fff;
}

.confronto-tool .cnf-badge-apr {
  background: #6e3aa8;
  color: #fff;
}

.confronto-tool .cnf-algo-title {
  flex: 1;
  font-size: 1.02rem;
}

.confronto-tool .cnf-algo-body {
  padding: 1rem;
}

.confronto-tool .cnf-algo-mv .cnf-question {
  border-left-color: #1a3a9e;
}

.confronto-tool .cnf-algo-apr .cnf-question {
  border-left-color: #6e3aa8;
}

.confronto-tool .cnf-algo-apr .cnf-question-title {
  color: #6e3aa8;
}

.confronto-tool .cnf-specific-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 400;
  font-family: var(--ff-mono);
  background: #f5f0e8;
  color: #8b6e3a;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  margin-left: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  vertical-align: middle;
}

/* --------- Cut-off Al.Pi.Ris.Ch -------------------------------------- */

.confronto-tool .cnf-cutoff-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.4rem;
  margin: 0.5rem 0;
}

@media (min-width: 600px) {
  .confronto-tool .cnf-cutoff-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.confronto-tool .cnf-cutoff-grid label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.92rem;
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  border-radius: 3px;
}

.confronto-tool .cnf-cutoff-grid label:hover { background: #fafaf6; }

.confronto-tool .cnf-cutoff-status {
  margin-top: 0.75rem;
  font-size: 0.92rem;
  padding: 0.5rem 0.75rem;
  border-radius: 3px;
}

.confronto-tool .cnf-cutoff-status.is-applicable {
  background: #d4ead4;
  color: #1a4a1a;
  border: 1px solid #2d7a2d;
}

.confronto-tool .cnf-cutoff-status.is-incomplete {
  background: #fdf6f0;
  color: #6e4a20;
  border: 1px solid #c08c5a;
}

/* --------- Risultato side-by-side ------------------------------------ */

.confronto-tool .cnf-results-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 800px) {
  .confronto-tool .cnf-results-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.confronto-tool .cnf-result-card {
  border: 1px solid #e0e0d8;
  border-radius: 4px;
  background: #fff;
  overflow: hidden;
}

.confronto-tool .cnf-result-card-mv { border-top: 4px solid #1a3a9e; }
.confronto-tool .cnf-result-card-apr { border-top: 4px solid #6e3aa8; }

.confronto-tool .cnf-result-header {
  padding: 0.85rem 1rem;
  background: #fafaf6;
  border-bottom: 1px solid #e0e0d8;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.confronto-tool .cnf-result-name {
  font-family: var(--ff-display);
  font-weight: 500;
  font-size: 1.05rem;
}

.confronto-tool .cnf-result-version {
  font-family: var(--ff-mono);
  font-size: 0.78rem;
  color: var(--c-mute);
}

.confronto-tool .cnf-result-body { padding: 1rem; }

.confronto-tool .cnf-result-numbers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.confronto-tool .cnf-result-number {
  background: #fafaf6;
  border-radius: 3px;
  padding: 0.6rem;
  text-align: center;
}

.confronto-tool .cnf-result-number-label {
  font-size: 0.75rem;
  color: var(--c-mute);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.confronto-tool .cnf-result-number-value {
  font-family: var(--ff-mono);
  font-size: 1.4rem;
  font-weight: 500;
  margin-top: 0.25rem;
}

.confronto-tool .cnf-result-fascia {
  padding: 0.85rem 1rem;
  border-radius: 4px;
  text-align: center;
  color: #fff;
  font-family: var(--ff-display);
}

.confronto-tool .cnf-result-fascia-eyebrow {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.85;
}

.confronto-tool .cnf-result-fascia-label {
  font-size: 1.15rem;
  font-weight: 500;
  margin-top: 0.25rem;
}

.confronto-tool .cnf-result-fascia.fascia-irrilevante  { background: #2d7a2d; }
.confronto-tool .cnf-result-fascia.fascia-arancio      { background: #d9a800; color: #1a1a1a; }
.confronto-tool .cnf-result-fascia.fascia-modesto      { background: #d9a800; color: #1a1a1a; }
.confronto-tool .cnf-result-fascia.fascia-superiore    { background: #c66a1a; }
.confronto-tool .cnf-result-fascia.fascia-elevato      { background: #b8401a; }
.confronto-tool .cnf-result-fascia.fascia-grave        { background: #8a1a1a; }
.confronto-tool .cnf-result-fascia.fascia-na           { background: #6b6a65; }

.confronto-tool .cnf-result-note {
  margin-top: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: #fdf6f0;
  border-left: 3px solid #c08c5a;
  border-radius: 3px;
  font-size: 0.85rem;
  color: #6e4a20;
}

/* --------- Commento esplicativo finale ------------------------------- */

.confronto-tool .cnf-commentary {
  background: #f0f4fa;
  border-left: 4px solid var(--c-cobalto, #1a3a9e);
  border-radius: 4px;
  padding: 1rem 1.25rem;
  margin-top: 1rem;
}

.confronto-tool .cnf-commentary h4 {
  margin: 0 0 0.5rem 0;
  font-family: var(--ff-display);
  font-weight: 500;
  font-size: 1.05rem;
  text-transform: none;
}

.confronto-tool .cnf-commentary ul {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}

.confronto-tool .cnf-commentary li {
  font-size: 0.92rem;
  margin-bottom: 0.4rem;
  line-height: 1.45;
}

/* --------- Dataset injection nascosto ------------------------------- */

.confronto-tool #cnf-dataset-apr { display: none; }
