/* ============================================================
   Chatbot-Widget „TM Agents Assistent"
   Nutzt die Design-Variablen aus styles.css (:root).
   Das komplette Markup wird von js/chatbot.js erzeugt — hier
   liegt nur das Aussehen. Passt zum dunklen Netzwerk-Design.
   ============================================================ */

.tmc {
  position: fixed;
  right: clamp(16px, 4vw, 28px);
  bottom: clamp(16px, 4vw, 28px);
  z-index: 900;
  font-family: var(--font-text);
}

/* ---------- Auslöser-Knopf unten rechts ---------- */
.tmc__launcher {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 58px;
  padding: 0 22px 0 18px;
  border: 1px solid var(--btn-glas-rand);
  border-radius: 999px;
  background: var(--btn-glas);
  color: #fff;
  font: 600 16px/1 var(--font-text);
  cursor: pointer;
  box-shadow: 0 10px 30px var(--blau-glow);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: background .2s ease, transform .2s ease;
}
.tmc__launcher:hover { background: var(--btn-glas-hover); transform: translateY(-2px); }
.tmc__launcher:focus-visible { outline: 2px solid var(--blau-300); outline-offset: 3px; }
.tmc__launcher svg { width: 24px; height: 24px; flex: none; }

/* Wenn das Fenster offen ist, verschwindet der Knopf */
.tmc.ist-offen .tmc__launcher { display: none; }

/* ---------- Chat-Fenster ---------- */
.tmc__panel {
  position: absolute;
  right: 0;
  bottom: 0;
  width: min(384px, calc(100vw - 32px));
  height: min(564px, calc(100vh - 96px));
  display: flex;
  flex-direction: column;
  background: rgba(9, 13, 26, 0.94);
  border: 1px solid var(--linie-stark);
  border-radius: var(--radius);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  overflow: hidden;
  transform-origin: bottom right;
  animation: tmc-auf .22s ease;
}
.tmc__panel[hidden] { display: none; }

@keyframes tmc-auf {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Kopfzeile ---------- */
.tmc__kopf {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--linie);
  background: rgba(53, 104, 245, 0.10);
}
.tmc__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 12px;
  background: var(--btn-glas);
  border: 1px solid var(--btn-glas-rand);
}
.tmc__avatar svg { width: 22px; height: 22px; }
.tmc__titel { display: flex; flex-direction: column; line-height: 1.25; }
.tmc__titel strong { font: 600 15px/1.3 var(--font-display); color: var(--text-100); }
.tmc__titel span { font-size: 12.5px; color: var(--text-55); }
.tmc__status-punkt {
  display: inline-block; width: 7px; height: 7px; margin-right: 5px;
  border-radius: 50%; background: #46d19e; vertical-align: middle;
}
.tmc__schliessen {
  margin-left: auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border: none; border-radius: 10px;
  background: transparent; color: var(--text-75);
  cursor: pointer; font-size: 22px; line-height: 1;
  transition: background .15s ease, color .15s ease;
}
.tmc__schliessen:hover { background: var(--karte-hover); color: var(--text-100); }
.tmc__schliessen:focus-visible { outline: 2px solid var(--blau-300); outline-offset: 2px; }

/* ---------- Nachrichtenverlauf ---------- */
.tmc__verlauf {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--linie-stark) transparent;
}
.tmc__verlauf::-webkit-scrollbar { width: 8px; }
.tmc__verlauf::-webkit-scrollbar-thumb { background: var(--linie-stark); border-radius: 4px; }

.tmc__msg {
  max-width: 86%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
.tmc__msg--bot {
  align-self: flex-start;
  background: var(--karte-hover);
  border: 1px solid var(--linie);
  color: var(--text-100);
  border-bottom-left-radius: 5px;
}
.tmc__msg--user {
  align-self: flex-end;
  background: var(--btn-glas);
  color: #fff;
  border-bottom-right-radius: 5px;
}
.tmc__msg a { color: var(--blau-300); }
.tmc__msg--user a { color: #fff; text-decoration: underline; }

/* Schnell-Fragen unter der Begrüßung */
.tmc__vorschlaege { display: flex; flex-wrap: wrap; gap: 8px; align-self: flex-start; max-width: 100%; }
.tmc__chip {
  padding: 8px 13px;
  border: 1px solid var(--btn-glas-rand);
  border-radius: 999px;
  background: rgba(53, 104, 245, 0.12);
  color: var(--text-100);
  font: 500 13.5px/1.2 var(--font-text);
  cursor: pointer;
  transition: background .15s ease;
}
.tmc__chip:hover { background: rgba(53, 104, 245, 0.24); }
.tmc__chip:focus-visible { outline: 2px solid var(--blau-300); outline-offset: 2px; }

/* „schreibt …"-Anzeige */
.tmc__tippt { display: inline-flex; gap: 5px; align-items: center; padding: 12px 15px; }
.tmc__tippt span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-55); animation: tmc-blink 1.2s infinite ease-in-out;
}
.tmc__tippt span:nth-child(2) { animation-delay: .2s; }
.tmc__tippt span:nth-child(3) { animation-delay: .4s; }
@keyframes tmc-blink { 0%, 60%, 100% { opacity: .3; } 30% { opacity: 1; } }

/* ---------- Eingabezeile ---------- */
.tmc__eingabe {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--linie);
  background: rgba(255, 255, 255, 0.02);
}
.tmc__feld {
  flex: 1;
  max-height: 96px;
  min-height: 44px;
  padding: 11px 14px;
  border: 1px solid var(--linie-stark);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-100);
  font: 400 15px/1.4 var(--font-text);
  resize: none;
}
.tmc__feld::placeholder { color: var(--text-40); }
.tmc__feld:focus { outline: none; border-color: var(--blau-300); }
.tmc__senden {
  flex: none;
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--btn-glas-rand);
  border-radius: 12px;
  background: var(--btn-glas);
  color: #fff;
  cursor: pointer;
  transition: background .15s ease;
}
.tmc__senden:hover { background: var(--btn-glas-hover); }
.tmc__senden:focus-visible { outline: 2px solid var(--blau-300); outline-offset: 2px; }
.tmc__senden:disabled { opacity: .45; cursor: not-allowed; }
.tmc__senden svg { width: 20px; height: 20px; }

.tmc__fuss {
  padding: 0 12px 10px;
  font-size: 11px;
  color: var(--text-40);
  text-align: center;
  background: rgba(255, 255, 255, 0.02);
}
.tmc__fuss a { color: var(--text-55); }

/* ---------- Handy: Fenster (fast) bildschirmfüllend ---------- */
@media (max-width: 480px) {
  .tmc { right: 12px; bottom: 12px; }
  .tmc__panel {
    position: fixed;
    right: 12px; left: 12px; bottom: 12px; top: 12px;
    width: auto; height: auto;
  }
}

/* Bewegung reduzieren, wenn vom System gewünscht */
@media (prefers-reduced-motion: reduce) {
  .tmc__panel { animation: none; }
  .tmc__launcher { transition: none; }
  .tmc__tippt span { animation: none; opacity: .6; }
}
