/* Langdock Chatbot – Styles v1.0.0 */

:root {
  --ldcb-accent: #2563eb;
  --ldcb-radius: 12px;
  --ldcb-shadow: 0 4px 28px rgba(0, 0, 0, 0.13);
  --ldcb-bg: #ffffff;
  --ldcb-bg-msg-user: var(--ldcb-accent);
  --ldcb-bg-msg-bot: #f1f5f9;
  --ldcb-text: #1e293b;
  --ldcb-text-light: #94a3b8;
  --ldcb-border: #e2e8f0;
  --ldcb-font: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}

/* ── Widget-Container ──────────────────────────────────────────────────────── */

.ldcb-widget {
  display: flex;
  flex-direction: column;
  background: var(--ldcb-bg);
  border-radius: var(--ldcb-radius);
  border: 1px solid var(--ldcb-border);
  box-shadow: var(--ldcb-shadow);
  overflow: hidden;
  font-family: var(--ldcb-font);
  font-size: 14px;
  color: var(--ldcb-text);
  line-height: 1.5;
}

/* ── Header ────────────────────────────────────────────────────────────────── */

.ldcb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--ldcb-accent);
  color: #fff;
  flex-shrink: 0;
}

.ldcb-title {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.01em;
}

.ldcb-reset {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 0 2px;
  transition: color 0.2s;
  display: flex;
  align-items: center;
}
.ldcb-reset:hover { color: #fff; }

/* ── Nachrichten-Bereich ───────────────────────────────────────────────────── */

.ldcb-messages {
  flex: 1;
  min-height: 280px;
  max-height: 420px;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

/* Scrollbar dezent stylen (Webkit) */
.ldcb-messages::-webkit-scrollbar { width: 5px; }
.ldcb-messages::-webkit-scrollbar-track { background: transparent; }
.ldcb-messages::-webkit-scrollbar-thumb {
  background: var(--ldcb-border);
  border-radius: 10px;
}

/* ── Einzelne Nachricht ────────────────────────────────────────────────────── */

.ldcb-msg {
  max-width: 84%;
  padding: 10px 14px;
  border-radius: 16px;
  word-break: break-word;
  animation: ldcb-appear 0.18s ease;
}

@keyframes ldcb-appear {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ldcb-msg--user {
  background: var(--ldcb-bg-msg-user);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.ldcb-msg--assistant {
  background: var(--ldcb-bg-msg-bot);
  color: var(--ldcb-text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.ldcb-msg code {
  background: rgba(0, 0, 0, 0.08);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12.5px;
}

.ldcb-msg--user code {
  background: rgba(255, 255, 255, 0.2);
}

/* ── Tipp-Indikator ────────────────────────────────────────────────────────── */

.ldcb-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px 18px;
  background: var(--ldcb-bg-msg-bot);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  max-width: 80px;
}

.ldcb-typing span {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ldcb-text-light);
  animation: ldcb-bounce 1.3s infinite ease-in-out;
}
.ldcb-typing span:nth-child(2) { animation-delay: 0.2s; }
.ldcb-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes ldcb-bounce {
  0%, 60%, 100% { transform: translateY(0);    opacity: 0.6; }
  30%            { transform: translateY(-6px); opacity: 1;   }
}

/* ── Eingabe-Zeile ─────────────────────────────────────────────────────────── */

.ldcb-input-row {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--ldcb-border);
  background: var(--ldcb-bg);
  flex-shrink: 0;
}

.ldcb-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--ldcb-border);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: var(--ldcb-font);
  color: var(--ldcb-text);
  background: #f8fafc;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}
.ldcb-input:focus {
  border-color: var(--ldcb-accent);
  background: #fff;
}
.ldcb-input:disabled { opacity: 0.6; cursor: not-allowed; }

.ldcb-send {
  flex-shrink: 0;
  background: var(--ldcb-accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 16px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ldcb-send:hover:not(:disabled) { opacity: 0.88; }
.ldcb-send:active:not(:disabled) { transform: scale(0.95); }
.ldcb-send:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Inline-Modus ──────────────────────────────────────────────────────────── */

.ldcb-inline {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}

/* ── Bubble-Modus: Float-Button ────────────────────────────────────────────── */

.ldcb-bubble-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--ldcb-accent);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.22);
  z-index: 9998;
  transition: transform 0.2s, box-shadow 0.2s;
}
.ldcb-bubble-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.3);
}
.ldcb-bubble-btn:active { transform: scale(0.97); }

/* ── Bubble-Modus: Chat-Panel ─────────────────────────────────────────────── */

.ldcb-bubble-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 370px;
  max-width: calc(100vw - 48px);
  z-index: 9997;
  transform-origin: bottom right;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.ldcb-bubble-panel--hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.95) translateY(10px);
}

.ldcb-bubble-panel .ldcb-messages {
  min-height: 300px;
  max-height: 380px;
}

/* ── Responsive ────────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .ldcb-bubble-panel {
    bottom: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 16px 16px 0 0;
  }
  .ldcb-bubble-panel .ldcb-widget {
    border-radius: 16px 16px 0 0;
  }
  .ldcb-bubble-btn {
    bottom: 16px;
    right: 16px;
  }
  .ldcb-bubble-panel .ldcb-messages {
    max-height: 55vh;
  }
}
