/* ==========================================================================
   De Slimme Gids — AI Assistent Widget
   Professionele chat interface die bezoekers naar de juiste content leidt
   ========================================================================== */

/* ─── CHAT TRIGGER BUTTON ────────────────────────────────────────── */
#dsg-chat-trigger {
  position: fixed;
  bottom: 1.75rem;
  right: 1.75rem;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5, #2563eb);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 20px rgba(79,70,229,0.35), 0 1px 3px rgba(0,0,0,0.3);
  z-index: 9000;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#dsg-chat-trigger:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(79,70,229,0.45), 0 1px 3px rgba(0,0,0,0.3);
}

#dsg-chat-trigger .chat-icon { transition: opacity 0.2s ease, transform 0.2s ease; }
#dsg-chat-trigger .close-icon { position: absolute; opacity: 0; transform: scale(0.5); transition: opacity 0.2s ease, transform 0.2s ease; }

#dsg-chat-trigger.is-open .chat-icon  { opacity: 0; transform: scale(0.5); }
#dsg-chat-trigger.is-open .close-icon { opacity: 1; transform: scale(1); }

/* Notification dot */
.chat-notif-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 10px;
  height: 10px;
  background: #10b981;
  border-radius: 50%;
  border: 2px solid #030712;
  animation: dotBlink 2.5s ease-in-out infinite;
}

@keyframes dotBlink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ─── CHAT PANEL ─────────────────────────────────────────────────── */
#dsg-chat-panel {
  position: fixed;
  bottom: calc(1.75rem + 60px);
  right: 1.75rem;
  width: 340px;
  height: 500px;
  background: #0d1117;
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 1.25rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 1px 0 rgba(255,255,255,0.06);
  z-index: 8999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

#dsg-chat-panel.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Chat Header */
.chat-header {
  padding: 1rem 1.1rem;
  background: #111827;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.chat-header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5, #2563eb);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
}

.chat-header-info { flex: 1; min-width: 0; }

.chat-header-name {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  color: #f9fafb;
  line-height: 1;
  margin-bottom: 0.2rem;
}

.chat-header-status {
  font-size: 0.72rem;
  color: #10b981;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.chat-header-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  display: block;
}

.chat-header-close {
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  padding: 4px;
  border-radius: 0.35rem;
  line-height: 0;
  transition: color 0.2s ease, background 0.2s ease;
}

.chat-header-close:hover {
  color: #f9fafb;
  background: rgba(255,255,255,0.06);
}

/* Messages Area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  scroll-behavior: smooth;
}

.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: 4px; }

/* Individual Message Bubbles */
.msg {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  animation: msgIn 0.3s ease forwards;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.msg.msg--bot { justify-content: flex-start; }
.msg.msg--user { justify-content: flex-end; }

.msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5, #2563eb);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.75rem;
}

.msg-bubble {
  max-width: 82%;
  padding: 0.6rem 0.85rem;
  border-radius: 1rem;
  font-size: 0.82rem;
  line-height: 1.55;
  word-break: break-word;
}

.msg--bot .msg-bubble {
  background: #1f2937;
  color: #d1d5db;
  border-radius: 0.25rem 1rem 1rem 1rem;
}

.msg--user .msg-bubble {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  color: white;
  border-radius: 1rem 1rem 0.25rem 1rem;
}

.msg-bubble a {
  color: #6ee7b7;
  text-decoration: none;
  font-weight: 600;
}

.msg-bubble a:hover { text-decoration: underline; }

/* Article suggestion card within message */
.msg-article-card {
  display: block;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 0.75rem;
  padding: 0.6rem 0.75rem;
  margin-top: 0.5rem;
  text-decoration: none;
  color: inherit;
  transition: background 0.2s ease;
}

.msg-article-card:hover { background: rgba(255,255,255,0.08); }

.msg-article-card-title {
  font-weight: 600;
  font-size: 0.8rem;
  color: #f3f4f6;
  margin-bottom: 0.2rem;
}

.msg-article-card-desc {
  font-size: 0.74rem;
  color: #9ca3af;
  line-height: 1.4;
}

.msg-article-card-link {
  font-size: 0.74rem;
  color: #818cf8;
  font-weight: 600;
  margin-top: 0.35rem;
  display: block;
}

/* Typing indicator */
.msg-typing .msg-bubble {
  background: #1f2937;
  padding: 0.6rem 1rem;
}

.typing-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6b7280;
  animation: typeDot 1.3s ease-in-out infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.18s; }
.typing-dots span:nth-child(3) { animation-delay: 0.36s; }

@keyframes typeDot {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40%            { transform: translateY(-5px); opacity: 1; }
}

/* Quick reply chips */
.chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0 1rem 0.75rem;
  flex-shrink: 0;
}

.chip {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 9999px;
  padding: 0.3rem 0.8rem;
  font-size: 0.75rem;
  color: #9ca3af;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
  font-family: 'Inter', sans-serif;
}

.chip:hover {
  background: rgba(79,70,229,0.15);
  border-color: rgba(79,70,229,0.4);
  color: #a5b4fc;
}

/* Input Area */
.chat-input-area {
  padding: 0.75rem 1rem;
  border-top: 1px solid rgba(255,255,255,0.07);
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
  background: #0d1117;
}

.chat-input {
  flex: 1;
  background: #1f2937;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 0.75rem;
  padding: 0.55rem 0.9rem;
  color: #f9fafb;
  font-size: 0.82rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.2s ease;
  resize: none;
}

.chat-input:focus {
  border-color: rgba(79,70,229,0.5);
}

.chat-input::placeholder { color: #4b5563; }

.chat-send-btn {
  width: 34px;
  height: 34px;
  border-radius: 0.65rem;
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
  transition: opacity 0.2s ease, transform 0.15s ease;
}

.chat-send-btn:hover  { opacity: 0.85; transform: scale(1.05); }
.chat-send-btn:active { transform: scale(0.95); }
.chat-send-btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

/* Mobile */
@media (max-width: 480px) {
  #dsg-chat-panel {
    right: 0.75rem;
    left: 0.75rem;
    width: auto;
    bottom: calc(1.25rem + 60px);
    height: 460px;
  }
  #dsg-chat-trigger {
    right: 1rem;
    bottom: 1rem;
  }
}
