/* =====================================================================
   CHATBOT WIDGET – SPEKTRUM Partner GmbH
   ===================================================================== */

/* Toggle Button */
.chatbot-toggle {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--white);
  border: none;
  cursor: pointer;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0,200,83,0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}
.chatbot-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(0,200,83,0.5);
}
.chatbot-toggle svg {
  width: 26px;
  height: 26px;
  transition: opacity 0.2s;
}
.chatbot-toggle .chatbot-icon-close { display: none; }
.chatbot-toggle.open .chatbot-icon-chat { display: none; }
.chatbot-toggle.open .chatbot-icon-close { display: block; }

/* Chat Panel */
.chatbot-panel {
  position: fixed;
  bottom: 5.5rem;
  right: 1.5rem;
  width: 380px;
  height: 500px;
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  z-index: 9999;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--font);
}
.chatbot-panel.open {
  display: flex;
}

/* Header */
.chatbot-header {
  background: var(--accent);
  color: var(--white);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.chatbot-header-title {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.chatbot-header-subtitle {
  font-size: 0.7rem;
  opacity: 0.4;
  margin-top: 2px;
}
.chatbot-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  padding: 4px;
  font-size: 1.2rem;
  line-height: 1;
  transition: color 0.2s;
}
.chatbot-close:hover {
  color: var(--white);
}

/* Messages Area */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.chatbot-messages::-webkit-scrollbar {
  width: 4px;
}
.chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.15);
  border-radius: 2px;
}

/* Message Bubbles */
.chatbot-msg {
  max-width: 85%;
  padding: 0.65rem 0.9rem;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.5;
  word-wrap: break-word;
}
.chatbot-msg a {
  color: inherit;
  text-decoration: underline;
}
.chatbot-msg-bot {
  align-self: flex-start;
  background: var(--light-gray);
  color: var(--primary);
  border-bottom-left-radius: 4px;
}
.chatbot-msg-user {
  align-self: flex-end;
  background: var(--accent);
  color: var(--white);
  border-bottom-right-radius: 4px;
}

/* Typing Indicator */
.chatbot-typing {
  align-self: flex-start;
  padding: 0.65rem 0.9rem;
  background: var(--light-gray);
  border-radius: 12px;
  border-bottom-left-radius: 4px;
  display: flex;
  gap: 4px;
  align-items: center;
}
.chatbot-typing span {
  width: 6px;
  height: 6px;
  background: rgba(0,0,0,0.3);
  border-radius: 50%;
  animation: chatbot-bounce 1.2s infinite;
}
.chatbot-typing span:nth-child(2) { animation-delay: 0.2s; }
.chatbot-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes chatbot-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-4px); }
}

/* Input Area */
.chatbot-input {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  gap: 0.5rem;
  flex-shrink: 0;
}
.chatbot-input input {
  flex: 1;
  border: none;
  outline: none;
  font-family: var(--font);
  font-size: 0.85rem;
  color: var(--primary);
  background: transparent;
}
.chatbot-input input::placeholder {
  color: var(--gray);
}
.chatbot-send {
  background: var(--accent);
  border: none;
  color: var(--white);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
  flex-shrink: 0;
}
.chatbot-send:hover {
  background: var(--accent-dark);
  transform: scale(1.05);
}
.chatbot-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}
.chatbot-send svg {
  width: 16px;
  height: 16px;
}

/* Powered by */
.chatbot-powered {
  text-align: center;
  padding: 0.4rem;
  font-size: 0.6rem;
  color: rgba(0,0,0,0.25);
  flex-shrink: 0;
}

/* =====================================================================
   RESPONSIVE
   ===================================================================== */
@media (max-width: 640px) {
  .chatbot-panel {
    bottom: 0;
    right: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
  }
  .chatbot-toggle {
    bottom: 1rem;
    right: 1rem;
    width: 48px;
    height: 48px;
  }
  .chatbot-toggle svg {
    width: 22px;
    height: 22px;
  }
}
