/* ── CHAT FAB ── */
#chat-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FF6B35, #FFB347);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(255,107,53,.4);
  z-index: 1000;
  transition: all .25s;
}
#chat-fab:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(255,107,53,.5); }
#chat-fab.active { background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow); }

/* ── CHAT PANEL ── */
#chat-panel {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: 380px;
  max-height: 520px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0,0,0,.5);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(20px) scale(.95);
  pointer-events: none;
  transition: all .25s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}
#chat-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ── CHAT HEADER ── */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.chat-header-left { display: flex; align-items: center; gap: 10px; }
.chat-avatar { width: 36px; height: 36px; border-radius: 50%; overflow: hidden; flex-shrink: 0; }
.chat-name { font-weight: 600; font-size: .9rem; }
.chat-status { font-size: .72rem; color: var(--green); }
.chat-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all .15s;
}
.chat-close:hover { background: var(--surface); color: var(--text); }

/* ── MESSAGES ── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 300px;
  max-height: 360px;
}

.chat-msg {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.chat-msg.user { flex-direction: row-reverse; }

.chat-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}
.chat-msg-avatar svg { width: 28px; height: 28px; }

.chat-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: .85rem;
  line-height: 1.5;
  word-break: break-word;
}
.chat-bubble.bot {
  background: var(--card);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  color: var(--text);
}
.chat-bubble.user {
  background: linear-gradient(135deg, #FF6B35, #ff8f5e);
  border-bottom-right-radius: 4px;
  color: #fff;
}

/* ── TYPING INDICATOR ── */
.chat-bubble.typing {
  display: flex;
  gap: 4px;
  padding: 14px 18px;
}
.chat-bubble.typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: typingBounce .6s ease-in-out infinite;
}
.chat-bubble.typing span:nth-child(2) { animation-delay: .15s; }
.chat-bubble.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
}

/* ── INPUT ── */
.chat-input-wrap {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--card);
}
#chat-input {
  flex: 1;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: .85rem;
  outline: none;
  transition: border .2s;
}
#chat-input:focus { border-color: var(--accent); }
#chat-input::placeholder { color: var(--muted); }

.chat-send {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .15s;
  flex-shrink: 0;
}
.chat-send:hover { background: #ff5520; }

/* ── MOBILE ── */
@media(max-width: 480px) {
  #chat-panel {
    width: calc(100vw - 24px);
    right: 12px;
    bottom: 80px;
    max-height: 70vh;
  }
}
