/* ============================================================
   EOWA Hüter-Chat — Widget Styles
   ============================================================ */

/* ---- Floating Action Button ---- */
.chat-fab {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid rgba(79, 195, 247, 0.4);
  background: rgba(10, 10, 30, 0.9);
  color: #4fc3f7;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 24px rgba(79, 195, 247, 0.2), 0 0 40px rgba(79, 195, 247, 0.05);
  z-index: 9998;
  transition: all 0.3s ease;
  animation: chat-fab-pulse 3s ease-in-out infinite;
}

.chat-fab:hover {
  border-color: rgba(79, 195, 247, 0.7);
  box-shadow: 0 4px 32px rgba(79, 195, 247, 0.35);
  transform: scale(1.08);
}

.chat-fab-hidden {
  transform: scale(0);
  opacity: 0;
  pointer-events: none;
}

@keyframes chat-fab-pulse {
  0%, 100% { box-shadow: 0 4px 24px rgba(79, 195, 247, 0.2), 0 0 40px rgba(79, 195, 247, 0.05); }
  50% { box-shadow: 0 4px 32px rgba(79, 195, 247, 0.35), 0 0 60px rgba(79, 195, 247, 0.1); }
}

/* ---- Chat-Fenster ---- */
.chat-window {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 380px;
  max-width: calc(100vw - 2rem);
  height: 540px;
  max-height: calc(100vh - 3rem);
  border-radius: 16px;
  border: 1px solid rgba(79, 195, 247, 0.2);
  background: rgba(8, 8, 24, 0.97);
  backdrop-filter: blur(20px);
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.6), 0 0 40px rgba(79, 195, 247, 0.05);
  display: flex;
  flex-direction: column;
  z-index: 9999;
  overflow: hidden;
  transition: all 0.3s ease;
  transform-origin: bottom right;
}

.chat-window.chat-hidden {
  transform: scale(0.8);
  opacity: 0;
  pointer-events: none;
}

/* ---- Header ---- */
.chat-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
  flex-shrink: 0;
}

.chat-header-title {
  flex: 1;
  font-weight: 600;
  font-size: 0.95rem;
  color: #e0e0e0;
}

.chat-back-btn,
.chat-close-btn {
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  padding: 0.3rem;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
  font-size: 1.3rem;
  line-height: 1;
}

.chat-back-btn:hover,
.chat-close-btn:hover {
  color: #e0e0e0;
  background: rgba(255, 255, 255, 0.06);
}

/* ---- Hüter-Auswahl ---- */
.chat-guardian-select {
  flex: 1;
  overflow-y: auto;
  padding: 0.8rem;
}

.chat-select-intro {
  text-align: center;
  color: #888;
  font-size: 0.85rem;
  margin-bottom: 0.8rem;
}

.chat-guardian-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.chat-guardian-btn {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  color: #d0d0d0;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.chat-guardian-btn:hover {
  border-color: var(--g-color, #4fc3f7);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 2px 12px rgba(79, 195, 247, 0.08);
}

.chat-guardian-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.chat-guardian-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.chat-guardian-info strong {
  font-size: 0.9rem;
  color: #e0e0e0;
}

.chat-guardian-info small {
  font-size: 0.75rem;
  color: #888;
}

/* ---- Nachrichten ---- */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.chat-msg {
  display: flex;
  max-width: 85%;
}

.chat-msg-user {
  align-self: flex-end;
}

.chat-msg-assistant {
  align-self: flex-start;
}

.chat-msg-bubble {
  padding: 0.6rem 0.9rem;
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.5;
  word-wrap: break-word;
}

.chat-msg-user .chat-msg-bubble {
  background: rgba(79, 195, 247, 0.15);
  color: #e0e0e0;
  border: 1px solid rgba(79, 195, 247, 0.2);
  border-bottom-right-radius: 4px;
}

.chat-msg-assistant .chat-msg-bubble {
  background: rgba(255, 255, 255, 0.04);
  color: #d0d0d0;
  border: 1px solid var(--msg-color, rgba(255, 255, 255, 0.08));
  border-bottom-left-radius: 4px;
}

/* ---- Lade-Animation ---- */
.chat-dots span {
  display: inline-block;
  animation: chat-dot-bounce 1.4s infinite ease-in-out;
  font-size: 1.2rem;
  color: var(--msg-color, #888);
}

.chat-dots span:nth-child(2) { animation-delay: 0.16s; }
.chat-dots span:nth-child(3) { animation-delay: 0.32s; }

@keyframes chat-dot-bounce {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-4px); }
}

/* ---- Eingabebereich ---- */
.chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.7rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 0.55rem 0.8rem;
  color: #e0e0e0;
  font-size: 0.88rem;
  font-family: inherit;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
  max-height: 80px;
}

.chat-input:focus {
  border-color: rgba(79, 195, 247, 0.4);
}

.chat-input::placeholder {
  color: #666;
}

.chat-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid rgba(79, 195, 247, 0.3);
  background: rgba(79, 195, 247, 0.1);
  color: #4fc3f7;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.chat-send-btn:hover {
  background: rgba(79, 195, 247, 0.2);
  border-color: rgba(79, 195, 247, 0.5);
}

/* ---- Erwachungs-Nachricht ---- */
.chat-awakening-msg {
  background: rgba(79, 195, 247, 0.06) !important;
  border-color: rgba(79, 195, 247, 0.2) !important;
}

.chat-cf-link {
  display: inline-block;
  padding: 0.4rem 1rem;
  border-radius: 20px;
  background: rgba(79, 195, 247, 0.15);
  color: #4fc3f7 !important;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  transition: background 0.2s;
  cursor: pointer;
}

.chat-cf-link:hover {
  background: rgba(79, 195, 247, 0.25);
}

/* ---- Hilfklassen ---- */
.chat-hidden {
  display: none !important;
}

/* Spezialbehandlung für chat-window */
.chat-window.chat-hidden {
  display: flex !important;
  transform: scale(0.8);
  opacity: 0;
  pointer-events: none;
}

/* ---- Responsiv ---- */
@media (max-width: 480px) {
  .chat-window {
    bottom: 0;
    right: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    border: none;
  }

  .chat-fab {
    bottom: 1rem;
    right: 1rem;
    width: 52px;
    height: 52px;
  }
}
