/* ── PORTFOLIO CHATBOT ── uses the color variables from the page :root */
.chat-fab {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 150;
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.75rem 1.1rem; border-radius: 999px; border: 1px solid rgba(196,181,253,0.25);
  background: var(--accent-strong, #6a56e8); color: #fff;
  font: 600 0.9rem 'DM Sans', sans-serif; cursor: pointer;
  box-shadow: 0 10px 30px rgba(106,86,232,0.35);
  transition: background 0.2s, transform 0.2s;
}
.chat-fab:hover { background: var(--accent-strong-hover, #5a46d6); transform: translateY(-2px); }
.chat-fab:focus-visible, .chat-panel button:focus-visible, .chat-input:focus-visible { outline: 2px solid var(--accent3, #c4b5fd); outline-offset: 2px; }
.chat-fab svg { width: 20px; height: 20px; flex-shrink: 0; }
.chat-fab[aria-expanded="true"] { display: none; }

.chat-panel {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 150;
  width: min(380px, calc(100vw - 2rem)); height: min(560px, calc(100dvh - 6rem));
  display: flex; flex-direction: column;
  background: var(--bg2, #111118); color: var(--text, #e8e8f0);
  border: 1px solid rgba(196,181,253,0.18); border-radius: 18px; overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,0.55);
  font-family: 'DM Sans', sans-serif;
}
.chat-panel[hidden] { display: none; }

.chat-head {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.9rem 1rem; border-bottom: 1px solid var(--border, rgba(255,255,255,0.07));
  background: var(--violet-2, #171328);
}
.chat-head-text { flex: 1; min-width: 0; }
.chat-title { font: 700 1rem 'Syne', sans-serif; }
.chat-sub { font-size: 0.78rem; color: var(--text3, #9a9ab2); }
.chat-close {
  width: 34px; height: 34px; border-radius: 10px; border: none; cursor: pointer;
  background: transparent; color: var(--text2, #b8b8cc); font-size: 1.3rem; line-height: 1;
}
.chat-close:hover { background: rgba(255,255,255,0.06); color: #fff; }

.chat-log { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 0.6rem; }
.chat-msg { max-width: 88%; padding: 0.6rem 0.85rem; border-radius: 14px; font-size: 0.9rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-msg.bot { align-self: flex-start; background: var(--bg3, #16161f); border: 1px solid var(--border, rgba(255,255,255,0.07)); border-bottom-left-radius: 4px; }
.chat-msg.user { align-self: flex-end; background: var(--accent-strong, #6a56e8); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.error { color: #fca5a5; }
.chat-msg a { color: var(--accent3, #c4b5fd); text-decoration: underline; }
.chat-msg.user a { color: #fff; }
.chat-typing { display: inline-flex; gap: 4px; }
.chat-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--text3, #9a9ab2); animation: chatDot 1s infinite ease-in-out; }
.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chatDot { 0%, 80%, 100% { opacity: 0.3; } 40% { opacity: 1; } }

.chat-suggestions { display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0 1rem 0.75rem; }
.chat-suggestions[hidden] { display: none; }
.chat-chip {
  padding: 0.35rem 0.7rem; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(196,181,253,0.3); background: transparent; color: var(--accent3, #c4b5fd);
  font: 500 0.8rem 'DM Sans', sans-serif;
}
.chat-chip:hover { background: rgba(124,106,247,0.12); }

.chat-form { display: flex; gap: 0.5rem; padding: 0.75rem; border-top: 1px solid var(--border, rgba(255,255,255,0.07)); }
.chat-input {
  flex: 1; min-width: 0; padding: 0.65rem 0.8rem; border-radius: 12px;
  border: 1px solid var(--border, rgba(255,255,255,0.07)); background: var(--bg, #0a0a0f); color: var(--text, #e8e8f0);
  font: 400 0.9rem 'DM Sans', sans-serif;
}
.chat-send {
  width: 42px; border-radius: 12px; border: none; cursor: pointer;
  background: var(--accent-strong, #6a56e8); color: #fff; display: grid; place-items: center;
}
.chat-send:hover { background: var(--accent-strong-hover, #5a46d6); }
.chat-send:disabled { opacity: 0.5; cursor: default; }
.chat-send svg { width: 18px; height: 18px; }
.chat-note { padding: 0 0.9rem 0.6rem; font-size: 0.7rem; color: var(--text3, #9a9ab2); text-align: center; }

@media (max-width: 480px) {
  .chat-fab { right: 1rem; bottom: 1rem; padding: 0.8rem; }
  .chat-fab-label { display: none; }
  .chat-panel { right: 0; bottom: 0; width: 100vw; height: 100dvh; border-radius: 0; border: none; }
}
@media (prefers-reduced-motion: reduce) {
  .chat-typing span { animation: none; opacity: 0.7; }
}
