/* MELLEPRISE Chat-Widget (AnythingLLM via chat.melleprise.com) —
   Overrides gegen das Bundle. Selector-IDs kommen aus dem Widget-DOM. */

/* Widget darf die Seite nicht horizontal sprengen */
html, body { overflow-x: hidden; }

/* "Reset Chat"-Link + Footer-Wrapper ausblenden */
#anything-llm-chat div.allm-w-full.allm-justify-center > button { display: none !important; }
#anything-llm-chat div.allm-mt-4.allm-pb-4 { display: none !important; }

/* Header slim: 56px statt 76px, rundes Logo links, Titel daneben */
#anything-llm-chat #anything-llm-header div.allm-justify-center {
  justify-content: flex-start !important;
  height: 56px !important;
  padding-left: 10px;
  box-sizing: border-box;
}
#anything-llm-chat #anything-llm-header img {
  border-radius: 50%;
  object-fit: cover;
  max-width: 36px !important;
  max-height: 36px !important;
}
#anything-llm-chat #anything-llm-header div.allm-justify-center::after {
  content: "MELLEPRISE AI";
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .02em;
  color: #222628;
  margin-left: 10px;
}
#anything-llm-chat #anything-llm-header .allm-absolute { padding-right: 14px !important; }

/* Nur die Nachrichtenliste scrollt — sonst wandert das Eingabefeld mit */
#anything-llm-chat div.allm-flex-grow.allm-overflow-y-auto { overflow: hidden !important; }
#anything-llm-chat div.allm-flex-1.allm-min-h-0.allm-mb-8 { margin-bottom: 0 !important; }
/* Freiraum am Listenende: letzte Zeile bleibt über dem Eingabefeld */
#anything-llm-chat #chat-history > div { padding-bottom: 76px !important; }
/* Lange URLs (Booking-Link) dürfen umbrechen */
#anything-llm-chat #chat-history { overflow-wrap: anywhere; }

/* Input-Zeile kompakter */
#anything-llm-chat form div.allm-bg-white.allm-px-4 {
  padding-left: 12px !important;
  padding-right: 12px !important;
  padding-bottom: 12px !important;
}
#anything-llm-chat #send-message-button svg { width: 20px; height: 20px; }

/* Assistenten-Avatar (Melchior-Foto) rund */
#anything-llm-chat img[src*="Melchior-IV-v-d-Decken"] {
  border-radius: 50%;
  object-fit: cover;
}

/* Ecken unten rund wie oben + Bundle-Margin (16px unten/rechts) raus */
#anything-llm-chat { overflow: hidden !important; margin: 0 !important; }

/* Typing-Dots-Bubble (gleicher Look wie Assistenten-Bubbles) */
#anything-llm-chat .mp-typing-row {
  margin-left: 53px;
  margin-top: 4px;
  margin-bottom: 4px;
}
#anything-llm-chat .mp-typing-bubble {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 5px rgba(0,0,0,.14);
  padding: 12px 14px;
}
#anything-llm-chat .mp-typing-bubble span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9ca3af;
  display: inline-block;
  animation: mp-dot 1.1s infinite ease-in-out;
}
#anything-llm-chat .mp-typing-bubble span:nth-child(2) { animation-delay: .15s; }
#anything-llm-chat .mp-typing-bubble span:nth-child(3) { animation-delay: .3s; }
@keyframes mp-dot {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Neue Assistenten-Bubbles sanft einblenden */
#anything-llm-chat .allm-anything-llm-assistant-message {
  animation: mp-bubble-in .25s ease-out;
}
@keyframes mp-bubble-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Scroll-down-Button mittig über dem Eingabefeld (Bundle setzt
   position:fixed → 50% wäre Viewport-Mitte; absolute = Chatfenster) */
#anything-llm-chat div[class*="allm-bottom-[10rem]"][class*="allm-right-[50px]"] {
  position: absolute !important;
  bottom: 104px !important;
  right: auto !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
}

/* Mobile/Schmal (<=768px): Vollbild-Overlay ohne Ränder.
   768px = allm-md:-Breakpoint des Widgets. */
@media (max-width: 768px) {
  #anything-llm-chat {
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    min-width: 0 !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    height: 100vh !important;
    max-height: 100vh !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    overflow-x: hidden !important;
  }
  /* iOS-Home-Indikator soll das Eingabefeld nicht verdecken */
  #anything-llm-chat form div.allm-bg-white.allm-px-4 {
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important;
  }
  /* Input hat im Bundle w-full + mx-2 → >100% Breite, Send-Button
     rutscht raus; >=16px Font verhindert den iOS-Auto-Zoom */
  #anything-llm-chat #message-input {
    width: auto !important;
    min-width: 0 !important;
    margin-left: 4px !important;
    margin-right: 4px !important;
    font-size: 16px !important;
  }
  /* Chat-Bubble hart unten rechts anpinnen */
  /* Vollbild: keine Rundungen an Fensterkanten — nur Bubbles,
     Input-Box und runde Buttons behalten ihre Form */
  #anything-llm-chat [class*="allm-rounded"]:not(.allm-anything-llm-assistant-message):not(.allm-anything-llm-user-message):not(.allm-rounded-2xl):not(.allm-rounded-full) {
    border-radius: 0 !important;
  }
  #anything-llm-embed-chat-button-container {
    position: fixed !important;
    right: 16px !important;
    left: auto !important;
    bottom: 16px !important;
    margin: 0 !important;
    z-index: 2147483000 !important;
  }
}

/* Bubble: sanftes Pulsieren, das zum Klicken animiert */
#anything-llm-embed-chat-button {
  position: relative !important;
  animation: mp-pulse 2.6s ease-out infinite;
}
@keyframes mp-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(38,38,38,.45); }
  70%  { box-shadow: 0 0 0 16px rgba(38,38,38,0); }
  100% { box-shadow: 0 0 0 0 rgba(38,38,38,0); }
}
/* Rote Badge "1" — verschwindet nach dem ersten Klick */
#anything-llm-embed-chat-button::after {
  content: "1";
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #dc2626;
  color: #fff;
  font: 700 12px/20px -apple-system, "Segoe UI", Roboto, sans-serif;
  text-align: center;
}
body.mp-bubble-read #anything-llm-embed-chat-button::after { display: none; }
body.mp-bubble-read #anything-llm-embed-chat-button { animation: none; }

/* ---- Dark-Look passend zu melleprise.com (Gold-Akzent) ---- */
#anything-llm-chat {
  background: #262830 !important;
  border-color: #3a3d46 !important;
  box-shadow: 0 18px 50px rgba(0,0,0,.55) !important;
}
#anything-llm-chat .allm-bg-white { background: #262830 !important; }
#anything-llm-chat .allm-bg-gray-100 { background: rgba(255,255,255,.05) !important; }
#anything-llm-chat .allm-text-gray-400 { color: #d8dbe2 !important; }
#anything-llm-chat [class*="allm-text-[#"] { color: #d8dbe2 !important; }

#anything-llm-chat #anything-llm-header {
  background: #1c1e24 !important;
  border-bottom: none !important;
}
#anything-llm-chat #anything-llm-header div.allm-justify-center::after { color: #ffffff; }
#anything-llm-chat #anything-llm-header svg,
#anything-llm-chat #anything-llm-header button { color: #d8dbe2 !important; }

#anything-llm-chat .allm-anything-llm-user-message,
#anything-llm-chat .allm-anything-llm-user-message * {
  color: #1c1e24 !important;
}
#anything-llm-chat .allm-anything-llm-assistant-message {
  background: rgba(255,255,255,.06) !important;
  border: 1px solid #3a3d46 !important;
  box-shadow: none !important;
  color: #ffffff !important;
}
#anything-llm-chat .allm-anything-llm-assistant-message * { color: #ffffff !important; }
#anything-llm-chat .allm-anything-llm-assistant-message a { color: var(--lp4-gold-a) !important; }

#anything-llm-chat .mp-typing-bubble {
  background: rgba(255,255,255,.06);
  border: 1px solid #3a3d46;
  box-shadow: none;
}

#anything-llm-chat form div.allm-bg-white.allm-px-4 {
  background: #262830 !important;
}
/* Runde Box um das Textfeld (Bundle: inneres div.allm-rounded-2xl
   mit Inline-Border) — selbst abdunkeln, Textarea bleibt randlos */
#anything-llm-chat div.allm-rounded-2xl {
  background: rgba(255,255,255,.06) !important;
  border: 1px solid #3a3d46 !important;
}
#anything-llm-chat #message-input {
  background: transparent !important;
  color: #ffffff !important;
}

#anything-llm-chat #send-message-button { margin-right: 10px !important; }
#anything-llm-chat #message-input::placeholder { color: #d8dbe2 !important; }
#anything-llm-chat #send-message-button { color: var(--lp4-gold-a) !important; }
#anything-llm-chat #send-message-button svg { color: var(--lp4-gold-a) !important; }

#anything-llm-chat div[class*="allm-bottom-[10rem]"][class*="allm-right-[50px]"] {
  background: transparent !important;
  border: none !important;
}
#anything-llm-chat div[class*="allm-bottom-[10rem]"][class*="allm-right-[50px]"] .allm-rounded-full {
  background: #262830 !important;
  border: 1px solid #3a3d46 !important;
  box-shadow: 0 4px 14px rgba(0,0,0,.45) !important;
}
#anything-llm-chat div[class*="allm-bottom-[10rem]"][class*="allm-right-[50px]"] svg {
  color: var(--lp4-gold-a) !important;
}

@keyframes mp-pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--lp4-gold-a) 45%, transparent); }
  70%  { box-shadow: 0 0 0 16px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

#anything-llm-embed-chat-button { color: #1c1e24 !important; }
#anything-llm-embed-chat-button svg { color: #1c1e24 !important; }

/* Vollbild-Wrapper des offenen Chats darf keine Klicks fressen —
   nur das sichtbare Fenster selbst ist klickbar (sonst ist z. B.
   das Seitenmenü hinter dem Overlay tot). */
#anything-llm-embed-chat-container { pointer-events: none !important; }
#anything-llm-embed-chat-container #anything-llm-chat { pointer-events: auto !important; }

/* Offenes Menü (body.lp4-nav-lock): Chat-Bubble ausblenden */
body.lp4-nav-lock #anything-llm-embed-chat-button-container { display: none !important; }
