/* ================================================================
   PUSHPAKBOT 2.0 — Dark Finance Chat UI
   Classes: cb-msg, cb-bot, cb-user, cb-typing, cb-chips, cb-chip
================================================================ */

/* ── TOGGLE BUTTON ── */
#chatbot-container {
  position: fixed;
  bottom: 28px;
  left: 24px;
  z-index: 9000;
  font-family: 'Inter', 'Segoe UI', sans-serif;
}

#chatbot-toggle {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 1.5px solid rgba(201,168,76,0.45);
  background: #0E1013;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.6), 0 0 0 0 rgba(201,168,76,0.3);
  transition: all 0.3s ease;
  animation: cbPulse 3s ease-in-out infinite;
}

@keyframes cbPulse {
  0%,100% { box-shadow: 0 4px 20px rgba(0,0,0,0.6), 0 0 0 0   rgba(201,168,76,0.25); }
  50%     { box-shadow: 0 4px 20px rgba(0,0,0,0.6), 0 0 0 10px rgba(201,168,76,0);    }
}

#chatbot-toggle:hover {
  border-color: rgba(201,168,76,0.85);
  transform: scale(1.07);
}

#chatbot-toggle img {
  width: 30px; height: 30px;
  object-fit: contain; pointer-events: none;
}

/* ── CHAT WINDOW ── */
#chatbot {
  width: 340px;
  max-height: 520px;
  position: absolute;
  left: 0;
  bottom: 66px;
  display: none;
  flex-direction: column;
  background: #0A0B0E;
  border: 1px solid rgba(201,168,76,0.22);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,0.85), inset 0 1px 0 rgba(201,168,76,0.07);
  animation: cbPop 0.3s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes cbPop {
  from { transform: translateY(20px) scale(0.93); opacity: 0; }
  to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

/* ── HEADER ── */
#chat-header {
  padding: 12px 14px;
  background: linear-gradient(135deg, #0E1013 0%, #13151A 100%);
  border-bottom: 1px solid rgba(201,168,76,0.14);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.chat-title {
  display: flex; flex-direction: column; gap: 2px;
}

.chat-title strong {
  font-size: 13px; font-weight: 700;
  color: #F0EBE0;
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.03em;
}

.chat-title .status {
  font-size: 10px; color: #4CAF50;
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.1em;
  animation: statusBlink 2.5s ease-in-out infinite;
}

@keyframes statusBlink {
  0%,100% { opacity: 1; }
  50%     { opacity: 0.5; }
}

.chat-actions { display: flex; gap: 6px; }

#theme-toggle, #chat-close {
  width: 28px; height: 28px;
  border: 1px solid rgba(201,168,76,0.2);
  border-radius: 50%;
  background: rgba(201,168,76,0.07);
  color: #9A8870; font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease;
}

#theme-toggle:hover, #chat-close:hover {
  background: rgba(201,168,76,0.18);
  border-color: rgba(201,168,76,0.5);
  color: #C9A84C;
}

/* ── BODY ── */
#chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #08090B;
  scrollbar-width: thin;
  scrollbar-color: rgba(201,168,76,0.18) transparent;
}

#chat-body::-webkit-scrollbar       { width: 3px; }
#chat-body::-webkit-scrollbar-thumb { background: rgba(201,168,76,0.2); border-radius: 2px; }

/* ── MESSAGES ── */
.cb-msg {
  max-width: 88%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 12.5px;
  line-height: 1.65;
  animation: cbMsgIn 0.22s ease-out;
  word-break: break-word;
}

@keyframes cbMsgIn {
  from { transform: translateY(7px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}

.cb-user {
  align-self: flex-end;
  background: linear-gradient(135deg, #C9A84C, #A8873A);
  color: #08090B;
  border-bottom-right-radius: 4px;
  font-weight: 500;
}

.cb-bot {
  align-self: flex-start;
  background: #13151A;
  color: #D4CCBE;
  border: 1px solid rgba(201,168,76,0.11);
  border-bottom-left-radius: 4px;
}

.cb-bot b  { color: #F0EBE0; font-weight: 600; }
.cb-bot a  { color: #C9A84C; text-decoration: underline; }
.cb-bot a:hover { color: #E2C97A; }

/* ── TYPING INDICATOR ── */
.cb-typing {
  padding: 12px 16px !important;
  display: flex !important;
  align-items: center;
  gap: 5px;
  background: #13151A !important;
}

.cb-typing span {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #C9A84C;
  animation: cbDot 1.2s infinite ease-in-out;
}
.cb-typing span:nth-child(2) { animation-delay: 0.2s; }
.cb-typing span:nth-child(3) { animation-delay: 0.4s; }

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

/* ── CHIPS ── */
.cb-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 2px 0 4px;
  align-self: flex-start;
  max-width: 100%;
}

.cb-chip {
  padding: 5px 12px;
  font-size: 11px;
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.04em;
  border-radius: 20px;
  border: 1px solid rgba(201,168,76,0.3);
  background: rgba(201,168,76,0.07);
  color: #C9A84C;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.cb-chip:hover {
  background: rgba(201,168,76,0.18);
  border-color: rgba(201,168,76,0.65);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(201,168,76,0.15);
}

/* ── FOOTER ── */
#chat-footer {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: #0E1013;
  border-top: 1px solid rgba(201,168,76,0.1);
  flex-shrink: 0;
}

#chat-input {
  flex: 1;
  padding: 9px 13px;
  font-size: 12.5px;
  font-family: 'Inter', sans-serif;
  border-radius: 10px;
  border: 1px solid rgba(201,168,76,0.15);
  background: #13151A;
  color: #F0EBE0;
  outline: none;
  transition: border-color 0.2s ease;
}

#chat-input::placeholder { color: #3A352C; }
#chat-input:focus        { border-color: rgba(201,168,76,0.42); }

#chat-send {
  width: 36px; height: 36px;
  border-radius: 10px;
  border: none;
  background: #C9A84C;
  color: #08090B;
  font-size: 15px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

#chat-send:hover { background: #E2C97A; transform: scale(1.06); }

/* ── DARK MODE (body.cb-dark) ── */
body.cb-dark #chatbot   { background: #040509; }
body.cb-dark #chat-body { background: #040509; }
body.cb-dark .cb-bot    { background: #09090E; border-color: rgba(201,168,76,0.07); }

/* ── MOBILE ── */
@media (max-width: 600px) {
  #chatbot {
    width:  calc(100vw - 20px);
    max-height: 72vh;
    left:   -8px;
    bottom: 64px;
    border-radius: 14px;
  }
  #chatbot-container { bottom: 16px; left: 10px; }
  .cb-chip  { font-size: 10px; padding: 4px 9px; }
  .cb-msg   { font-size: 12px; }
}
