/* Grundlegende Stile */
:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --bg-color: #ffffff;
  --text-color: #1f2937;
  --border-color: #e5e7eb;
  --bot-bg: #f3f4f6;
  --user-bg: #2563eb;
  --user-text: #ffffff;
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --radius: 12px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  line-height: 1.5;
  color: var(--text-color);
}

/* Chatbot-Toggle-Button */
.chatbot-toggle {
  position: fixed;
  bottom: 100px;
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: var(--primary-color);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 1000;
}

.chatbot-toggle:hover,
.chatbot-toggle:focus {
  background-color: var(--primary-hover);
  transform: scale(1.05);
}

/* Chatbot-Container */
.chatbot-container {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 380px;
  height: 600px;
  background-color: var(--bg-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 999;
}

.chatbot-container.open {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

/* Chatbot-Header */
.chatbot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background-color: var(--primary-color);
  color: white;
}

.chatbot-title {
  font-size: 18px;
  font-weight: 600;
}

.chatbot-close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.chatbot-close:hover,
.chatbot-close:focus {
  background-color: rgba(255, 255, 255, 0.2);
}

/* Nachrichtenbereich */
.chatbot-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Nachrichten-Stile */
.message {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: var(--radius);
  line-height: 1.4;
  word-wrap: break-word;
}

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

.message.user {
  align-self: flex-end;
  background-color: var(--user-bg);
  color: var(--user-text);
  border-bottom-right-radius: 4px;
}

.message-time {
  font-size: 12px;
  opacity: 0.7;
  margin-top: 4px;
}

/* Eingabebereich */
.chatbot-input-container {
  display: flex;
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  gap: 8px;
}

.chatbot-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 24px;
  outline: none;
  font-size: 14px;
  transition: border-color 0.2s;
}

.chatbot-input:focus {
  border-color: var(--primary-color);
}

.chatbot-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--primary-color);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.chatbot-send:hover,
.chatbot-send:focus {
  background-color: var(--primary-hover);
}

/* Schnellantwort-Buttons */
.chatbot-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 20px 16px;
}

.quick-reply {
  padding: 8px 12px;
  background-color: var(--bot-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.quick-reply:hover,
.quick-reply:focus {
  background-color: var(--primary-color);
  color: white;
}

/* Lade-Animation */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background-color: var(--bot-bg);
  border-radius: var(--radius);
  align-self: flex-start;
  max-width: 60px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background-color: #9ca3af;
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
  animation-delay: -0.32s;
}
.typing-dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typing {
  0%,
  80%,
  100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Responsive Design */
@media (max-width: 480px) {
  .chatbot-container {
    width: calc(100vw - 40px);
    height: 70vh;
    right: 20px;
    left: 20px;
  }

  .message {
    max-width: 90%;
  }
}

/* Barrierefreiheit: Fokus-Stile */
.chatbot-toggle:focus,
.chatbot-close:focus,
.chatbot-send:focus,
.quick-reply:focus,
.chatbot-input:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Reduzierte Bewegung für Nutzer mit entsprechender Einstellung */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Hoher Kontrast für bessere Lesbarkeit */
@media (prefers-contrast: high) {
  :root {
    --border-color: #000000;
    --bot-bg: #f0f0f0;
  }
}
