/* Basis-Styles für das Chat-Widget */
:root {
  --whz-primary-color: #2e5bff;
  /* Fallback */
  --whz-font-family: 'Segoe UI', Arial, sans-serif;
  --whz-font-size: 14px;
}

#whz-247-chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 350px;
  max-height: 600px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 5px 40px rgba(0, 0, 0, 0.16);
  font-family: var(--whz-font-family);
  font-size: var(--whz-font-size);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.3s ease;
}

#whz-247-chat-header {
  /* Reverted to standard values, will be overridden by theme */
  background: transparent;
  color: inherit;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#whz-247-chat-header-info {
  display: flex;
  flex-direction: column;
}

#whz-247-chat-header-info span {
  font-weight: 600;
  font-size: 1.1em;
}

#whz-247-chat-active-chatters {
  font-size: 0.85em;
  opacity: 0.9;
  margin-top: 4px;
}

.whz-247-chatter-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #4caf50;
  border-radius: 50%;
  margin-right: 6px;
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3);
}

#whz-247-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

#whz-247-chat-profile {
  background: transparent;
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 5px;
  opacity: 0.8;
  transition: opacity 0.2s;
}

#whz-247-chat-profile:hover {
  opacity: 1;
}

#whz-247-chat-close {
  background: transparent;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
  padding: 0 5px;
}

#whz-247-chat-messages {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  background: #f9f9f9;
  min-height: 250px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Nachrichten Bubbles */
.whz-247-chat-msg {
  display: flex;
  align-items: flex-end;
  max-width: 85%;
}

.whz-247-chat-msg-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.whz-247-chat-msg-agent {
  align-self: flex-start;
}

.whz-chat-bubble {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 1em;
  line-height: 1.4;
  word-wrap: break-word;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.whz-247-chat-msg-user .whz-chat-bubble {
  background: var(--whz-primary-color);
  color: var(--whz-text-color, white);
  border-bottom-right-radius: 2px;
}

.whz-247-chat-msg-agent .whz-chat-bubble {
  background: #fff;
  color: #333;
  border-bottom-left-radius: 2px;
  border: 1px solid #e0e0e0;
}

.whz-247-chat-msg.system {
  align-self: center;
  max-width: 90%;
}

.whz-247-chat-msg.system .whz-chat-bubble {
  background: #f0f0f0;
  color: #666;
  font-style: italic;
  font-size: 0.9em;
  text-align: center;
  border: none;
}

.whz-chat-avatar {
  width: 28px;
  height: 28px;
  background: #ddd;
  border-radius: 50%;
  margin-right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #555;
  flex-shrink: 0;
}

#whz-247-chat-input {
  display: flex;
  align-items: center;
  border-top: 1px solid #eee;
  background: #fff;
  padding: 10px;
}

#whz-attachment-btn {
  font-size: 20px;
  cursor: pointer;
  margin-right: 10px;
  color: #888;
  user-select: none;
}

#whz-attachment-btn:hover {
  color: var(--whz-primary-color);
}

#whz-247-chat-input textarea {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 10px 15px;
  resize: none;
  font-family: inherit;
  font-size: 1em;
  outline: none;
  margin-right: 8px;
  min-height: 42px;
  max-height: 120px;
}

#whz-247-chat-input button {
  background: var(--whz-primary-color);
  color: #fff;
  border: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  transition: transform 0.2s;
}

#whz-247-chat-input button:hover {
  transform: scale(1.05);
}

/* Senden Icon via CSS (Simple Arrow) */
#whz-247-chat-input button::after {
  content: "➤";
  font-size: 16px;
  margin-left: -2px;
}

/* Reopen floating button */
#whz-chat-reopen-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--whz-primary-color, #2e5bff);
  color: white;
  border: none;
  font-size: 28px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 99998;
  transition: transform 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

#whz-chat-reopen-btn:hover {
  transform: scale(1.1);
}

/* System notice in chat */
.whz-chat-system-notice {
  background: #f0f0f0;
  border-left: 4px solid #ff9800;
  padding: 15px;
  margin: 10px 0;
  border-radius: 4px;
  text-align: center;
  align-self: stretch;
  max-width: 100%;
}

.whz-chat-system-notice strong {
  display: block;
  margin-bottom: 8px;
  color: #333;
  font-size: 1em;
}

.whz-chat-system-notice p {
  margin: 0;
  color: #666;
  font-size: 0.9em;
}

/* Systeminfo-Leiste (v3.2.1) */
#whz-247-chat-notice {
  padding: 10px 15px;
  font-size: 13px;
  line-height: 1.4;
  display: none;
  animation: whzSlideDown 0.3s ease-out;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

#whz-247-chat-notice.whz-notice-error {
  background: #fff0f0;
  color: #d32f2f;
  border-left: 4px solid #d32f2f;
}

#whz-247-chat-notice.whz-notice-success {
  background: #f0fff4;
  color: #38a169;
  border-left: 4px solid #38a169;
}

#whz-247-chat-notice.whz-notice-info {
  background: #ebf8ff;
  color: #3182ce;
  border-left: 4px solid #3182ce;
}

@keyframes whzSlideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}