/* ═══════════════════════════════════════════════════════
   Axe Arena – Chatbot Widget Styles
   Dark theme matching plugin aesthetic
═══════════════════════════════════════════════════════ */

#axe-chatbot-root {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
}

/* ── Launch Button ── */
#axe-chat-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--axe-chat-primary, #FF6B35);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 20px rgba(255, 107, 53, 0.45), 0 2px 8px rgba(0,0,0,.3);
  transition: transform .2s cubic-bezier(.34,1.56,.64,1), box-shadow .2s;
  position: relative;
  outline: none;
}
#axe-chat-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(255, 107, 53, 0.55), 0 3px 12px rgba(0,0,0,.35);
}
#axe-chat-btn:active { transform: scale(0.97); }

.axe-chat-btn-icon { display: flex; align-items: center; justify-content: center; }

.axe-chat-unread-dot {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 14px;
  height: 14px;
  background: #ef4444;
  border: 2px solid #fff;
  border-radius: 50%;
  animation: axe-pulse 2s ease-in-out infinite;
}
@keyframes axe-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.2); opacity: .8; }
}

/* ── Chat Window ── */
.axe-chat-window {
  position: absolute;
  bottom: 70px;
  right: 0;
  width: 360px;
  max-height: 560px;
  background: #12141f;
  border: 1px solid rgba(255,107,53,.25);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5), 0 4px 20px rgba(255,107,53,.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  animation: axe-chat-open .25s cubic-bezier(.34,1.56,.64,1);
}
@keyframes axe-chat-open {
  from { opacity: 0; transform: scale(.85) translateY(12px); }
  to   { opacity: 1; transform: scale(1)   translateY(0); }
}

/* ── Header ── */
.axe-chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #1a1d2e 0%, #111320 100%);
  border-bottom: 1px solid rgba(255,107,53,.2);
  flex-shrink: 0;
}
.axe-chat-header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FF6B35, #FFB347);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}
.axe-chat-header-info { flex: 1; min-width: 0; }
.axe-chat-header-name {
  font-weight: 700;
  font-size: .92rem;
  color: #E8EAF0;
  letter-spacing: .02em;
}
.axe-chat-header-status {
  font-size: .74rem;
  color: #7B8099;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 1px;
}
.axe-chat-status-dot {
  width: 7px;
  height: 7px;
  background: #10B981;
  border-radius: 50%;
  flex-shrink: 0;
}
.axe-chat-header-close {
  background: none;
  border: none;
  color: #7B8099;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: color .15s, background .15s;
}
.axe-chat-header-close:hover { color: #E8EAF0; background: rgba(255,255,255,.07); }

/* ── Messages ── */
.axe-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.axe-chat-messages::-webkit-scrollbar { width: 4px; }
.axe-chat-messages::-webkit-scrollbar-track { background: transparent; }
.axe-chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

/* Bubbles */
.axe-msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  animation: axe-msg-in .2s ease-out;
}
@keyframes axe-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.axe-msg.bot  { align-self: flex-start; align-items: flex-start; }
.axe-msg.user { align-self: flex-end;   align-items: flex-end; }

.axe-msg-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: .875rem;
  line-height: 1.55;
  word-break: break-word;
}
.axe-msg.bot  .axe-msg-bubble {
  background: #1e2133;
  color: #D0D3E8;
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(255,255,255,.06);
}
.axe-msg.user .axe-msg-bubble {
  background: linear-gradient(135deg, #FF6B35, #FF8C5A);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Markdown-lite rendering */
.axe-msg-bubble strong { font-weight: 700; color: inherit; }
.axe-msg.bot .axe-msg-bubble strong { color: #FFB347; }
.axe-msg-bubble em    { font-style: italic; }
.axe-msg-bubble a     { color: #FFB347; text-decoration: underline; }

.axe-msg-time {
  font-size: .68rem;
  color: #4a4f6b;
  margin-top: 3px;
  padding: 0 2px;
}

/* Typing indicator */
.axe-typing-bubble {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: #1e2133;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  width: fit-content;
  border: 1px solid rgba(255,255,255,.06);
}
.axe-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #7B8099;
  animation: axe-typing 1.2s ease-in-out infinite;
}
.axe-typing-dot:nth-child(2) { animation-delay: .15s; }
.axe-typing-dot:nth-child(3) { animation-delay: .30s; }
@keyframes axe-typing {
  0%, 60%, 100% { transform: translateY(0);   opacity: .4; }
  30%            { transform: translateY(-5px); opacity: 1; }
}

/* ── Quick Replies ── */
.axe-chat-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 14px;
  border-top: 1px solid rgba(255,255,255,.05);
  background: #0f1117;
}
.axe-quick-btn {
  background: rgba(255,107,53,.1);
  border: 1px solid rgba(255,107,53,.3);
  color: #FFB347;
  border-radius: 20px;
  padding: 5px 12px;
  font-size: .75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.axe-quick-btn:hover {
  background: rgba(255,107,53,.2);
  border-color: rgba(255,107,53,.6);
  color: #fff;
  transform: translateY(-1px);
}

/* ── Input Area ── */
.axe-chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  background: #0f1117;
  border-top: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.axe-chat-input {
  flex: 1;
  background: #1e2133;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 12px;
  /* Hardcoded white — guaranteed visible on dark background */
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  font-size: .875rem;
  padding: 9px 13px;
  resize: none;
  outline: none;
  font-family: inherit;
  line-height: 1.4;
  max-height: 100px;
  transition: border-color .15s, background .15s;
  caret-color: #FF6B35;
}
.axe-chat-input::placeholder {
  color: rgba(255,255,255,0.38) !important;
  -webkit-text-fill-color: rgba(255,255,255,0.38) !important;
}
.axe-chat-input:focus {
  border-color: rgba(255,107,53,.6);
  background: #252840;
  outline: none;
}
.axe-chat-input:focus::placeholder {
  color: rgba(255,255,255,0.22) !important;
  -webkit-text-fill-color: rgba(255,255,255,0.22) !important;
}
/* Override any browser autofill colour that can turn text dark */
.axe-chat-input:-webkit-autofill,
.axe-chat-input:-webkit-autofill:focus {
  -webkit-text-fill-color: #ffffff !important;
  -webkit-box-shadow: 0 0 0 1000px #252840 inset !important;
  caret-color: #FF6B35;
}

.axe-chat-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FF6B35, #FFB347);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform .15s, box-shadow .15s;
  box-shadow: 0 2px 8px rgba(255,107,53,.4);
}
.axe-chat-send:hover  { transform: scale(1.08); box-shadow: 0 3px 12px rgba(255,107,53,.55); }
.axe-chat-send:active { transform: scale(0.95); }
.axe-chat-send:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ── Footer ── */
.axe-chat-footer {
  text-align: center;
  font-size: .68rem;
  color: #3a3f56;
  padding: 5px 0 7px;
  background: #0f1117;
  flex-shrink: 0;
}
.axe-chat-footer a { color: #FF6B35; text-decoration: none; }
.axe-chat-footer a:hover { text-decoration: underline; }

/* ── Responsive ── */
@media (max-width: 420px) {
  #axe-chatbot-root { bottom: 14px; right: 14px; }
  .axe-chat-window { width: calc(100vw - 28px); right: 0; }
}
