/* DigiSinergy Chatbot Widget */
#dgs-chat-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 99999;
  font-family: Inter, -apple-system, sans-serif;
}

/* Bubble */
#dgs-chat-bubble {
  width: 56px; height: 56px; border-radius: 50%;
  background: #534AB7; color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: 0 4px 20px rgba(83,74,183,0.4);
  transition: transform 0.2s, opacity 0.3s;
  position: relative; border: none;
}
#dgs-chat-bubble:hover { transform: scale(1.08); }
#dgs-chat-bubble.hidden { opacity: 0; pointer-events: none; transform: scale(0.8); }

#dgs-chat-badge {
  position: absolute; top: -4px; right: -4px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #ef4444; color: #fff;
  font-size: 11px; font-weight: 700;
  align-items: center; justify-content: center;
  border: 2px solid #fff;
}

/* Window */
#dgs-chat-window {
  position: absolute; bottom: 68px; right: 0;
  width: 360px; height: 520px; max-height: 80vh;
  background: #fff; border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  display: none; flex-direction: column; overflow: hidden;
  animation: dgs-slide-up 0.2s ease;
}
#dgs-chat-window.open { display: flex; }
@keyframes dgs-slide-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Header */
#dgs-chat-header {
  background: #021022; color: #fff;
  padding: 14px 16px; display: flex;
  align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
#dgs-chat-header-info { display: flex; align-items: center; gap: 10px; }
#dgs-chat-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: #534AB7; display: flex;
  align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex-shrink: 0;
}
#dgs-chat-title    { font-size: 14px; font-weight: 600; line-height: 1.3; }
#dgs-chat-subtitle { font-size: 11px; color: #94a3b8; }
#dgs-chat-close {
  background: none; border: none; color: #94a3b8;
  font-size: 18px; cursor: pointer; padding: 0;
  line-height: 1; transition: color 0.15s;
}
#dgs-chat-close:hover { color: #fff; }

/* Messages */
#dgs-chat-messages {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  scroll-behavior: smooth;
}
.dgs-msg {
  max-width: 82%; padding: 10px 14px;
  border-radius: 14px; font-size: 14px;
  line-height: 1.55; word-break: break-word;
}
.dgs-msg-user {
  background: #534AB7; color: #fff;
  align-self: flex-end; border-bottom-right-radius: 4px;
}
.dgs-msg-assistant {
  background: #f1f5f9; color: #1a1a2e;
  align-self: flex-start; border-bottom-left-radius: 4px;
}
.dgs-msg-lead-ok {
  background: #d1fae5; color: #065f46;
  align-self: flex-start; border-bottom-left-radius: 4px;
  font-size: 13px;
}

/* Typing indicator */
.dgs-typing {
  display: flex; gap: 5px; align-items: center;
  padding: 12px 16px !important;
}
.dgs-typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: #94a3b8; animation: dgs-bounce 1.2s infinite;
  display: inline-block;
}
.dgs-typing span:nth-child(2) { animation-delay: 0.2s; }
.dgs-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dgs-bounce {
  0%,60%,100% { transform: translateY(0); }
  30%          { transform: translateY(-6px); }
}

/* Input area */
#dgs-chat-input-area {
  display: flex; gap: 8px; padding: 12px 16px;
  border-top: 1px solid #e2e8f0; flex-shrink: 0;
}
#dgs-chat-input {
  flex: 1; border: 1px solid #e2e8f0; border-radius: 8px;
  padding: 9px 12px; font-size: 14px; outline: none;
  font-family: inherit; transition: border-color 0.15s;
}
#dgs-chat-input:focus { border-color: #534AB7; }
#dgs-chat-send {
  width: 38px; height: 38px; border-radius: 8px;
  background: #534AB7; color: #fff; border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; transition: background 0.15s;
}
#dgs-chat-send:hover    { background: #3f389a; }
#dgs-chat-send:disabled { background: #cbd5e1; cursor: not-allowed; }

/* Mobile */
@media (max-width: 480px) {
  #dgs-chat-container { bottom: 16px; right: 16px; }
  #dgs-chat-window    { width: calc(100vw - 32px); right: -8px; bottom: 72px; }
}
