:root {
  --bg: #0b0d10;
  --surface: #111217;
  --surface2: #17181c;
  --text: #e6e6e6;
  --muted: #9aa0a6;
  --accent: #4da3ff;
  --accent-2: #7bd389;
  --radius: 10px;
}

/* layout base */
.job-header {
  margin-bottom: 1rem;
}

.filename {
  color: var(--muted);
  font-size: 0.95rem;
}

/* summary */
.section.summary {
  background: var(--surface);
  border: 1px solid #1e2328;
  padding: 18px;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.section.summary h3 {
  color: var(--accent);
  margin: 0 0 8px 0;
}

.section.summary p {
  color: var(--text);
  line-height: 1.5;
  text-align: justify;
  white-space: pre-line;
}

/* term card */
.term-block {
  background: var(--surface2);
  margin-bottom: 10px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #151617;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

.collapsible {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: none;
  background: transparent;
  padding: 12px 14px;
  cursor: pointer;
  color: var(--text);
  font-weight: 600;
}

.collapsible:hover {
  background: rgba(255, 255, 255, 0.02);
}

.collapsible .left {
  display: flex;
  gap: 10px;
  align-items: center;
}

.icon-med {
  font-size: 1.1rem;
  color: var(--accent);
}

.term-name {
  font-size: 1rem;
}

/* badge categoria */
.badge {
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
}

.badge.category-ematologia {
  background: #6f9cff;
  color: #fff;
}

.badge.category-infiammazione {
  background: #f6b26b;
  color: #2b2b2b;
}

.badge.category-fegato {
  background: #9ecb7a;
  color: #0b2b0b;
}

.badge.category-reni {
  background: #8ac6ff;
  color: #05243a;
}

.badge.category-metabolismo {
  background: #c792ea;
  color: #1b0633;
}

.badge.category-coagulazione {
  background: #f07c8a;
  color: #2b0b0d;
}

.badge.category-tiroide {
  background: #f4d35e;
  color: #2b2b0b;
}

.badge.category-ormoni {
  background: #ff9f43;
  color: #2b1600;
}

.badge.category-vitamine-e-minerali {
  background: #7bd389;
  color: #05240b;
}

.badge.category-immunologia {
  background: #b39dfb;
  color: #1b0633;
}

.badge.category-diagnostica {
  background: #95a5a6;
  color: #071014;
}

.badge.category-altro {
  background: #6c757d;
  color: #fff;
}

/* content collapsible */
.content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.28s ease;
  padding: 0 14px;
  color: var(--muted);
}

.content p {
  margin: 12px 0;
}

.content.open {
  padding: 14px;
}

.interpretation {
  background: rgba(77, 163, 255, 0.06);
  border-left: 3px solid var(--accent);
  padding: 10px;
  border-radius: 6px;
  color: var(--muted);
}

/* chart */
.chart-section {
  background: var(--surface);
  padding: 14px;
  border-radius: 10px;
  margin-top: 12px;
  border: 1px solid #111316;

  display: block;
  justify-content: center;
}

/* Mobile-first: usa tutta la larghezza */
#polarChart {
  width: 100%;
  height: auto;
  max-width: 100%;
  display: block;
  margin: 0 auto;
}

/* ricerca */
.search-container {
  margin: 20px 0;
  text-align: center;
}

#termSearch {
  width: 70%;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid #444;
  background-color: #1f1f1f;
  color: #e6e6e6;
  font-size: 16px;
  outline: none;
  transition: 0.25s;
}

#termSearch:focus {
  border-color: #6f9cff;
  background-color: #262626;
}

.collapse-controls button {
  padding: 6px 12px;
  font-size: 0.85rem;
  border-radius: var(--radius);
}

/* Pulsante apri/chiudi tutti */
.toggle-all-wrapper {
  text-align: right;
  margin-bottom: 12px;
}

.toggle-all-btn {
  background: var(--surface2);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid #222;
  cursor: pointer;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.25s;
}

.toggle-all-btn:hover {
  background: #1f2024;
}

.icon-toggle {
  display: inline-block;
  transition: transform 0.25s ease;
}

/* quando attivo */
.toggle-all-btn.active .icon-toggle {
  transform: rotate(180deg);
}

/* svg graph */
.term-svg-graph {
  background: rgba(163, 255, 0, 0.06);
   /* rgba(77, 219, 255, 0.06); */
  border-left: 3px solid var(--accent-2);
  padding: 10px;
  border-radius: 6px;
  color: var(--muted);
}
.term-svg-graph svg {
  width: 100%;
  height: auto;
  max-width: 400px;
}
/* 
.svg-container {
  display: inline-block;
  border: 1px solid #222;
  border-radius: 8px;
  padding: 8px;
  background: var(--surface2);

} */


/* responsive */
@media(min-width:800px) {
  .term-block {
    display: block;
  }

  /* rimane verticale anche su desktop */
  .collapsible {
    width: 100%;
  }

  .content {
    padding-left: 18px;
  }
}

@media(min-width:1200px){
  .job-detail-container {
    max-width: 900px;
    margin: 0 auto;
  }
}

/* Desktop */
@media (min-width: 768px) {
  #polarChart {
    max-width: 320px;  /* oppure 280-350px */
    max-height: 320px;
  }
}