/* Diggi Chat – CSS (Phones: Icon-Launcher Klasse; Desktop/Tablet: großer Button)
   - NEU: Block für #diggi-chat-toggle button.diggi-icon-launcher (64px rund, Rand 1px, Logo 62px)
*/

/* ===== Theme ===== */
:root {
  --diggi-accent: #3F5AF3;
  --diggi-bg: #121826;
  --diggi-text: #d6d9e3;
  --diggi-text-dim: #aab2c2;
  --diggi-input-bg: #1a2133;
  --diggi-border: rgba(255,255,255,0.08);
  --diggi-shadow: rgba(0,0,0,0.25);
  --diggi-dot: #bfc8ff;
}

/* ===== Launcher (Desktop/Tablet – großer Button) ===== */
#diggi-chat-toggle {
  position: fixed; bottom: 20px; left: 20px; z-index: 10000;
}
#diggi-chat-toggle button {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--diggi-accent);
  border-radius: 30px;
  background: var(--diggi-accent); color: #fff;
  font: 600 14px/1 system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,"Helvetica Neue",Arial;
  box-shadow: 0 2px 8px var(--diggi-shadow);
  cursor: pointer;
}
#diggi-chat-toggle button:hover { filter: brightness(0.95); }
#diggi-chat-toggle button img { width: 30px; height: 30px; border-radius: 50%; }

/* ===== Phones: runder Icon-Launcher (per JS-Klasse .diggi-icon-launcher) ===== */
#diggi-chat-toggle button.diggi-icon-launcher {
  width: 64px; height: 64px;
  border-radius: 50%;
  justify-content: center;
  padding: 0; gap: 0;
  border: 1px solid var(--diggi-accent);
  background: transparent;              /* nur Rand sichtbar */
  color: var(--diggi-accent);
}
#diggi-chat-toggle button.diggi-icon-launcher span { display: none; }
#diggi-chat-toggle button.diggi-icon-launcher > img {
  width: 62px; height: 62px;            /* Bild füllt Kreis (64 - 2*1px Rand) */
  border-radius: 50%;
  display: block;
  object-fit: contain;
}

/* ===== Chat-Container ===== */
#diggi-chat-container {
  position: fixed;
  bottom: 20px; left: 20px;
  width: 400px;
  height: clamp(420px, 58vh, 75vh);
  max-height: 80vh;
  display: none; flex-direction: column;
  background: var(--diggi-bg); color: var(--diggi-text);
  border: 1px solid var(--diggi-border);
  border-radius: 12px;
  box-shadow: 0 12px 28px var(--diggi-shadow);
  z-index: 10001;
  overflow: hidden;
}
#diggi-chat-container.open { display: flex; }

@media (max-width: 480px) {
  #diggi-chat-container {
    left: 12px; right: 12px; width: auto;
    height: clamp(360px, 62vh, 78vh);
    max-height: 82vh;
  }
}

/* ===== Header ===== */
#chat-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  column-gap: 14px;
  padding: 12px 14px;
  min-height: 72px;
  background: var(--diggi-input-bg);
  color: var(--diggi-text);
  border-bottom: 1px solid var(--diggi-border);
  user-select: none;
}
#chat-header > img {
  width: 64px !important; height: 64px !important;
  min-width: 64px; min-height: 64px;
  max-width: none !important;
  border-radius: 50%;
  display: block;
  margin-left: 2px;
  margin-right: 6px;
  object-fit: cover;
}
#chat-header > span:not(#diggi-close) {
  font-weight: 600; font-size: 15px; line-height: 1.3;
  color: var(--diggi-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
#diggi-close {
  font-size: 20px; font-weight: 700; line-height: 1;
  background: transparent;
  color: var(--diggi-accent);
  cursor: pointer;
}
#diggi-close:hover { opacity: .9; }

/* ===== Nachrichtenbereich ===== */
#diggi-chat-messages {
  position: relative; flex: 1 1 auto;
  padding: 10px 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--diggi-bg); color: var(--diggi-text);
}
.diggi-msg {
  margin: 0 0 8px 0; padding: 0;
  display: block; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word;
  background: transparent; color: var(--diggi-text);
}
.diggi-msg-bot  { text-align: left; }
.diggi-msg-user { text-align: right; color: var(--diggi-accent); font-weight: 600; }

/* Fallback-Links */
#diggi-chat-messages a { color: #aeb8ff; text-decoration: underline; }

/* Antwort-Karten (Buttons) */
.diggi-card {
  border: 1px solid var(--diggi-border);
  border-radius: 10px;
  padding: 12px;
  margin: 10px 0 6px;
  background: rgba(255,255,255,0.03);
}
.diggi-card-btn {
  display: inline-block;
  padding: 8px 12px;
  margin: 4px 6px 0 0;
  font-size: 13px; font-weight: 600;
  border-radius: 8px;
  background: var(--diggi-accent);
  color: var(--diggi-text);
  border: 1px solid var(--diggi-accent);
  text-decoration: none;
}
.diggi-card-btn:hover { filter: brightness(0.95); }

/* ===== Loading ===== */
#diggi-loading {
  display: none; align-items: center; justify-content: center;
  gap: 6px; padding: 8px 10px;
}
#diggi-loading span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--diggi-dot); opacity: .9;
  animation: diggi-wave 1.1s ease-in-out infinite;
}
#diggi-loading span:nth-child(2){ animation-delay: .08s }
#diggi-loading span:nth-child(3){ animation-delay: .16s }
#diggi-loading span:nth-child(4){ animation-delay: .24s }
#diggi-loading span:nth-child(5){ animation-delay: .32s }
#diggi-loading span:nth-child(6){ animation-delay: .40s }
@keyframes diggi-wave {
  0%,100%{ transform: translateY(0); opacity:.9 }
  25%    { transform: translateY(-6px); opacity:1 }
  50%    { transform: translateY(0); opacity:.9 }
  75%    { transform: translateY(4px); opacity:.85 }
}

/* ===== Eingabe ===== */
#diggi-chat-input {
  display: block; width: calc(100% - 24px);
  margin: 10px 12px 12px;
  padding: 11px 12px;
  border-radius: 12px; outline: none;
  border: 1px solid var(--diggi-border);
  background: var(--diggi-input-bg);
  color: var(--diggi-text);
}
#diggi-chat-input::placeholder {
  color: #7c8496;
}

/* ===== Schriftglättung ===== */
#diggi-chat-container, #diggi-chat-toggle, #chat-header, #diggi-chat-messages, #diggi-loading, #diggi-chat-input {
  font-family: system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,"Helvetica Neue",Arial;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}

/* Nur der runde Icon-Button hängt tiefer */
#diggi-chat-toggle button.diggi-icon-launcher {
  position: relative;
  top: 10px; /* schiebt den Button 15px weiter nach unten */
}

/* DIGGI PATCH 2025-08-31 START: loader visible (nur Anzeige steuern) */
#diggi-loading.show { display: flex !important; }
/* DIGGI PATCH 2025-08-31 END */
