/* ============================================================================
   Allgemeiner KI-Assistent (Chat-Modul). Hell + Dark (html.mm-dark).
   ============================================================================ */
.mm_ass_widget { --a-accent: #e85d26; }

/* ---- Schwebender Öffnen-Button (FAB, unten rechts) ---- */
.mm_ass_fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 9998;
  display: inline-flex; align-items: center; gap: 9px;
  height: 52px; padding: 0 20px 0 16px; border: none; cursor: pointer;
  border-radius: 999px; background: linear-gradient(135deg, #e85d26, #ff7a45); color: #fff;
  font-family: var(--font-sans, 'Inter', system-ui, sans-serif); font-size: 15px; font-weight: 500;
  box-shadow: 0 10px 28px rgba(232,93,38,.38); transition: transform .12s, box-shadow .12s;
}
.mm_ass_fab:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(232,93,38,.46); }
.mm_ass_fab_ico { width: 24px; height: 24px; flex: 0 0 auto; }
.mm_ass_widget.is-open .mm_ass_fab { display: none; }

/* ---- Overlay (Backdrop + Panel) ---- */
.mm_ass_overlay { position: fixed; inset: 0; z-index: 9999; }
.mm_ass_overlay[hidden] { display: none; }
.mm_ass_backdrop { position: absolute; inset: 0; background: rgba(8,14,20,.28); }

/* ---- Chat-Panel (unten rechts) ---- */
.mm_ass {
  --a-accent: #e85d26;
  position: absolute; right: 24px; bottom: 24px;
  width: min(420px, calc(100vw - 32px));
  height: min(660px, calc(100vh - 48px));
  display: flex; flex-direction: column; padding: 0;
  border: 1px solid #e6eaf1; border-radius: 16px; background: #fff;
  box-shadow: 0 18px 50px rgba(15,25,35,.28); overflow: hidden;
  font-family: var(--font-sans, 'Inter', system-ui, sans-serif);
  animation: mm_ass_in .16s ease-out;
}
@keyframes mm_ass_in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* Schließen-Button im Kopf */
.mm_ass_close {
  margin-left: auto; flex: 0 0 auto; width: 32px; height: 32px; border: none; cursor: pointer;
  border-radius: 8px; background: transparent; color: #6b7683;
  display: inline-flex; align-items: center; justify-content: center;
}
.mm_ass_close svg { width: 20px; height: 20px; }
.mm_ass_close:hover { background: #eef1f5; color: #16202e; }
.mm_ass_head {
  display: flex; align-items: center; gap: 12px; padding: 16px 18px;
  border-bottom: 1px solid #eef1f5; background: #fbfcfd;
}
.mm_ass_ico {
  width: 38px; height: 38px; flex: 0 0 auto; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #e85d26, #ff7a45); color: #fff; font-size: 18px;
}
.mm_ass_ico svg { width: 22px; height: 22px; display: block; }
.mm_ass_title { font-size: 16px; font-weight: 700; color: #16202e; line-height: 1.2; }
.mm_ass_sub { font-size: 13px; color: #6b7683; margin-top: 2px; }

.mm_ass_thread {
  padding: 18px; display: flex; flex-direction: column; gap: 12px;
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
}
.mm_ass_msg {
  max-width: 86%; padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.5;
  white-space: pre-wrap; word-wrap: break-word;
}
.mm_ass_user { align-self: flex-end; background: var(--a-accent); color: #fff; border-bottom-right-radius: 4px; }
.mm_ass_assistant { align-self: flex-start; background: #f1f4f8; color: #16202e; border-bottom-left-radius: 4px; }

/* Vorgeschlagene Maschinen als Link-Karten */
.mm_ass_matches { align-self: flex-start; max-width: 100%; display: flex; flex-direction: column; gap: 8px; }
.mm_ass_match {
  display: flex; flex-direction: column; gap: 2px; text-decoration: none;
  padding: 10px 14px; border: 1px solid #e2e6ec; border-radius: 12px; background: #fff;
  transition: border-color .12s, box-shadow .12s;
}
.mm_ass_match:hover { border-color: var(--a-accent); box-shadow: 0 4px 14px rgba(232,93,38,.14); }
.mm_ass_match_t { font-size: 14px; font-weight: 700; color: #16202e; }
.mm_ass_match_m { font-size: 12.5px; color: #6b7683; }

/* Typing-Indikator */
.mm_ass_typing { display: inline-flex; gap: 4px; align-items: center; }
.mm_ass_typing span { width: 7px; height: 7px; border-radius: 50%; background: #9aa4b2; animation: mm_ass_blink 1.2s infinite both; }
.mm_ass_typing span:nth-child(2) { animation-delay: .2s; }
.mm_ass_typing span:nth-child(3) { animation-delay: .4s; }
@keyframes mm_ass_blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }

.mm_ass_chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 18px 12px; }
/* Ohne Vorschläge nimmt die Leiste keinen Platz weg (display:flex sticht
   sonst das hidden-Attribut). */
.mm_ass_chips[hidden] { display: none; }
.mm_ass_chip {
  border: 1px solid #d7dce3; background: #fff; color: #33475b; cursor: pointer;
  font: inherit; font-size: 13px; padding: 7px 13px; border-radius: 999px;
  transition: border-color .12s, color .12s, background .12s;
}
.mm_ass_chip:hover { border-color: var(--a-accent); color: var(--a-accent); }

.mm_ass_form { display: flex; gap: 10px; padding: 14px 18px 18px; border-top: 1px solid #eef1f5; }
.mm_ass_input {
  flex: 1 1 auto; min-width: 0; height: 46px; padding: 0 16px;
  border: 1px solid #d7dce3; border-radius: 12px; background: #fff;
  color: #16202e; font: inherit; font-size: 14px; outline: none;
}
.mm_ass_input:focus { border-color: var(--a-accent); }
.mm_ass_input::placeholder { color: #9aa4b2; }
.mm_ass_send {
  flex: 0 0 auto; height: 46px; padding: 0 22px; border: none; cursor: pointer;
  border-radius: 12px; background: var(--a-accent); color: #fff; font: inherit; font-size: 14px; font-weight: 500;
}
.mm_ass_send:hover { background: #c04b1e; }
.mm_ass_send:disabled { opacity: .6; cursor: default; }

/* ---------- Dark ---------- */
html.mm-dark .mm_ass { background: #131c26; border-color: rgba(255,255,255,.09); box-shadow: 0 10px 34px rgba(0,0,0,.35); }
html.mm-dark .mm_ass_head { background: #16202c; border-bottom-color: rgba(255,255,255,.08); }
html.mm-dark .mm_ass_title { color: #f2f6fa; }
html.mm-dark .mm_ass_sub { color: #90a2b2; }
html.mm-dark .mm_ass_assistant { background: #1e2a37; color: #e7edf3; }
html.mm-dark .mm_ass_match { background: #1a2535; border-color: rgba(255,255,255,.10); }
html.mm-dark .mm_ass_match_t { color: #f2f6fa; }
html.mm-dark .mm_ass_match_m { color: #90a2b2; }
html.mm-dark .mm_ass_chip { background: #1a2535; border-color: rgba(255,255,255,.12); color: #cdd6e0; }
html.mm-dark .mm_ass_chip:hover { border-color: var(--a-accent); color: var(--a-accent); }
html.mm-dark .mm_ass_form { border-top-color: rgba(255,255,255,.08); }
html.mm-dark .mm_ass_input { background: #1a2535; border-color: rgba(255,255,255,.14); color: #f2f6fa; }
html.mm-dark .mm_ass_input::placeholder { color: #6b7887; }
html.mm-dark .mm_ass { background: #131c26; border-color: rgba(255,255,255,.09); box-shadow: 0 18px 50px rgba(0,0,0,.5); }
html.mm-dark .mm_ass_backdrop { background: rgba(0,0,0,.5); }
html.mm-dark .mm_ass_close { color: #90a2b2; }
html.mm-dark .mm_ass_close:hover { background: rgba(255,255,255,.08); color: #f2f6fa; }

@media (max-width: 560px) {
  /* Panel als Vollbild-Sheet, FAB kompakt */
  .mm_ass {
    right: 0; bottom: 0; left: 0; top: 0;
    width: 100%; height: 100%; max-height: none; border-radius: 0; border: none;
  }
  .mm_ass_msg { max-width: 92%; }
  .mm_ass_fab { right: 16px; bottom: 16px; height: 48px; padding: 0 16px 0 14px; }
  .mm_ass_fab_lbl { display: none; }
}
