/* ═══════════════════════════════════════
   AI Chatbot Widget
═══════════════════════════════════════ */

/* ── Toggle Button ── */
#sw-chat-btn {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 5000;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--white);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.1);
  transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

#sw-chat-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.2);
}

#sw-chat-btn svg { width: 24px; height: 24px; transition: all 0.3s; }
#sw-chat-btn .icon-chat { display: block; }
#sw-chat-btn .icon-close { display: none; }
#sw-chat-btn.open .icon-chat { display: none; }
#sw-chat-btn.open .icon-close { display: block; }

#sw-chat-btn .chat-notif {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 16px;
  height: 16px;
  background: #e05a5a;
  border-radius: 50%;
  border: 2px solid var(--black);
  font-size: 9px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

/* ── Chat Window ── */
#sw-chat-window {
  position: fixed;
  bottom: 100px;
  right: 32px;
  z-index: 4999;
  width: 380px;
  max-height: 600px;
  background: rgba(2, 2, 6, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 24px;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.04);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.23, 1, 0.32, 1);
  backdrop-filter: blur(20px);
}

#sw-chat-window.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

/* ── Header ── */
.sw-chat-header {
  padding: 20px 22px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.sw-chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sw-chat-avatar svg { width: 18px; height: 18px; stroke: var(--white); fill: none; stroke-width: 1.5; }
.sw-chat-info { flex: 1; }
.sw-chat-name { font-size: 14px; font-weight: 500; color: var(--white); margin-bottom: 2px; }

.sw-chat-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--steel);
}

.sw-chat-dot {
  width: 6px;
  height: 6px;
  background: #4ade80;
  border-radius: 50%;
  animation: pulse-dot 2s infinite;
}

.sw-chat-close {
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.sw-chat-close:hover { background: rgba(255, 255, 255, 0.07); }
.sw-chat-close svg { width: 14px; height: 14px; stroke: var(--steel); fill: none; stroke-width: 2; }

/* ── Messages ── */
.sw-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 200px;
  max-height: 380px;
}

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

.sw-msg { display: flex; flex-direction: column; gap: 4px; max-width: 88%; }
.sw-msg.user { align-self: flex-end; align-items: flex-end; }
.sw-msg.bot { align-self: flex-start; align-items: flex-start; }

.sw-msg-bubble {
  padding: 11px 15px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.6;
  word-break: break-word;
}

.sw-msg.bot .sw-msg-bubble {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--steel-light);
  border-radius: 4px 16px 16px 16px;
}

.sw-msg.user .sw-msg-bubble {
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--white);
  border-radius: 16px 4px 16px 16px;
}

.sw-msg-time { font-size: 10px; color: var(--steel); opacity: 0.6; padding: 0 4px; }

/* ── Typing indicator ── */
.sw-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 15px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 4px 16px 16px 16px;
  width: fit-content;
}

.sw-typing span {
  width: 5px;
  height: 5px;
  background: var(--steel);
  border-radius: 50%;
  animation: sw-bounce 1.2s infinite;
}

.sw-typing span:nth-child(2) { animation-delay: 0.2s; }
.sw-typing span:nth-child(3) { animation-delay: 0.4s; }

/* ── Quick replies ── */
.sw-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 18px 14px;
}

.sw-qr {
  padding: 6px 13px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 100px;
  font-size: 11px;
  color: var(--steel-light);
  background: none;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-body);
}

.sw-qr:hover {
  border-color: rgba(255, 255, 255, 0.28);
  color: var(--white);
  background: rgba(255, 255, 255, 0.05);
}

/* ── Input area ── */
.sw-chat-input-area {
  padding: 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.sw-chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--white);
  outline: none;
  font-family: var(--font-body);
  resize: none;
  max-height: 90px;
  transition: border-color 0.2s;
  line-height: 1.5;
}

.sw-chat-input::placeholder { color: var(--steel); }
.sw-chat-input:focus { border-color: rgba(255, 255, 255, 0.22); }

.sw-chat-send {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--white);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
  align-self: flex-end;
}

.sw-chat-send:hover { background: rgba(255, 255, 255, 0.85); transform: scale(1.05); }
.sw-chat-send:disabled { opacity: 0.4; cursor: default; transform: none; }
.sw-chat-send svg { width: 15px; height: 15px; stroke: var(--black); fill: none; stroke-width: 2.2; }
