/* ============================================================
   chatbot.css — Vaibhav's AI Assistant
   ============================================================ */

/* ── MASCOT ──────────────────────────────────────────────── */
#chat-mascot {
  position: fixed;
  bottom: 96px; right: 28px;
  width: 52px;
  z-index: 801;
  pointer-events: none;
  transition: opacity 0.4s, transform 0.4s;
}
#chat-mascot.hidden { opacity: 0; transform: scale(0.5) translateY(20px); }
#chat-mascot.peek   { animation: mascotPeek 2.5s var(--ease-out) forwards; }
@keyframes mascotPeek {
  0%   { transform: translateY(60px) scale(0.8); opacity: 0; }
  20%  { transform: translateY(0px)  scale(1.05); opacity: 1; }
  80%  { transform: translateY(0px)  scale(1);    opacity: 1; }
  100% { transform: translateY(60px) scale(0.8);  opacity: 0; }
}

/* ── FAB ─────────────────────────────────────────────────── */
#chat-fab {
  position: fixed;
  bottom: 32px; right: 32px;
  width: 58px; height: 58px;
  border-radius: 50%;
  background: var(--gold);
  border: none; cursor: none;
  z-index: 800;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 32px rgba(201,168,76,0.45), 0 2px 8px rgba(0,0,0,0.4);
  transition: transform 0.35s var(--ease-out), background 0.3s, box-shadow 0.35s;
  overflow: visible;
}
#chat-fab:hover { transform: scale(1.1); background: var(--gold-light); box-shadow: 0 12px 40px rgba(201,168,76,0.6); }
#chat-fab.active { background: var(--surface2); box-shadow: 0 8px 32px rgba(0,0,0,0.5); }
.chat-fab-icon { position: absolute; transition: transform 0.35s var(--ease-out), opacity 0.25s; }
.chat-fab-icon-open  { opacity: 1; transform: scale(1) rotate(0deg); }
.chat-fab-icon-close { opacity: 0; transform: scale(0.5) rotate(-90deg); }
#chat-fab.active .chat-fab-icon-open  { opacity: 0; transform: scale(0.5) rotate(90deg); }
#chat-fab.active .chat-fab-icon-close { opacity: 1; transform: scale(1) rotate(0deg); }

#chat-badge {
  position: absolute; top: -5px; right: -5px;
  width: 20px; height: 20px;
  background: #e05252; border-radius: 50%; border: 2px solid var(--black);
  display: none; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600; color: white;
  animation: badgePop 0.4s var(--ease-out) both, badgePulse 2.5s 0.4s ease-in-out infinite;
}
@keyframes badgePop   { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes badgePulse { 0%,100% { box-shadow: 0 0 0 0 rgba(224,82,82,0.5); } 50% { box-shadow: 0 0 0 7px rgba(224,82,82,0); } }

/* ── PANEL ───────────────────────────────────────────────── */
#chat-panel {
  position: fixed;
  bottom: 104px; right: 32px;
  width: 384px; height: 580px;
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 22px;
  display: flex; flex-direction: column;
  z-index: 799;
  box-shadow: 0 40px 100px rgba(0,0,0,0.7), 0 0 0 1px rgba(201,168,76,0.1), inset 0 1px 0 rgba(255,255,255,0.05);
  overflow: hidden;
  opacity: 0; transform: translateY(24px) scale(0.94);
  pointer-events: none; transform-origin: bottom right;
  transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out);
}
#chat-panel.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: all; }

/* ── HEADER ──────────────────────────────────────────────── */
.chat-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0; position: relative;
}
.chat-header::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, var(--gold), rgba(201,168,76,0.2), transparent);
}
.chat-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--gold-dim); border: 1.5px solid rgba(201,168,76,0.5);
  display: grid; place-items: center;
  font-family: 'Cormorant Garamond', serif; font-size: 17px; color: var(--gold);
  flex-shrink: 0; position: relative;
}
.chat-avatar::after {
  content: ''; position: absolute; inset: -4px; border-radius: 50%;
  border: 1.5px solid rgba(201,168,76,0.25);
  animation: avatarRing 3s ease-in-out infinite;
}
@keyframes avatarRing { 0%,100% { transform: scale(1); opacity: 0.5; } 50% { transform: scale(1.18); opacity: 0; } }
.chat-header-info { flex: 1; min-width: 0; }
.chat-header-name { font-size: 13.5px; font-weight: 500; color: var(--white); }
.chat-header-sub {
  font-size: 11px; color: var(--gold);
  font-family: 'DM Mono', monospace; letter-spacing: 0.06em;
  display: flex; align-items: center; gap: 5px; margin-top: 2px;
}
.chat-online-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #4ade80; box-shadow: 0 0 6px rgba(74,222,128,0.7);
  animation: onlinePulse 2s ease-in-out infinite;
}
@keyframes onlinePulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
#chat-close {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--border); color: var(--muted);
  font-size: 13px; display: grid; place-items: center;
  cursor: none; flex-shrink: 0; transition: all 0.2s;
}
#chat-close:hover { border-color: rgba(201,168,76,0.4); color: var(--gold); }

/* ── MESSAGES ────────────────────────────────────────────── */
#chat-messages {
  flex: 1; overflow-y: auto;
  padding: 16px 14px;
  display: flex; flex-direction: column; gap: 10px;
}
#chat-messages::-webkit-scrollbar { width: 2px; }
#chat-messages::-webkit-scrollbar-thumb { background: rgba(201,168,76,0.2); border-radius: 10px; }

.chat-msg {
  display: flex; flex-direction: column; max-width: 90%;
  animation: msgSlide 0.28s var(--ease-out) both;
}
@keyframes msgSlide { from { opacity: 0; transform: translateY(12px) scale(0.97); } to { opacity: 1; transform: none; } }
.chat-msg-user      { align-self: flex-end; }
.chat-msg-assistant { align-self: flex-start; }

.chat-bubble {
  padding: 11px 15px; border-radius: 18px;
  font-size: 13.5px; line-height: 1.65; font-weight: 300; word-break: break-word;
}
.chat-msg-user .chat-bubble {
  background: var(--gold); color: #0d0d0f; font-weight: 400;
  border-radius: 18px 18px 4px 18px;
}
.chat-msg-assistant .chat-bubble {
  background: var(--surface2); border: 1px solid rgba(255,255,255,0.07);
  color: var(--white); border-radius: 4px 18px 18px 18px;
}
.chat-msg-assistant .chat-bubble p { margin: 0 0 6px; }
.chat-msg-assistant .chat-bubble p:last-child { margin: 0; }
.chat-msg-assistant .chat-bubble strong { color: var(--gold-light); font-weight: 500; }
.chat-msg-assistant .chat-bubble ul { padding-left: 16px; margin: 5px 0; }
.chat-msg-assistant .chat-bubble li { margin-bottom: 3px; }

/* ── TYPING DOTS ─────────────────────────────────────────── */
.chat-typing-bubble { display: flex; align-items: center; gap: 5px; padding: 14px 18px; }
.chat-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); opacity: 0.45; animation: dotBounce 1.3s ease-in-out infinite; }
.chat-dot:nth-child(2) { animation-delay: 0.18s; }
.chat-dot:nth-child(3) { animation-delay: 0.36s; }
@keyframes dotBounce { 0%,60%,100% { transform: translateY(0); opacity: 0.35; } 30% { transform: translateY(-7px); opacity: 1; } }

/* ── FLOW CARDS ──────────────────────────────────────────── */
.flow-card {
  padding: 15px 17px;
  background: var(--surface2);
  border: 1px solid rgba(255,255,255,0.07);
  border-left: 2.5px solid var(--gold);
  border-radius: 4px 16px 16px 16px;
  font-size: 13.5px; line-height: 1.65;
  align-self: flex-start; width: 100%;
}
.flow-card-title { font-family: 'Cormorant Garamond', serif; font-size: 17px; font-weight: 400; color: var(--white); margin-bottom: 8px; }
.flow-card-body p { margin: 0 0 6px; color: var(--white); font-weight: 300; }
.flow-card-body p:last-child { margin: 0; }
.flow-card-body strong { color: var(--gold-light); font-weight: 500; }
.flow-hint { font-size: 11px !important; color: var(--muted2) !important; font-family: 'DM Mono', monospace; letter-spacing: 0.04em; margin-top: 8px !important; }
.flow-card-success { background: rgba(201,168,76,0.06); border-color: var(--gold); text-align: center; }
.flow-success-icon { font-size: 28px; color: var(--gold); display: block; margin-bottom: 10px; animation: successSpin 0.5s var(--ease-out); }
@keyframes successSpin { from { transform: scale(0) rotate(-180deg); opacity: 0; } to { transform: scale(1) rotate(0deg); opacity: 1; } }

/* ── SUGGESTIONS ─────────────────────────────────────────── */
.chat-suggestions { display: flex; flex-wrap: wrap; gap: 7px; padding: 2px 0; align-self: flex-start; }
.chat-chip {
  padding: 7px 13px; background: var(--surface2);
  border: 1px solid rgba(255,255,255,0.1); border-radius: 100px;
  font-size: 12px; color: var(--muted); cursor: none;
  font-family: 'DM Sans', sans-serif; transition: all 0.22s; text-align: left;
}
.chat-chip:hover { border-color: var(--gold); color: var(--gold); background: rgba(201,168,76,0.07); transform: translateY(-1px); }

/* ── ACTION CARD ─────────────────────────────────────────── */
.chat-action-card {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 15px; background: var(--gold-dim); border: 1px solid rgba(201,168,76,0.22);
  border-radius: 14px; align-self: flex-start; width: 100%;
  animation: msgSlide 0.3s var(--ease-out) both;
}
.chat-action-label { font-size: 13px; color: var(--white); font-weight: 300; }
.chat-action-btn {
  padding: 7px 15px; background: var(--gold); color: #0d0d0f;
  border-radius: 100px; font-size: 11.5px; font-weight: 500;
  cursor: none; white-space: nowrap; font-family: 'DM Sans', sans-serif;
  transition: background 0.22s, transform 0.22s; flex-shrink: 0;
}
.chat-action-btn:hover { background: var(--gold-light); transform: translateX(2px); }

/* ── INPUT AREA ──────────────────────────────────────────── */
.chat-footer { padding: 12px 14px 14px; border-top: 1px solid var(--border); background: var(--surface2); flex-shrink: 0; }
.chat-input-row { display: flex; gap: 9px; align-items: center; }
#chat-input {
  flex: 1; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 100px; padding: 10px 16px; color: var(--white);
  font-family: 'DM Sans', sans-serif; font-size: 13.5px; font-weight: 300; outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}
#chat-input::placeholder { color: var(--muted2); }
#chat-input:focus { border-color: rgba(201,168,76,0.45); box-shadow: 0 0 0 3px rgba(201,168,76,0.08); }
#chat-input:disabled { opacity: 0.5; }
#chat-send {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--gold); color: #0d0d0f; border: none; cursor: none;
  display: grid; place-items: center; flex-shrink: 0;
  transition: background 0.22s, transform 0.22s;
}
#chat-send:hover:not(:disabled) { background: var(--gold-light); transform: scale(1.08); }
#chat-send:disabled { opacity: 0.4; }
.chat-footer-note { text-align: center; font-size: 10px; color: var(--muted2); margin-top: 8px; font-family: 'DM Mono', monospace; letter-spacing: 0.05em; }
.chat-footer-note span { color: rgba(201,168,76,0.6); }

@media (max-width: 480px) {
  #chat-panel { right: 12px; left: 12px; width: auto; bottom: 90px; height: 70vh; border-radius: 18px; }
  #chat-fab  { bottom: 20px; right: 20px; }
  #chat-mascot { display: none; }
}
