/* Modernes, klares Design für den HoFaS-Chat */
:root {
  --hofas-primary:   #006D5B; /* Standardwert, wird per JS überschrieben */
  --hofas-secondary: #A5D6A7;
  --hofas-bg:        #ffffff;
  --hofas-text:      #123024;
  --hofas-border:    #cbd5e0;
  --hofas-shadow:    0 4px 12px rgba(0, 0, 0, 0.1);
  --hofas-radius:    12px;
  --hofas-font:      'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --hofas-font-size: 16px;
  --hofas-line-height: 1.5;
}

/* Container & Launcher */
#hofas-chat {
  position: fixed;
  bottom: 24px;
  right: 24px;
  font-family: var(--hofas-font);
  font-size: var(--hofas-font-size);
  line-height: var(--hofas-line-height);
  z-index: 2147483000;
}

.hofas-chat-launcher {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  background-color: var(--hofas-primary);
  color: white;
  border: none;
  border-radius: var(--hofas-radius);
  cursor: pointer;
  box-shadow: var(--hofas-shadow);
  transition: all 0.2s ease;
  font-weight: 500;
}

.hofas-chat-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.hofas-chat-launcher-icon {
  font-size: 18px;
  font-weight: bold;
}

.material-symbols-outlined {
  font-size: 22px;
  line-height: 1;
}

/* Widget-Stil */
.hofas-chat-widget {
  position: fixed;
  bottom: 80px;
  right: 24px;
  width: 360px;
  height: 500px;
  min-width: 280px;
  min-height: 320px;
  max-width: 600px;
  max-height: 80vh;
  background: var(--hofas-bg);
  border-radius: var(--hofas-radius);
  box-shadow: var(--hofas-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--hofas-border);
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
  resize: both;
}

.hofas-chat-hidden {
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
}

/* Header */
.hofas-chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background-color: var(--hofas-primary);
  color: white;
  font-weight: 600;
}

.hofas-chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.hofas-chat-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 6px;
  flex-shrink: 0;
  display: none;
}

.hofas-chat-title {
  font-size: 18px;
}

.hofas-chat-close {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
}

/* Nachrichtenbereich */
.hofas-chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background-color: var(--hofas-bg);
}

.hofas-chat-msg {
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: var(--hofas-radius);
  max-width: 80%;
  word-wrap: break-word;
}

.hofas-chat-msg-user {
  background-color: var(--hofas-primary);
  color: white;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

.hofas-chat-msg-assistant {
  background-color: #f0f0f0;
  color: var(--hofas-text);
  margin-right: auto;
  border-bottom-left-radius: 4px;
}

/* Eingabebereich */
.hofas-chat-input {
  display: flex;
  flex-direction: column;
  padding: 12px 16px;
  background-color: var(--hofas-bg);
  border-top: 1px solid var(--hofas-border);
}

.hofas-chat-input-wrapper {
  display: flex;
  gap: 8px;
}

/* Typing / Thinking indicator - Wellen-Animation */
.hofas-chat-typing {
  display: inline-flex;
  gap: 5px;
  align-items: flex-end;
  padding: 12px 16px;
  border-radius: 18px;
  max-width: 80px;
  background: var(--hofas-bubble-assistant, #f3f4f6);
}

.hofas-chat-typing .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--hofas-primary);
  opacity: 0.5;
  animation: hofasWave 1.2s ease-in-out infinite;
}

.hofas-chat-typing .dot:nth-child(1) { animation-delay: 0.00s; }
.hofas-chat-typing .dot:nth-child(2) { animation-delay: 0.18s; }
.hofas-chat-typing .dot:nth-child(3) { animation-delay: 0.36s; }

@keyframes hofasWave {
  0%, 60%, 100% { transform: translateY(0);    opacity: 0.4; }
  30%           { transform: translateY(-8px); opacity: 1.0; }
}

/* Consent Overlay */
.hofas-consent-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.97);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 24px;
  z-index: 100;
  border-radius: var(--hofas-radius, 16px);
  gap: 16px;
}
.hofas-consent-text {
  font-size: 13px;
  color: #374151;
  text-align: center;
  line-height: 1.6;
}
.hofas-consent-text a {
  color: var(--hofas-primary);
  text-decoration: underline;
}
.hofas-consent-btn {
  background: var(--hofas-primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  width: 100%;
  max-width: 220px;
}
.hofas-consent-btn:hover { opacity: 0.85; }
.hofas-consent-decline {
  font-size: 12px;
  color: #9ca3af;
  cursor: pointer;
  text-decoration: underline;
  background: none;
  border: none;
}


.hofas-chat-textarea {
  flex: 1;
  min-height: 44px;
  max-height: 150px;
  padding: 10px 12px;
  border: 1px solid var(--hofas-border);
  border-radius: var(--hofas-radius);
  resize: none;
  font-family: var(--hofas-font);
  font-size: var(--hofas-font-size);
}

.hofas-chat-mic {
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: var(--hofas-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  transition: color 0.2s, background 0.2s;
  position: relative;
}
.hofas-chat-mic:hover {
  background: rgba(0,0,0,0.06);
}
.hofas-chat-mic svg {
  width: 22px;
  height: 22px;
  pointer-events: none;
}

.hofas-mic-listening {
  color: #e53e3e !important;
}
.hofas-mic-listening::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(229,62,62,0.15);
  animation: hofas-mic-pulse 1s ease-out infinite;
}

@keyframes hofas-mic-pulse {
  0%   { transform: scale(1);   opacity: 1; }
  100% { transform: scale(1.8); opacity: 0; }
}

.hofas-chat-send {
  margin-top: 0; 
  padding: 10px;
  background-color: var(--hofas-primary);
  color: white;
  border: none;
  border-radius: var(--hofas-radius);
  cursor: pointer;
  font-weight: 500;
}

.hofas-chat-char-counter {
  text-align: right;
  padding: 0 16px 8px;
  font-size: 12px;
  color: #666;
}

/* Animation für Mikrofon */
@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}

/* ---------------------------------------------
   HoFaS Zusatzstyles: Dokumente / Quellen / Actions
   (am Ende der bestehenden chat_widget.css anhängen)
---------------------------------------------- */

/* --- Documents --- */
.hofas-docs {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--hofas-border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.hofas-docs-title {
  font-size: 12px;
  font-weight: 600;
  color: #4b5563;
}
.hofas-doc-item {
  display: flex;
  align-items: center;
}
.hofas-doc-link {
  font-size: 13px;
  text-decoration: none;
  color: var(--hofas-primary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border: 1px solid var(--hofas-primary);
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.hofas-doc-link:hover {
  background: var(--hofas-primary);
  color: #fff;
  text-decoration: none;
}
.hofas-doc-link span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}

/* --- Sources (collapsible) --- */
.hofas-sources {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--hofas-border);
}
.hofas-sources-toggle {
  background: transparent;
  border: 1px solid var(--hofas-border);
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 12px;
  color: var(--hofas-text);
}
.hofas-sources-body {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hofas-source-item {
  font-size: 12px;
  color: #374151;
}
.hofas-source-head { font-weight: 600; }
.hofas-source-snip {
  margin-top: 3px;
  color: #6b7280;
  line-height: 1.35;
}

/* --- Actions --- */
.hofas-chat-actions {
  padding: 10px 16px;
  border-top: 1px solid var(--hofas-border);
  background: #fff;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.hofas-action-btn {
  padding: 10px 12px;
  background-color: var(--hofas-primary);
  color: white;
  border: none;
  border-radius: var(--hofas-radius);
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
}
.hofas-action-btn:disabled { opacity: 0.6; cursor: not-allowed; }


/* Actions: Container (nutzt schon .hofas-chat-actions) */
.hofas-chat-actions {
  padding: 10px 16px 14px;
  border-top: 1px solid var(--hofas-border);
  background: var(--hofas-bg);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Actions: Buttons */
.hofas-action-btn {
  border: 1px solid rgba(0,0,0,0.12);
  background: #fff;
  border-radius: 10px;
  padding: 9px 10px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  color: var(--hofas-text);
}

.hofas-action-btn:hover {
  border-color: rgba(0,0,0,0.2);
  transform: translateY(-1px);
}

.hofas-action-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Powered by HoFaS */
.hofas-powered-by {
  text-align: center;
  font-size: 11px;
  color: #9ca3af;
  padding: 4px 0 6px;
  border-top: 1px solid var(--hofas-border, #e5e7eb);
}
.hofas-powered-by a {
  color: #9ca3af;
  text-decoration: none;
  font-weight: 600;
}
.hofas-powered-by a:hover {
  color: var(--hofas-primary, #F5AC36);
  text-decoration: underline;
}
