/* ============================================
   Rechner: Einbettungscode, Kalorienbedarf, Zieldatum, GLP-1-Vergleich,
   BMI-Tabelle. Nur auf Tool-Seiten geladen (templates/tools/_layout.html),
   Grundbausteine (.tool-panel, .tool-kpi ...) stehen in style.css.
   ============================================ */

/* Einbettungscode */
.tool-embed-textarea {
  font-size: 0.8rem;
  background: var(--color-surface-soft);
}

/* Ergebnis-Hinweise: Info neutral, Warnung in Bernstein wie in der App */
.tool-note {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  background: var(--color-primary-tint);
  color: var(--color-ink);
  font-size: 0.95rem;
  margin: 0.75rem 0 0;
}
.tool-note > i {
  color: var(--color-primary);
  margin-top: 0.1rem;
}
.tool-note.is-warning {
  background: #fff4e5;
  color: #6b4100;
}
.tool-note.is-warning > i {
  color: #b26a00;
}
.tool-note:empty {
  display: none;
}

/* Umschalter zwischen zwei Eingabearten (Pill-Gruppe wie .tool-range) */
.tool-switch {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  background: var(--color-surface-soft);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.2rem;
  margin-bottom: 0.25rem;
}
.tool-switch .btn-check + label {
  border: 0;
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  margin: 0;
}
.tool-switch .btn-check:checked + label {
  background: var(--color-white);
  color: var(--color-primary-dark);
  box-shadow: 0 1px 2px rgba(16, 23, 32, 0.08);
}
.tool-switch .btn-check:focus-visible + label {
  outline: 2px solid var(--color-primary);
}

.tool-kpis-3 {
  grid-template-columns: repeat(1, minmax(0, 1fr));
}
@media (min-width: 576px) {
  .tool-kpis-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (min-width: 992px) {
  .tool-kpis.tool-kpis-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.tool-input-pair {
  display: flex;
  gap: 0.5rem;
}
.tool-input-pair > * {
  min-width: 0;
}

/* Tabellen (BMI, Studienwerte) */
.tool-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  -webkit-overflow-scrolling: touch;
}
.tool-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  margin: 0;
}
.tool-table th,
.tool-table td {
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  white-space: nowrap;
}
.tool-table thead th {
  background: var(--color-surface-soft);
  font-weight: 650;
  font-size: 0.8rem;
  position: sticky;
  top: 0;
}
.tool-table tbody tr:last-child td,
.tool-table tbody tr:last-child th {
  border-bottom: 0;
}
.tool-table tbody th {
  font-weight: 650;
}
.tool-table tr.is-current {
  background: var(--color-primary-tint);
}
.tool-table-scroll {
  max-height: 560px;
}

/* BMI-Bereiche für eine Größe */
.bmi-ranges {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: grid;
  gap: 0.5rem;
}
@media (min-width: 768px) {
  .bmi-ranges {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.bmi-ranges li {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  display: flex;
  flex-direction: column;
}
.bmi-ranges li.is-current {
  border-color: var(--color-primary);
  background: var(--color-primary-tint);
}
.bmi-ranges .bmi-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
}
.bmi-ranges .bmi-value {
  font-size: 1.1rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.bmi-ranges .bmi-sub {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

/* GLP-1-Vergleich: Chart-Legende und Quellen */
.glp-legend span::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 0;
  vertical-align: middle;
  margin-right: 0.35rem;
}
.glp-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: 0.5rem;
}
.glp-legend .lg-user::before {
  border-top: 3px solid var(--color-primary);
}
.glp-legend .lg-study::before {
  border-top: 2px dashed var(--color-ink);
}
.glp-legend .lg-placebo::before {
  border-top: 2px dashed #9aa5b1;
}
.glp-svg .glp-user {
  fill: none;
  stroke: var(--color-primary);
  stroke-width: 2.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.glp-svg .glp-user-dot {
  fill: var(--color-primary);
}
.glp-svg .glp-study {
  fill: none;
  stroke: var(--color-ink);
  stroke-width: 1.5;
  stroke-dasharray: 6 5;
}
.glp-svg .glp-study-dot {
  fill: var(--color-ink);
}
.glp-svg .glp-placebo {
  fill: none;
  stroke: #9aa5b1;
  stroke-width: 1.5;
  stroke-dasharray: 6 5;
}
.glp-svg .glp-placebo-dot {
  fill: #9aa5b1;
}
.glp-svg .glp-label {
  font-size: 11px;
  fill: var(--color-text-muted);
}
.tool-sources {
  font-size: 0.9rem;
  padding-left: 1.2rem;
}
.tool-sources li {
  margin-bottom: 0.4rem;
}
.tool-disclaimer {
  border: 1px solid #ffd8a8;
  background: #fff8ee;
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  font-size: 0.92rem;
  color: #5a3a00;
}
