/* ============================================================
   GoChinaBudget — AI Chat widget
   Floating "Ask Me" button + slide-up panel
   ============================================================ */

.gcb-chat-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 90;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--accent, #00ff88);
  color: var(--accent-ink, #000);
  border: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: 0 10px 30px rgba(0, 255, 136, 0.28);
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.gcb-chat-fab:hover { transform: translateY(-2px) scale(1.05); box-shadow: 0 14px 36px rgba(0, 255, 136, 0.36); }
.gcb-chat-fab:active { transform: translateY(0); }
.gcb-chat-fab .pulse {
  position: absolute;
  top: -2px; right: -2px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #ff3366;
  box-shadow: 0 0 0 0 rgba(255, 51, 102, 0.6);
  animation: gcb-pulse 1.6s infinite;
}
@keyframes gcb-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255, 51, 102, 0.6); }
  70%  { box-shadow: 0 0 0 12px rgba(255, 51, 102, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 51, 102, 0); }
}

.gcb-chat-panel {
  position: fixed;
  right: 20px;
  bottom: 96px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 540px;
  max-height: calc(100vh - 130px);
  background: var(--bg-card, #111);
  color: var(--text-primary, #fff);
  border: 1px solid var(--border-strong, rgba(255,255,255,0.16));
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  z-index: 91;
  overflow: hidden;
  transform: translateY(20px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: transform 200ms cubic-bezier(0.2, 0.9, 0.3, 1.2), opacity 160ms ease;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.gcb-chat-panel.is-open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.gcb-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
  background: linear-gradient(180deg, rgba(0,255,136,0.08), transparent);
}
.gcb-chat-head-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.gcb-chat-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent, #00ff88);
  color: var(--accent-ink, #000);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px;
  flex-shrink: 0;
}
.gcb-chat-title { display: flex; flex-direction: column; min-width: 0; }
.gcb-chat-title b { font-size: 14px; line-height: 1.1; }
.gcb-chat-title small { color: var(--text-muted, #6b7280); font-size: 11px; }
.gcb-chat-close {
  background: transparent;
  border: 0;
  color: var(--text-secondary, #9ca3af);
  font-size: 22px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.gcb-chat-close:hover { color: var(--text-primary, #fff); }

.gcb-chat-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.gcb-chat-body::-webkit-scrollbar { width: 6px; }
.gcb-chat-body::-webkit-scrollbar-thumb { background: var(--border-strong, rgba(255,255,255,0.16)); border-radius: 3px; }

.gcb-msg {
  max-width: 86%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.gcb-msg.user {
  align-self: flex-end;
  background: var(--accent, #00ff88);
  color: var(--accent-ink, #000);
  border-bottom-right-radius: 4px;
}
.gcb-msg.assistant {
  align-self: flex-start;
  background: var(--bg-elev, #1a1a1a);
  color: var(--text-primary, #fff);
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-bottom-left-radius: 4px;
}
.gcb-msg.assistant b { color: var(--accent, #00ff88); }
.gcb-msg.error {
  align-self: flex-start;
  background: rgba(255, 51, 102, 0.1);
  border: 1px solid rgba(255, 51, 102, 0.3);
  color: #ff7088;
  font-size: 13px;
}

.gcb-msg-meta {
  font-size: 10px;
  color: var(--text-muted, #6b7280);
  margin-top: 2px;
  padding: 0 4px;
}
.gcb-msg-meta.user { align-self: flex-end; }

.gcb-typing {
  align-self: flex-start;
  display: inline-flex;
  gap: 4px;
  padding: 12px 14px;
  background: var(--bg-elev, #1a1a1a);
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 12px;
  border-bottom-left-radius: 4px;
}
.gcb-typing span {
  width: 6px; height: 6px;
  background: var(--text-muted, #6b7280);
  border-radius: 50%;
  animation: gcb-typing-bounce 1.2s infinite;
}
.gcb-typing span:nth-child(2) { animation-delay: 0.15s; }
.gcb-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes gcb-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.gcb-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 16px 4px;
}
.gcb-quick button {
  background: var(--bg-elev, #1a1a1a);
  border: 1px solid var(--border-strong, rgba(255,255,255,0.16));
  color: var(--text-secondary, #9ca3af);
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  transition: color 120ms ease, border-color 120ms ease;
}
.gcb-quick button:hover { color: var(--accent, #00ff88); border-color: var(--accent, #00ff88); }

.gcb-chat-foot {
  border-top: 1px solid var(--border, rgba(255,255,255,0.08));
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  align-items: end;
  background: var(--bg-card, #111);
}
.gcb-chat-input {
  flex: 1 1 auto;
  min-width: 0;
  resize: none;
  background: var(--bg-elev, #1a1a1a);
  color: var(--text-primary, #fff);
  border: 1px solid var(--border-strong, rgba(255,255,255,0.16));
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
  max-height: 120px;
  outline: none;
  font-family: inherit;
}
.gcb-chat-input:focus { border-color: var(--accent, #00ff88); }
.gcb-chat-send {
  background: var(--accent, #00ff88);
  color: var(--accent-ink, #000);
  border: 0;
  border-radius: 10px;
  width: 40px;
  height: 40px;
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  transition: background 120ms ease;
}
.gcb-chat-send:hover { background: #33ff9f; }
.gcb-chat-send:disabled { background: var(--text-muted, #6b7280); cursor: not-allowed; }

.gcb-foot-note {
  font-size: 10px;
  color: var(--text-muted, #6b7280);
  padding: 6px 12px 8px;
  text-align: center;
  border-top: 1px solid var(--border, rgba(255,255,255,0.04));
}

@media (max-width: 480px) {
  .gcb-chat-panel { right: 12px; left: 12px; width: auto; }
  .gcb-chat-fab { right: 12px; bottom: 12px; }
}
