/* ============================================
   Rechner: Einbettungscode, Kalorienbedarf, Zieldatum, GLP-1-Vergleich,
   BMI-Tabelle, App-Hinweis. Geladen auf Tool-Seiten (templates/tools/_layout.html)
   und auf der Startseite (Rechner oben),
   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 in zartem Salbei, Warnung in Bernstein wie in der App */
.tool-note {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  border-radius: var(--radius-md);
  padding: 0.8rem 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: var(--color-warning-bg);
  color: var(--color-warning-ink);
}
.tool-note.is-warning > i {
  color: var(--color-warning);
}
.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-inset);
  border: 0;
  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-card);
  color: var(--color-ink);
  box-shadow: 0 1px 2px rgba(26, 38, 31, 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-md);
  -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);
  font-weight: 600;
  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: 600;
}
.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 {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 0.7rem 0.9rem;
  display: flex;
  flex-direction: column;
}
.bmi-ranges li.is-current {
  background: var(--color-primary-tint);
  box-shadow: inset 0 0 0 1.5px var(--color-primary);
}
.bmi-ranges .bmi-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-text-muted);
}
.bmi-ranges .bmi-value {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 400;
  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 var(--color-dots);
}
.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: var(--color-dots);
  stroke-width: 1.5;
  stroke-dasharray: 6 5;
}
.glp-svg .glp-placebo-dot {
  fill: var(--color-dots);
}
.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 {
  background: var(--color-warning-bg);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.1rem;
  font-size: 0.92rem;
  color: var(--color-warning-ink);
}

/* --- App-Hinweis nach dem Ergebnis (templates/tools/_app_cta.html) ---
   Dezent: weiße Karte wie das Ergebnis, kleines App-Icon, Salbei-Pillen.
   Sichtbar erst nach einer Auswertung (static/js/tools/result-cta.js). */
.app-result-cta {
  padding-top: 0;
}
.app-cta-card {
  display: flex;
  gap: 1.1rem;
  align-items: flex-start;
  background: var(--color-card);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  animation: app-cta-in 0.4s ease both;
}
.app-cta-icon {
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 14px;
}
.app-cta-title {
  font-family: var(--font-sans);
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--color-ink);
  margin: 0 0 0.35rem;
}
.app-cta-text {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  margin: 0 0 0.9rem;
}
.app-cta-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.app-cta-buttons .store-btn {
  padding: 0.55rem 1.1rem;
  font-size: 0.95rem;
}
@keyframes app-cta-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .app-cta-card {
    animation: none;
  }
}
@media (max-width: 575.98px) {
  .app-cta-card {
    flex-direction: column;
    padding: 1.1rem;
  }
  .app-cta-icon {
    width: 44px;
    height: 44px;
    border-radius: 11px;
  }
  .app-cta-buttons .store-btn {
    flex: 1 1 100%;
  }
}
