/*
 * Brillante Strukturen - Analytics-Tool (2026-09-10)
 * Ersetzt die 13 einzelnen analytics-XX-*.html-Seiten durch eine
 * kompakte, interaktive Ansicht: Branchen-Dropdown + 4 Kennzahlenfelder
 * + kompakte TradingView-Chart-Karten statt langer Scroll-Liste.
 */

.an-tool {
  background: #F7F3E8;
  border-top: 4px solid #C2A165;
  border-radius: 10px;
  padding: 40px;
  overflow: hidden;
}
.an-tool-header {
  display: block;
  width: calc(100% + 80px);
  max-width: none;
  height: auto;
  margin: -40px -40px 28px;
}

.an-select-row {
  margin-bottom: 28px;
}
.an-select-row label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #1A2E16;
  margin-bottom: 8px;
}
#an-branche {
  width: 100%;
  max-width: 480px;
  padding: 12px 16px;
  border: 2px solid #D5D5D5;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  color: #1A2E16;
  background: #fff;
}
#an-branche:focus {
  border-color: #70A837;
  outline: none;
}

.an-metrics {
  display: grid;
  /* minmax(0, Nfr) statt Nfr: verhindert, dass eine Spalte durch laengeren
     Textinhalt (z.B. "Progressiv" vs. "Stagnierend") minimal breiter wird
     und dadurch alle anderen Spalten mitverschiebt. Box 1 (Hebel) etwas
     schmaler, da ihre Ueberschrift eh umbricht; Box 2 (Trend/Faktor) dafuer
     etwas breiter, da "Progressiv" dort sonst zu eng wird. */
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}
.an-metric {
  background: #fff;
  border: 1px solid #E6DEC8;
  border-radius: 8px;
  padding: 18px 20px;
}
.an-metric-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b6555;
  line-height: 1.35;
  /* Fixe Mindesthoehe fuer 2 Zeilen - manche Labels sind einzeilig
     ("Trend", "Faktorwert"), andere brechen um ("Aktueller Jahresumsatz
     (EUR)"). Ohne das rutscht die Ausgabe-Zeile darunter je Box unterschiedlich
     weit runter und sitzt nicht mehr auf gleicher Hoehe. */
  min-height: 33px;
  margin-bottom: 8px;
}
/* Einheitliche Schriftgroesse/-gewicht UND identisches Box-Modell
   (Padding + 2px Border-Bottom, auch wo unsichtbar) fuer alle 4 Output-
   Zellen (Trend, Faktorwert, Umsatz-Input, Forecast) - sonst sitzen sie
   trotz gleicher Zeile optisch auf unterschiedlicher Hoehe. */
.an-metric-value,
.an-trend-value {
  font-size: 22px;
  font-weight: 700;
  color: #1A2E16;
  line-height: 1.2;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}
.an-metric input {
  width: 100%;
  border: none;
  border-bottom: 2px solid #D5D5D5;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  color: #1A2E16;
  padding: 4px 0;
  background: transparent;
}
.an-metric input:focus {
  outline: none;
  border-bottom-color: #70A837;
}
.an-metric.an-forecast {
  background: #1A2E16;
  border-color: #1A2E16;
}
.an-metric.an-forecast .an-metric-label {
  color: #C2A165;
}
.an-metric.an-forecast .an-metric-value {
  color: #FCEFC7;
}

/* Box 1: Hebel-Regler zur manuellen Trend-Einschaetzung. Fixierung links
   mittig, der Balken laesst sich per Maus/Touch nach oben (gruen) oder
   unten (dunkelrot) klappen - Winkel bestimmt die Trend-Stufe. */
.an-lever-wrap {
  position: relative;
  height: 60px;
  margin-top: 6px;
  touch-action: none;
  cursor: grab;
}
.an-lever-wrap:active {
  cursor: grabbing;
}
/* 16px Inset auf beiden Seiten (siehe .an-lever-bar: left/right 16px) -
   dadurch ist der Startpunkt (Pivot) links genauso weit vom Rand entfernt
   wie der Endpunkt rechts bei waagerechter (stagnierender) Stellung.
   Der JS-Drag-Handler nutzt denselben 16px-Wert (LEVER_INSET). */
.an-lever-pivot {
  position: absolute;
  left: 16px;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  margin-top: -4px;
  background: #1A2E16;
  border-radius: 50%;
  z-index: 2;
}
.an-lever-bar {
  position: absolute;
  left: 16px;
  right: 16px;
  top: 50%;
  height: 5px;
  margin-top: -2.5px;
  border-radius: 3px;
  background: #F1C40F;
  transform-origin: 0% 50%;
  transform: rotate(0deg);
  transition: background-color 0.15s ease;
}
.an-lever-bar::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 50%;
  width: 13px;
  height: 13px;
  margin-top: -6.5px;
  background: inherit;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

/* Box 2: "Trend | Faktorwert" mit durchgehender Trennlinie statt Text-Pipe */
.an-combo-inner {
  display: flex;
  align-items: stretch;
  height: 100%;
}
.an-combo-col {
  flex: 1 1 50%;
  min-width: 0;
}
/* Trend-Spalte braucht mehr Breite als Faktorwert (kurze Zahl wie "1,0") -
   Trennlinie daher nicht exakt mittig, sondern etwas nach rechts versetzt,
   sonst laeuft ein langes Wort wie "Stagnierend" ueber die Linie. */
.an-combo-col:first-child {
  flex: 1 1 60%;
}
.an-combo-col:last-child {
  flex: 1 1 40%;
}
.an-combo-divider {
  width: 1px;
  background: #E6DEC8;
  margin: 0 16px;
  flex-shrink: 0;
}

.an-charts-label {
  font-size: 13px;
  color: #6b6555;
  margin-bottom: 12px;
}
.an-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.an-chart-card {
  background: #fff;
  border: 1px solid #E6DEC8;
  border-radius: 8px;
  padding: 14px;
}
.an-chart-label {
  font-size: 13px;
  font-weight: 700;
  color: #1A2E16;
  margin-bottom: 8px;
}

.an-disclaimer {
  font-size: 12px;
  color: #8a8375;
  line-height: 1.5;
  border-top: 1px solid #E6DEC8;
  padding-top: 16px;
}

@media (max-width: 992px) {
  .an-tool {
    padding: 24px;
  }
  .an-tool-header {
    width: calc(100% + 48px);
    margin: -24px -24px 20px;
  }
  .an-metrics {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 576px) {
  .an-metrics {
    grid-template-columns: 1fr;
  }
}

/* Text-Spalte neben dem Video: vertikal zentriert, damit sie bei kuerzerem
   Text nicht oben "klebt", waehrend das Video die volle Spaltenhoehe fuellt. */
.an-video-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
}

/* Video-Spalte: die Bootstrap-Spalte wird durch den (laengeren) Text
   daneben bereits auf dessen Hoehe gestreckt (Row = Flex-Container mit
   align-items:stretch) - die feste .ratio-16x9-Box selbst fuellt diese
   Spaltenhoehe aber nicht automatisch. flex:1 auf die Ratio-Box laesst
   sie ueber ihre Aspect-Ratio-Basishoehe hinaus wachsen, bis Video- und
   Button-Unterkante auf gleicher Hoehe sind. */
.an-video-col {
  display: flex;
  flex-direction: column;
}
.an-video-col .ratio {
  flex: 1 1 auto;
}
.an-video-text .btn {
  align-self: flex-start;
  margin-top: 8px;
}

/* Makro-Kontext-Block (Our World in Data Embed): schlichte weisse Karte,
   selber Rahmen-Ton wie die Chart-Karten oben, damit es sich als Teil
   desselben Tools liest statt als Fremdkoerper. */
.an-embed-block {
  background: #fff;
  border: 1px solid #E6DEC8;
  border-radius: 10px;
  padding: 24px;
}
.an-embed-frame {
  display: block;
  width: 100%;
  height: 600px;
  border: 0;
}
@media (max-width: 576px) {
  .an-embed-frame {
    height: 420px;
  }
}

/* Abschluss-CTA (wie tf-kmu-cta auf transformation.html), .contact-por
   selbst kommt unveraendert aus main.css. */
.an-cta {
  margin-top: 50px;
}
