/* ============================================
   EVERLINE CHATBOT — push drawer side panel
   ============================================ */

:root {
  --cb-bg:       #0d0d0d;
  --cb-surface:  #1a1a1a;
  --cb-border:   rgba(255, 255, 255, 0.08);
  --cb-text:     #e0e0e0;
  --cb-muted:    #777;
  --cb-dim:      #555;
  --cb-accent:   #C8F03E;
  --cb-radius:   14px;
  --cb-width:    520px;
}

/* ── Page content wrapper (pushes left when chat opens) */
#pageContent {
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
body.chatbot-open #pageContent {
  transform: translateX(-280px);
}

/* ── Nav shifts left too (it's outside #pageContent) */
#mainNav,
.nav-overlay,
.nav-mobile {
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
body.chatbot-open #mainNav,
body.chatbot-open .nav-overlay,
body.chatbot-open .nav-mobile {
  transform: translateX(-280px);
}

/* ── FAB button ─────────────────────────────── */
.chatbot-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #12140F;
  border: 2px solid rgba(200, 240, 62, 0.4);
  color: #F5F6EF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10000;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25), 0 0 40px rgba(200, 240, 62, 0.15);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s, right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  -webkit-tap-highlight-color: transparent;
}
.chatbot-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 32px rgba(0, 0, 0, 0.3), 0 0 50px rgba(200, 240, 62, 0.25);
}
.chatbot-fab:active {
  transform: scale(0.95);
}
/* Shift FAB left when chat is open so it doesn't hide behind the panel */
body.chatbot-open .chatbot-fab {
  right: calc(var(--cb-width) + 16px);
}
.chatbot-fab .fab-open {
  width: 46px;
  height: 46px;
  object-fit: contain;
}
.chatbot-fab svg {
  width: 28px;
  height: 28px;
}

/* pulse ring */
.chatbot-fab::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(200, 240, 62, 0.25);
  animation: cbPulse 2.5s ease-in-out infinite;
  pointer-events: none;
}
.chatbot-fab.open::before { animation: none; opacity: 0; }
@keyframes cbPulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50%      { transform: scale(1.18); opacity: 0; }
}

/* notification dot */
.chatbot-fab .fab-dot {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 10px;
  height: 10px;
  background: var(--cb-accent);
  border-radius: 50%;
  border: 2px solid #12140F;
  animation: cbDotBounce 1.5s ease-in-out infinite;
}
.chatbot-fab.open .fab-dot { display: none; }
@keyframes cbDotBounce {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.3); }
}

/* ── Side panel (fixed right, slides in) ────── */
.chatbot-window {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--cb-width);
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: var(--cb-bg);
  border-left: 1px solid var(--cb-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  transform: translateX(100%);
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
  pointer-events: none;
}
.chatbot-window.open {
  transform: translateX(0);
  pointer-events: auto;
}

/* ── Header ─────────────────────────────────── */
.chatbot-header {
  background: #111;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.chatbot-header .ch-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--cb-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid var(--cb-border);
}
.chatbot-header .ch-avatar img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}
.chatbot-header .ch-info { flex: 1; }
.chatbot-header .ch-name {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.2px;
}

/* header buttons */
.ch-header-btn {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 7px 14px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.ch-header-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.2);
}
.ch-header-btn svg { width: 14px; height: 14px; }

.ch-close-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  padding: 7px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  color: #777;
}
.ch-close-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: #bbb;
  transform: scale(1.08);
}
.ch-close-btn:active {
  transform: scale(0.92);
  background: rgba(255, 255, 255, 0.1);
}
.ch-close-btn svg { width: 16px; height: 16px; }

/* ── Messages area ──────────────────────────── */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
  background: var(--cb-bg);
}
.chatbot-messages::-webkit-scrollbar { width: 4px; }
.chatbot-messages::-webkit-scrollbar-track { background: transparent; }
.chatbot-messages::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 10px; }

/* message bubbles */
.chat-msg {
  display: flex;
  gap: 8px;
  max-width: 88%;
  animation: cbMsgIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes cbMsgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.chat-msg.bot  { align-self: flex-start; }
.chat-msg.user { align-self: flex-end; flex-direction: row-reverse; }

.chat-msg .msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
  overflow: hidden;
}
.chat-msg.bot .msg-avatar {
  background: var(--cb-surface);
  border: 1px solid var(--cb-border);
}
.chat-msg.bot .msg-avatar img { width: 16px; height: 16px; object-fit: contain; }
.chat-msg.user .msg-avatar { background: var(--cb-accent); }
.chat-msg.user .msg-avatar svg { width: 14px; height: 14px; color: #12140F; }

.chat-msg .msg-bubble {
  padding: 12px 16px;
  border-radius: var(--cb-radius);
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: 0.1px;
}
.chat-msg.bot .msg-bubble {
  background: var(--cb-surface);
  color: var(--cb-text);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom-left-radius: 4px;
}
.chat-msg.user .msg-bubble {
  background: #2a2a2a;
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* streaming cursor */
.stream-cursor::after {
  content: '|';
  animation: cbBlink 0.6s infinite;
  color: var(--cb-accent);
  font-weight: bold;
}
@keyframes cbBlink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}

/* ── Welcome ────────────────────────────────── */
.chat-welcome {
  text-align: center;
  padding: 40px 20px 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.cw-logo {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: var(--cb-surface);
  border: 1px solid var(--cb-border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}
.cw-logo img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}
.chat-welcome h4 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}
.chat-welcome p {
  font-size: 14px;
  color: var(--cb-muted);
  line-height: 1.5;
}
.chat-welcome .cw-icon { display: none; }

/* quick choices */
.chat-quick-label {
  text-align: center;
  font-size: 11px;
  color: var(--cb-dim);
  padding: 16px 0 8px;
  letter-spacing: 0.5px;
}
.chat-quick-replies {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0 20px 12px;
}
.chat-quick-replies button {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--cb-surface);
  color: #ccc;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  max-width: 320px;
  text-align: center;
}
.chat-quick-replies button:hover {
  border-color: rgba(200, 240, 62, 0.4);
  background: rgba(200, 240, 62, 0.06);
  color: #fff;
}

/* ── Input area (powered by) ────────────────── */
.chatbot-powered {
  text-align: center;
  padding: 0 0 10px;
  font-size: 11px;
  color: var(--cb-dim);
}
.chatbot-powered span { color: #888; font-weight: 500; }

.chatbot-input-area {
  padding: 12px 16px 16px;
  background: var(--cb-bg);
  flex-shrink: 0;
}

.chatbot-input {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--cb-surface);
  border-radius: var(--cb-radius);
  border: 1px solid var(--cb-border);
  padding: 6px 6px 6px 14px;
}
.chatbot-input .add-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  transition: color 0.2s, background 0.2s;
  flex-shrink: 0;
}
.chatbot-input .add-btn:hover { color: #aaa; background: rgba(255, 255, 255, 0.05); }
.chatbot-input .add-btn svg { width: 20px; height: 20px; }

.chatbot-input input {
  flex: 1;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  padding: 10px 8px;
  border: none;
  background: transparent;
  color: #fff;
  outline: none;
}
.chatbot-input input::placeholder { color: var(--cb-dim); }

.chatbot-input .send-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #2a2a2a;
  border: 1px solid var(--cb-border);
  color: #888;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}
.chatbot-input .send-btn:hover { background: var(--cb-accent); color: #12140F; transform: scale(1.05); }
.chatbot-input .send-btn:active { transform: scale(0.95); }
.chatbot-input .send-btn svg { width: 18px; height: 18px; }

/* ── Light theme ────────────────────────────── */
.chatbot-window.light-theme {
  --cb-bg:       #f5f6ef;
  --cb-surface:  #ffffff;
  --cb-border:   rgba(0, 0, 0, 0.08);
  --cb-text:     #1a1a1a;
  --cb-muted:    #666;
  --cb-dim:      #999;
}
.chatbot-window.light-theme .chatbot-header {
  background: #fff;
  border-bottom-color: rgba(0, 0, 0, 0.06);
}
.chatbot-window.light-theme .chatbot-header .ch-name { color: #111; }
.chatbot-window.light-theme .ch-header-btn {
  border-color: rgba(0, 0, 0, 0.12);
  color: #333;
}
.chatbot-window.light-theme .ch-close-btn {
  color: #aaa;
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.06);
}
.chatbot-window.light-theme .ch-close-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.1);
  color: #555;
}
.chatbot-window.light-theme .chat-msg.user .msg-bubble {
  background: var(--ink);
  color: var(--bone);
}
.chatbot-window.light-theme .chatbot-input {
  background: #fff;
  border-color: rgba(0, 0, 0, 0.1);
}
.chatbot-window.light-theme .chatbot-input input { color: #111; }
.chatbot-window.light-theme .chatbot-input input::placeholder { color: #aaa; }
.chatbot-window.light-theme .chatbot-input .add-btn { color: #999; }
.chatbot-window.light-theme .chatbot-input .send-btn {
  background: #e8e8e8;
  border-color: rgba(0, 0, 0, 0.08);
  color: #666;
}
.chatbot-window.light-theme .chatbot-input .send-btn:hover {
  background: var(--cb-accent);
  color: var(--ink);
}
.chatbot-window.light-theme .chat-quick-replies button {
  background: #fff;
  border-color: rgba(0, 0, 0, 0.1);
  color: #333;
}
.chatbot-window.light-theme .chat-quick-replies button:hover {
  border-color: rgba(200, 240, 62, 0.6);
  background: rgba(200, 240, 62, 0.08);
}
.chatbot-window.light-theme .chat-welcome h4 { color: #111; }

/* ============================================
   MOBILE — full screen, no page push
   ============================================ */
@media (max-width: 480px) {
  /* Full screen chat, no push effect */
  body.chatbot-open #pageContent { transform: none; }
  body.chatbot-open #mainNav,
  body.chatbot-open .nav-overlay,
  body.chatbot-open .nav-mobile { transform: none; }

  /* FAB stays in place */
  body.chatbot-open .chatbot-fab { right: 20px; }
  .chatbot-fab { bottom: 20px; right: 20px; width: 54px; height: 54px; }
  .chatbot-fab svg { width: 24px; height: 24px; }

  /* Panel goes full screen */
  .chatbot-window {
    width: 100vw;
    border-left: none;
    border-radius: 0;
  }

  /* Header: hide theme toggle, icon-only new chat, big close */
  #chatThemeToggle { display: none; }

  #chatNewChat {
    font-size: 0;
    padding: 8px;
    gap: 0;
  }
  #chatNewChat svg {
    width: 18px;
    height: 18px;
  }

  .ch-close-btn {
    padding: 8px;
    border-radius: 10px;
  }
  .ch-close-btn svg {
    width: 20px;
    height: 20px;
  }

  /* Safe area for notched phones */
  .chatbot-input-area {
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
}

/* Prevent body scroll when chat is open on mobile */
body.chatbot-open {
  overflow: hidden;
}
