/* Sichtbares Feedback und Animationen (static/js/feedback.js, Kundenwunsch 08.11.2026). Nur Farb-Rollen aus
   farben.css. Stufen am <html>: .anim-an (alles), .anim-reduziert (nur Farbe/Text, keine Bewegung), .anim-aus. */

/* ---------- Fortschrittsleiste oben */
.tl-fortschritt { position: fixed; z-index: 30; top: 0; left: 0; right: 0; height: 3px; pointer-events: none;
  background: var(--gold); transform-origin: left; transform: scaleX(0); opacity: 0; transition: opacity .2s; }
.tl-fortschritt.an { opacity: 1; animation: tl-leiste 1.6s ease-in-out infinite; }
@keyframes tl-leiste { 0% { transform: scaleX(.05); } 50% { transform: scaleX(.7); } 100% { transform: scaleX(.95); } }
.anim-reduziert .tl-fortschritt.an, .anim-aus .tl-fortschritt.an { animation: none; transform: scaleX(1); opacity: .6; }

/* ---------- Knopf beschäftigt: Spinner im Knopf, gedrückt-Zustand */
.knopf:active:not([disabled]), button:active:not([disabled]) { transform: translateY(1px); }
.tl-laeuft { position: relative; cursor: progress; }
.tl-laeuft::after { content: ""; display: inline-block; width: 1em; height: 1em; margin-left: .5em; vertical-align: -.15em;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: tl-drehen .7s linear infinite; }
@keyframes tl-drehen { to { transform: rotate(360deg); } }
.anim-reduziert .tl-laeuft::after, .anim-aus .tl-laeuft::after { animation: none; border-right-color: currentColor; opacity: .5; }

/* ---------- Tipp-Anzeige „rechnet …“ */
.tl-rechnet { position: relative; }
.tl-tippt { position: absolute; z-index: 2; top: 6px; right: 8px; display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 8px; border-radius: 999px; background: var(--gold-grund); color: var(--gold); font-size: .78rem; font-weight: 600; }
.tl-tippt i { display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: .3;
  animation: tl-punkt 1s infinite ease-in-out; }
.tl-tippt i:first-of-type { margin-left: 3px; }
.tl-tippt i:nth-of-type(2) { animation-delay: .15s; }
.tl-tippt i:nth-of-type(3) { animation-delay: .3s; }
@keyframes tl-punkt { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.anim-reduziert .tl-tippt i { animation: none; opacity: .8; }
.anim-aus .tl-tippt { display: none; }

/* ---------- data-tippen: Zeichen für Zeichen (Text bleibt im DOM, nur unsichtbar bis „an“) */
.tl-tippen .tl-z { opacity: 0; }
.tl-z.an { opacity: 1; transition: opacity .08s; }

/* ---------- Zahlen: grün/rot kurz aufleuchten, Pfeil */
.tl-steigt { animation: tl-gruen 1.2s ease-out; }
.tl-faellt { animation: tl-rot 1.2s ease-out; }
@keyframes tl-gruen { 0%, 30% { color: var(--gut); background: var(--gut-grund); } 100% { background: transparent; } }
@keyframes tl-rot { 0%, 30% { color: var(--fehler); background: var(--fehler-grund); } 100% { background: transparent; } }
.tl-pfeil { font-size: .8em; font-weight: 700; }
.tl-pfeil.tl-steigt { color: var(--gut); animation: none; }
.tl-pfeil.tl-faellt { color: var(--fehler); animation: none; }
[data-zahl-animiert] { border-radius: 6px; transition: color .3s; }

/* ---------- Meldungen und Hinweise erscheinen weich; Erfolg mit Häkchen */
.anim-an .hinweis { animation: tl-ein .25s ease-out; }
.anim-an .hinweis.gut .icon { animation: tl-plopp-gross .45s ease-out; }
.tl-toast.gut { border-left: 4px solid var(--gut); }
.tl-toast.fehler { border-left: 4px solid var(--fehler); }
.tl-toast.tl-weg { opacity: 0; transition: opacity .3s; }
@keyframes tl-ein { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes tl-plopp-gross { 0% { transform: scale(.3); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }

/* ---------- Fehlerfeld schütteln, gültige Eingabe grün */
.anim-an .tl-schuetteln { animation: tl-schuetteln .45s ease-in-out; }
@keyframes tl-schuetteln { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
input.tl-gueltig, select.tl-gueltig, textarea.tl-gueltig { border-color: var(--gut); box-shadow: inset 3px 0 0 var(--gut); }

/* ---------- Schritt-Ablauf: Übergang, Schrittanzeige, gewählte Kachel */
.anim-an .tl-schieben-vor { animation: tl-von-rechts .28s ease-out; }
.anim-an .tl-schieben-zurueck { animation: tl-von-links .28s ease-out; }
@keyframes tl-von-rechts { from { opacity: .3; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes tl-von-links { from { opacity: .3; transform: translateX(-24px); } to { opacity: 1; transform: none; } }
.schritt-anzeige li:has(~ li.aktiv) { border-color: var(--gold); color: var(--gold); }
.anim-an .schritt-anzeige li.aktiv { background-image: linear-gradient(90deg, var(--gold-grund), var(--gold-grund));
  background-repeat: no-repeat; background-size: 100% 100%; animation: tl-fuellen .4s ease-out; }
@keyframes tl-fuellen { from { background-size: 0 100%; } to { background-size: 100% 100%; } }
.anim-an .tl-plopp { animation: tl-plopp .25s ease-out; }
@keyframes tl-plopp { 0% { transform: scale(1); } 40% { transform: scale(.96); } 100% { transform: scale(1); } }

/* ---------- Fokus immer sichtbar; Bewegung aus, wenn das System es wünscht */
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.anim-aus *, .anim-aus *::before, .anim-aus *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  .tl-schuetteln, .tl-schieben-vor, .tl-schieben-zurueck, .tl-plopp, .hinweis, .hinweis .icon { animation: none !important; }
}
