/* ============================================================
   chatbot.css — Floating chatbot widget
   Inherits all tokens from tokens.css
   ============================================================ */

/* ── Wrapper ── */
#chatbot
{
  position: fixed;
  bottom: 60px;
  right: 50px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

/* ─────────────────────────────────────────
   TRIGGER BUTTON
───────────────────────────────────────── */
#chat-trigger {
  position: relative;
  width: 55px;
  height: 55px;
  border-radius: 50%;
  background: #1e1e1e;
  border: 1.5px solid rgba(255, 214, 10, 0.45);
  cursor: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
  box-shadow: 0 0 0 0 rgba(255, 214, 10, 0);
}

#chat-trigger:hover {
  border-color: var(--c-gold-1);
  transform: scale(1.06);
  box-shadow: 0 0 18px 4px rgba(255, 214, 10, 0.2);
}

/* Terminal glyph inside button */
.chat-trigger-icon {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--c-gold-1);
  letter-spacing: -0.05em;
  line-height: 1;
  user-select: none;
  transition: opacity 0.2s ease;
  position: relative;
  z-index: 1;
}

/* Close glyph — hidden by default */
.chat-close-icon {
  font-family: var(--font);
  font-size: 18px;
  font-weight: 300;
  color: var(--c-gold-1);
  line-height: 1;
  user-select: none;
  position: absolute;
  opacity: 0;
  transform: rotate(-90deg) scale(0.6);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Swap icons when open */
#chatbot.open .chat-trigger-icon {
  opacity: 0;
}

#chatbot.open .chat-close-icon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* Orbit ring — same mechanic as the avatar ring */
.chat-orbit {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1px solid rgba(255, 214, 10, 0.15);
  animation: chat-spin 8s linear infinite;
  pointer-events: none;
}

.chat-orbit::before {
  content: '';
  position: absolute;
  width: 5px;
  height: 5px;
  background: var(--c-gold-1);
  border-radius: 50%;
  top: 50%;
  left: -2.5px;
  transform: translateY(-50%);
  box-shadow: 0 0 6px 2px rgba(255, 214, 10, 0.6);
}

@keyframes chat-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Pause orbit when panel is open */
#chatbot.open .chat-orbit {
  animation-play-state: paused;
}

/* Idle pulse ring — breathes outward when closed */
.chat-pulse {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1px solid rgba(255, 214, 10, 0.12);
  animation: chat-pulse 2.8s ease-out infinite;
  pointer-events: none;
}

@keyframes chat-pulse {
  0%   { transform: scale(1);    opacity: 0.6; }
  70%  { transform: scale(1.45); opacity: 0; }
  100% { transform: scale(1.45); opacity: 0; }
}

#chatbot.open .chat-pulse {
  animation: none;
  opacity: 0;
}

/* Notification dot — shown before first open */
.chat-notify {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  background: var(--c-gold-1);
  border-radius: 50%;
  border: 1.5px solid #171717;
  animation: notify-pop 0.4s ease 1.5s both;
  z-index: 2;
}

@keyframes notify-pop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

#chatbot.open .chat-notify,
#chatbot.seen .chat-notify {
  display: none;
}

/* ─────────────────────────────────────────
   CHAT PANEL
───────────────────────────────────────── */
#chat-panel {
  width: 320px;
  height: 420px;
  background: rgba(18, 18, 18, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 214, 10, 0.14);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;

  /* Hidden state */
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  transform-origin: bottom right;
  pointer-events: none;
  transition:
    opacity 0.28s cubic-bezier(0.34, 1.56, 0.64, 1),
    transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

/* ── Panel header ── */
.chat-header {
  padding: 16px 18px 14px;
  border-bottom: 1px solid rgba(255, 214, 10, 0.08);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.chat-header-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(255, 214, 10, 0.3);
  object-fit: cover;
  flex-shrink: 0;
}

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

.chat-header-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text-1);
  line-height: 1.2;
}

.chat-header-status {
  font-size: 11px;
  color: var(--c-text-3);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 1px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  animation: status-breathe 2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes status-breathe {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ── Message area ── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

/* Hide scrollbar but keep scroll */
.chat-messages::-webkit-scrollbar { width: 3px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 214, 10, 0.15);
  border-radius: 3px;
}

/* ── Message bubbles ── */
.msg {
  max-width: 85%;
  font-size: 13px;
  line-height: 1.5;
  padding: 9px 13px;
  border-radius: 14px;
  animation: msg-in 0.22s ease both;
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Bot message */
.msg.bot {
  background: rgba(255, 214, 10, 0.06);
  border: 1px solid rgba(255, 214, 10, 0.1);
  color: var(--c-text-2);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}

/* User message */
.msg.user {
  background: rgba(255, 214, 10, 0.12);
  border: 1px solid rgba(255, 214, 10, 0.2);
  color: var(--c-text-1);
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

/* Quick-reply chips */
.chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 14px 10px;
  flex-shrink: 0;
}

.chip {
  font-size: 11px;
  font-weight: 500;
  padding: 5px 11px;
  border-radius: 980px;
  border: 1px solid rgba(255, 214, 10, 0.25);
  color: var(--c-gold-1);
  background: transparent;
  cursor: none;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
  white-space: nowrap;
}

.chip:hover {
  background: rgba(255, 214, 10, 0.1);
  border-color: rgba(255, 214, 10, 0.5);
  transform: translateY(-1px);
}

/* ── Typing indicator ── */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 9px 13px;
  background: rgba(255, 214, 10, 0.06);
  border: 1px solid rgba(255, 214, 10, 0.1);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  animation: msg-in 0.22s ease both;
}

.typing-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--c-gold-1);
  opacity: 0.4;
}

/* Phase-shift wave — not a basic bounce */
.typing-dot:nth-child(1) { animation: type-wave 1.1s ease-in-out infinite 0s; }
.typing-dot:nth-child(2) { animation: type-wave 1.1s ease-in-out infinite 0.18s; }
.typing-dot:nth-child(3) { animation: type-wave 1.1s ease-in-out infinite 0.36s; }

@keyframes type-wave {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.35; }
  30%            { transform: translateY(-5px); opacity: 1; }
}

/* ── Input row ── */
.chat-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(255, 214, 10, 0.08);
  flex-shrink: 0;
}

#chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 214, 10, 0.15);
  border-radius: 10px;
  padding: 8px 12px;
  font-family: var(--font);
  font-size: 13px;
  color: var(--c-text-1);
  outline: none;
  resize: none;
  transition: border-color 0.2s ease;
  line-height: 1.4;
}

#chat-input::placeholder {
  color: var(--c-text-3);
}

#chat-input:focus {
  border-color: rgba(255, 214, 10, 0.4);
}

#chat-send {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 214, 10, 0.12);
  border: 1px solid rgba(255, 214, 10, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: none;
  flex-shrink: 0;
  transition: background 0.2s ease, transform 0.15s ease;
}

#chat-send:hover {
  background: rgba(255, 214, 10, 0.22);
  transform: scale(1.08);
}

#chat-send svg {
  width: 14px;
  height: 14px;
  stroke: var(--c-gold-1);
  fill: none;
}

/* ── Mobile ── */
@media (max-width: 768px) {
  #chatbot {
    bottom: 20px;
    right: 16px;
  }

  #chat-panel {
    width: calc(100vw - 32px);
    height: 380px;
  }

  #chat-trigger {
    cursor: auto;
  }

  .chip {
    cursor: auto;
  }

  #chat-send {
    cursor: auto;
  }
}
