/* ══════════════════════════════════════
   DITOSIS CHATBOT — Shared Styles
══════════════════════════════════════ */

/* ══ Chat Toggle Button ══ */
.chat-toggle {
  position: fixed !important;
  bottom: 28px;
  right: 28px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #00F5A0, #00D9F5);
  color: #000;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(0, 245, 160, 0.35);
  z-index: 99998;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: chat-toggle-in 0.5s cubic-bezier(.22,1,.36,1) 1s both;
}
@keyframes chat-toggle-in {
  from { opacity: 0; transform: scale(0.5) translateY(20px); }
  to   { opacity: 1; transform: scale(1)   translateY(0); }
}
.chat-toggle:hover { transform: scale(1.08); box-shadow: 0 12px 40px rgba(0, 245, 160, 0.5); }
.chat-toggle:active { transform: scale(0.96); }

.chat-unread {
  position: absolute; top: -4px; right: -4px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #ef4444; color: #fff;
  font-size: .65rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg-primary);
  font-family: var(--font-primary);
}
.chat-unread.hidden { display: none; }

/* ══ Chat Window ══ */
.chat-window {
  position: fixed !important;
  bottom: 96px; right: 28px;
  width: 380px; max-height: 580px;
  background: var(--bg-card);
  border: 1px solid var(--border-secondary);
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0,0,0,.6), 0 0 0 1px rgba(0,245,160,.06);
  display: flex; flex-direction: column;
  z-index: 99997; overflow: hidden;
  transform: translateY(16px) scale(0.97);
  opacity: 0; pointer-events: none;
  transition: all 0.25s cubic-bezier(.22,1,.36,1);
}
.chat-window.open { transform: translateY(0) scale(1); opacity: 1; pointer-events: all; }
.chat-window.open .chat-messages,
.chat-window.open .chat-suggestions,
.chat-window.open .chat-input-area {
  animation: chat-content-in 0.35s ease 0.1s both;
}
.chat-window.open .chat-suggestions { animation-delay: 0.15s; }
.chat-window.open .chat-input-area  { animation-delay: 0.2s; }
@keyframes chat-content-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ══ Header ══ */
.chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-primary);
  flex-shrink: 0;
}
.chat-header-left { display: flex; align-items: center; gap: 12px; }
.chat-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--bg-tertiary);
  border: 1px solid rgba(0,245,160,.25);
  display: flex; align-items: center; justify-content: center;
}
.chat-name { font-size: .9rem; font-weight: 700; display: block; }
.chat-status { display: flex; align-items: center; gap: 5px; font-size: .72rem; color: var(--text-tertiary); }
.chat-status-dot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 6px #22c55e; animation: pulse-dot 2s infinite; }
.chat-header-actions { display: flex; align-items: center; gap: 6px; }
.chat-clear-btn, .chat-close-btn {
  width: 28px; height: 28px; border-radius: 8px; border: none;
  background: transparent; color: var(--text-tertiary); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s ease;
}
.chat-clear-btn:hover, .chat-close-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }

/* ══ Messages ══ */
.chat-messages {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border-primary); border-radius: 2px; }

.chat-msg { display: flex; gap: 8px; max-width: 100%; animation: chat-msg-in 0.3s ease both; }
.chat-msg.user { flex-direction: row-reverse; }
@keyframes chat-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.chat-bubble {
  max-width: 82%; padding: 10px 14px; border-radius: 14px;
  font-size: .85rem; line-height: 1.6; word-break: break-word;
}
.chat-msg.bot .chat-bubble {
  background: var(--bg-tertiary); border: 1px solid var(--border-primary);
  color: var(--text-primary); border-bottom-left-radius: 4px;
}
.chat-msg.user .chat-bubble {
  background: linear-gradient(135deg, #00F5A0, #00D9F5);
  color: #000; font-weight: 500; border-bottom-right-radius: 4px;
}
.chat-msg-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg-tertiary); border: 1px solid var(--border-primary);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 2px;
}
.chat-msg.user .chat-msg-avatar {
  background: rgba(0,245,160,.15); border-color: rgba(0,245,160,.3);
  font-size: .65rem; font-weight: 800; color: var(--accent-primary);
}
.chat-timestamp {
  font-size: .65rem; color: var(--text-muted);
  margin-top: 4px; padding: 0 4px; display: block;
}
.chat-msg.user .chat-timestamp { text-align: right; }

/* Typing indicator */
.chat-typing { display: flex; align-items: center; gap: 4px; padding: 12px 14px; }
.chat-typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-tertiary);
  animation: typing-bounce 1.2s ease-in-out infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ══ Suggestions ══ */
.chat-suggestions {
  padding: 0 12px 10px;
  display: flex; flex-wrap: wrap; gap: 6px; flex-shrink: 0;
}
.chat-suggestion {
  padding: 6px 12px; border-radius: 100px;
  border: 1px solid var(--border-secondary);
  background: var(--bg-tertiary); color: var(--text-secondary);
  font-size: .75rem; font-family: var(--font-primary);
  cursor: pointer; transition: all 0.15s ease; white-space: nowrap;
}
.chat-suggestion:hover {
  border-color: rgba(0,245,160,.35);
  background: rgba(0,245,160,.08); color: var(--accent-primary);
}
.chat-suggestions.hidden { display: none; }

/* ══ Input area ══ */
.chat-input-area {
  padding: 12px 14px 10px;
  border-top: 1px solid var(--border-primary); flex-shrink: 0;
}
.chat-input-row {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--bg-tertiary); border: 1px solid var(--border-primary);
  border-radius: 12px; padding: 8px 8px 8px 14px;
  transition: border-color 0.15s ease;
}
.chat-input-row:focus-within { border-color: rgba(0,245,160,.4); }
.chat-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text-primary); font-size: .875rem; font-family: var(--font-primary);
  resize: none; max-height: 100px; line-height: 1.5;
}
.chat-input::placeholder { color: var(--text-muted); }
.chat-send-btn {
  width: 34px; height: 34px; border-radius: 8px; border: none;
  background: linear-gradient(135deg, #00F5A0, #00D9F5); color: #000;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: opacity 0.15s ease, transform 0.15s ease; flex-shrink: 0;
}
.chat-send-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.chat-send-btn:not(:disabled):hover { transform: scale(1.08); }
.chat-footer-note { font-size: .68rem; color: var(--text-muted); text-align: center; margin-top: 8px; }
.chat-footer-note a { color: var(--accent-primary); }

@media (max-width: 480px) {
  .chat-window { right: 12px; left: 12px; width: auto; bottom: 88px; }
  .chat-toggle { right: 16px; bottom: 20px; }
}