/* ============================================
   RENOVIERUNG-RATGEBER.DE — Chatbot Widget
   KI-Renovierungsberater (Ollama)
   ============================================ */

/* FLOATING BUTTON */
.rr-chat-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: var(--primary, #2B6CB0);
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(43, 108, 176, .35), 0 2px 8px rgba(0,0,0,.12);
  transition: transform .25s cubic-bezier(.16,1,.3,1), box-shadow .25s ease;
  line-height: 1;
}
.rr-chat-toggle:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 6px 28px rgba(43, 108, 176, .45), 0 4px 12px rgba(0,0,0,.15);
}
.rr-chat-toggle.rr-open {
  transform: rotate(90deg) scale(.9);
}

/* CHAT PANEL */
.rr-chat-panel {
  position: fixed;
  bottom: 100px;
  right: 24px;
  z-index: 9999;
  width: 370px;
  height: 520px;
  max-height: calc(100dvh - 130px);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 48px rgba(0,0,0,.15), 0 4px 16px rgba(0,0,0,.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(.96);
  transition: opacity .3s ease, transform .3s cubic-bezier(.16,1,.3,1), visibility .3s;
  font-family: var(--font, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
}
.rr-chat-panel.rr-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* HEADER */
.rr-chat-header {
  background: linear-gradient(135deg, #1E4F82, #2B6CB0);
  color: #fff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.rr-chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.rr-chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.rr-chat-header-text h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  line-height: 1.2;
}
.rr-chat-header-text span {
  font-size: 11px;
  opacity: .72;
  font-weight: 400;
  line-height: 1.2;
}
.rr-chat-close {
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
  flex-shrink: 0;
}
.rr-chat-close:hover {
  background: rgba(255,255,255,.3);
}

/* MESSAGES AREA */
.rr-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #F7F8FA;
  scroll-behavior: smooth;
}
.rr-chat-messages::-webkit-scrollbar {
  width: 5px;
}
.rr-chat-messages::-webkit-scrollbar-thumb {
  background: #D1D5DB;
  border-radius: 3px;
}

/* BUBBLES */
.rr-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  word-wrap: break-word;
  animation: rr-bubble-in .25s ease;
}
@keyframes rr-bubble-in {
  from { opacity: 0; transform: translateY(8px) scale(.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.rr-msg-bot {
  align-self: flex-start;
  background: #fff;
  color: #1A1D23;
  border: 1px solid #E5E7EB;
  border-bottom-left-radius: 4px;
}
.rr-msg-user {
  align-self: flex-end;
  background: #2B6CB0;
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* TYPING INDICATOR */
.rr-typing {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}
.rr-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9CA3AF;
  animation: rr-bounce .6s infinite alternate;
}
.rr-typing-dot:nth-child(2) { animation-delay: .15s; }
.rr-typing-dot:nth-child(3) { animation-delay: .3s; }
@keyframes rr-bounce {
  from { transform: translateY(0); opacity: .4; }
  to   { transform: translateY(-5px); opacity: 1; }
}

/* INPUT AREA */
.rr-chat-input-wrap {
  padding: 12px 14px;
  background: #fff;
  border-top: 1px solid #E5E7EB;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}
.rr-chat-input {
  flex: 1;
  border: 1.5px solid #D1D5DB;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.4;
  resize: none;
  outline: none;
  max-height: 80px;
  background: #FAFBFC;
  color: #1A1D23;
  transition: border-color .2s;
}
.rr-chat-input::placeholder {
  color: #9CA3AF;
}
.rr-chat-input:focus {
  border-color: #2B6CB0;
  background: #fff;
}
.rr-chat-send {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: none;
  background: #2B6CB0;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .2s, transform .15s;
}
.rr-chat-send:hover {
  background: #1E4F82;
  transform: scale(1.05);
}
.rr-chat-send:disabled {
  background: #D1D5DB;
  cursor: not-allowed;
  transform: none;
}

/* WELCOME MESSAGE */
.rr-welcome {
  text-align: center;
  padding: 20px 12px;
}
.rr-welcome-icon {
  font-size: 36px;
  margin-bottom: 8px;
}
.rr-welcome h4 {
  font-size: 15px;
  font-weight: 700;
  color: #1A1D23;
  margin-bottom: 4px;
}
.rr-welcome p {
  font-size: 13px;
  color: #4B5563;
  line-height: 1.5;
}
.rr-suggestions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 14px;
}
.rr-suggestion {
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 13px;
  color: #2B6CB0;
  cursor: pointer;
  text-align: left;
  transition: background .15s, border-color .15s;
}
.rr-suggestion:hover {
  background: #EBF4FF;
  border-color: #2B6CB0;
}

/* POWERED BY */
.rr-chat-footer {
  text-align: center;
  padding: 6px;
  font-size: 10px;
  color: #9CA3AF;
  background: #fff;
  flex-shrink: 0;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 480px) {
  .rr-chat-panel {
    width: calc(100vw - 16px);
    height: calc(100dvh - 80px);
    max-height: none;
    bottom: 8px;
    right: 8px;
    border-radius: 14px;
  }
  .rr-chat-toggle {
    bottom: 16px;
    right: 16px;
    width: 54px;
    height: 54px;
    font-size: 24px;
  }
}
