/* ============================================================
   VoxTopics AI Assistant Plugin – style.css
   Author: Built for VoxTopics.com
   ============================================================ */

:root {
  --vox-primary: #6366f1;
  --vox-primary-dark: #4f46e5;
  --vox-secondary: #8b5cf6;
  --vox-accent: #f59e0b;
  --vox-bg: #0f0f1a;
  --vox-surface: #1a1a2e;
  --vox-surface2: #16213e;
  --vox-border: rgba(99, 102, 241, 0.2);
  --vox-text: #e8e8f0;
  --vox-text-muted: #9090b0;
  --vox-user-bubble: linear-gradient(135deg, #6366f1, #8b5cf6);
  --vox-bot-bubble: #1e1e35;
  --vox-input-bg: #12121f;
  --vox-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(99,102,241,0.15);
  --vox-glow: 0 0 30px rgba(99,102,241,0.3);
  --radius: 20px;
  --radius-sm: 12px;
  --font: 'Inter', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: #0a0a14;
  min-height: 100vh;
  overflow-x: hidden;
}

/* =================== DEMO PAGE =================== */
.demo-page {
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 20% 30%, rgba(99,102,241,0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(139,92,246,0.12) 0%, transparent 50%),
    linear-gradient(135deg, #0a0a14 0%, #0f0f1f 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 20px 160px;
}

.demo-header {
  text-align: center;
  margin-bottom: 48px;
}

.demo-logo {
  height: 64px;
  object-fit: contain;
  margin-bottom: 12px;
  filter: brightness(1.2);
}

.demo-tagline {
  color: var(--vox-text-muted);
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.demo-content {
  text-align: center;
  max-width: 680px;
}

.demo-content h1 {
  font-family: 'Outfit', sans-serif;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #e8e8ff, #a5b4fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.demo-content p {
  color: var(--vox-text-muted);
  font-size: 1.05rem;
  margin-bottom: 32px;
  line-height: 1.6;
}

.demo-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 32px;
}

.demo-card {
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 16px;
  padding: 20px 24px;
  color: var(--vox-text);
  font-size: 0.95rem;
  font-weight: 500;
  text-align: left;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.demo-card:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.15);
}

/* =================== TOGGLE BUTTON =================== */
#vox-chat-toggle {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--vox-primary), var(--vox-secondary));
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  z-index: 9998;
  box-shadow: 0 8px 32px rgba(99,102,241,0.5), 0 2px 8px rgba(0,0,0,0.3);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
  animation: pulseGlow 3s ease-in-out infinite;
}

#vox-chat-toggle:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 14px 40px rgba(99,102,241,0.6), 0 2px 8px rgba(0,0,0,0.3);
  animation: none;
}

#vox-chat-toggle:active {
  transform: scale(0.95);
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 8px 32px rgba(99,102,241,0.5), 0 2px 8px rgba(0,0,0,0.3); }
  50% { box-shadow: 0 8px 40px rgba(99,102,241,0.75), 0 2px 8px rgba(0,0,0,0.3), 0 0 0 8px rgba(99,102,241,0.12); }
}

.toggle-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.toggle-icon svg {
  width: 26px;
  height: 26px;
  transition: transform 0.3s ease;
}

.toggle-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--vox-accent);
  color: #0a0a14;
  font-size: 10px;
  font-weight: 700;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #0a0a14;
  animation: bounceBadge 2s ease-in-out infinite;
}

.toggle-badge.hidden { display: none; }

@keyframes bounceBadge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* =================== CHAT WINDOW =================== */
.vox-chat-window {
  position: fixed;
  bottom: 108px;
  right: 28px;
  width: 390px;
  max-height: 600px;
  display: flex;
  flex-direction: column;
  background: var(--vox-surface);
  border-radius: var(--radius);
  box-shadow: var(--vox-shadow);
  border: 1px solid var(--vox-border);
  z-index: 9997;
  overflow: hidden;
  transform: scale(0.85) translateY(20px);
  transform-origin: bottom right;
  opacity: 0;
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  backdrop-filter: blur(20px);
}

.vox-chat-window.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* =================== HEADER =================== */
.vox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  background: linear-gradient(135deg, rgba(99,102,241,0.25), rgba(139,92,246,0.15));
  border-bottom: 1px solid var(--vox-border);
  position: relative;
  overflow: hidden;
}

.vox-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.03), transparent);
  animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% { transform: translateX(-100%); }
  50% { transform: translateX(100%); }
}

.vox-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.vox-avatar {
  position: relative;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
}

.vox-avatar svg {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(99,102,241,0.4);
}

.online-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 11px;
  height: 11px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid var(--vox-surface);
  animation: pulseDot 2s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.8; }
}

.vox-header-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.vox-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  font-family: 'Outfit', sans-serif;
  letter-spacing: 0.01em;
}

.vox-status {
  font-size: 0.72rem;
  color: #86efac;
  display: flex;
  align-items: center;
  gap: 5px;
}

.status-pulse {
  width: 6px;
  height: 6px;
  background: #22c55e;
  border-radius: 50%;
  animation: pulseDot 1.5s ease-in-out infinite;
}

.vox-header-actions {
  display: flex;
  gap: 6px;
  position: relative;
}

.header-action-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--vox-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.header-action-btn svg {
  width: 15px;
  height: 15px;
}

.header-action-btn:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

/* =================== MESSAGES =================== */
.vox-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
  min-height: 200px;
  max-height: 340px;
}

.vox-messages::-webkit-scrollbar {
  width: 4px;
}

.vox-messages::-webkit-scrollbar-track {
  background: transparent;
}

.vox-messages::-webkit-scrollbar-thumb {
  background: rgba(99,102,241,0.3);
  border-radius: 4px;
}

/* Message bubbles */
.vox-msg {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  animation: msgSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 100%;
}

@keyframes msgSlideIn {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.vox-msg.user {
  flex-direction: row-reverse;
}

.msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.bot .msg-avatar {
  background: linear-gradient(135deg, var(--vox-primary), var(--vox-secondary));
  font-size: 12px;
  color: #fff;
}

.user .msg-avatar {
  background: linear-gradient(135deg, var(--vox-accent), #f97316);
  font-size: 14px;
}

.msg-bubble {
  max-width: 78%;
  padding: 12px 16px;
  border-radius: 18px;
  line-height: 1.55;
  font-size: 0.875rem;
  position: relative;
  word-break: break-word;
}

.bot .msg-bubble {
  background: var(--vox-bot-bubble);
  color: var(--vox-text);
  border: 1px solid rgba(255,255,255,0.06);
  border-bottom-left-radius: 4px;
}

.user .msg-bubble {
  background: var(--vox-user-bubble);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 16px rgba(99,102,241,0.35);
}

.msg-time {
  font-size: 0.65rem;
  color: var(--vox-text-muted);
  text-align: center;
  width: 100%;
}

/* Typing indicator */
.typing-indicator .msg-bubble {
  padding: 14px 18px;
  display: flex;
  gap: 5px;
  align-items: center;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: var(--vox-primary);
  border-radius: 50%;
  animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-8px); opacity: 1; }
}

/* Welcome card */
.welcome-card {
  background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(139,92,246,0.1));
  border: 1px solid rgba(99,102,241,0.25);
  border-radius: 16px;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: msgSlideIn 0.4s ease;
}

.welcome-card .wc-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
}

.welcome-card .wc-desc {
  font-size: 0.82rem;
  color: var(--vox-text-muted);
  line-height: 1.5;
}

.welcome-card .wc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.wc-tag {
  background: rgba(99,102,241,0.2);
  color: #a5b4fc;
  font-size: 0.73rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid rgba(99,102,241,0.3);
}

/* Source links in bot message */
.source-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.75rem;
  color: #a5b4fc;
  text-decoration: none;
  border-bottom: 1px dashed rgba(165,180,252,0.5);
  transition: color 0.2s;
}

.source-link:hover { color: #fff; }

/* Markdown-like formatting */
.msg-bubble strong { color: #e0e0ff; }
.msg-bubble em { color: #c4b5fd; }
.msg-bubble a { color: #a5b4fc; text-decoration: underline; }

/* =================== SUGGESTIONS =================== */
.vox-suggestions {
  display: flex;
  gap: 8px;
  padding: 0 16px 12px;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}

.vox-suggestions::-webkit-scrollbar { display: none; }

.suggestion-chip {
  white-space: nowrap;
  background: rgba(99,102,241,0.1);
  border: 1px solid rgba(99,102,241,0.25);
  color: #c7d2fe;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font);
  flex-shrink: 0;
}

.suggestion-chip:hover {
  background: rgba(99,102,241,0.2);
  border-color: rgba(99,102,241,0.5);
  color: #fff;
  transform: translateY(-1px);
}

/* =================== INPUT AREA =================== */
.vox-input-area {
  padding: 12px 16px 14px;
  border-top: 1px solid var(--vox-border);
  background: var(--vox-input-bg);
  flex-shrink: 0;
}

.vox-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: rgba(255,255,255,0.04);
  border: 1.5px solid rgba(99,102,241,0.2);
  border-radius: 14px;
  padding: 10px 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.vox-input-wrapper:focus-within {
  border-color: rgba(99,102,241,0.55);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

#vox-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--vox-text);
  font-size: 0.88rem;
  font-family: var(--font);
  line-height: 1.5;
  resize: none;
  max-height: 100px;
  overflow-y: auto;
  scrollbar-width: thin;
}

#vox-input::placeholder {
  color: var(--vox-text-muted);
}

.vox-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--vox-primary), var(--vox-secondary));
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(99,102,241,0.35);
}

.vox-send-btn svg {
  width: 16px;
  height: 16px;
}

.vox-send-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 18px rgba(99,102,241,0.5);
}

.vox-send-btn:active {
  transform: scale(0.95);
}

.vox-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.vox-footer-text {
  font-size: 0.68rem;
  color: var(--vox-text-muted);
  text-align: center;
  margin-top: 8px;
}

.vox-footer-text a {
  color: #a5b4fc;
  text-decoration: none;
}

.vox-footer-text a:hover {
  text-decoration: underline;
}

/* CTA Button in Bot Messages */
.article-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.15));
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #c7d2fe !important;
  text-decoration: none !important;
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.25s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.article-cta-btn:hover {
  background: linear-gradient(135deg, var(--vox-primary), var(--vox-secondary));
  border-color: rgba(99, 102, 241, 0.6);
  color: #fff !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.3);
}

.cta-arrow {
  display: inline-block;
  transition: transform 0.2s ease;
}

.article-cta-btn:hover .cta-arrow {
  transform: translateX(3px);
}

/* =================== RESPONSIVE =================== */
@media (max-width: 480px) {
  .vox-chat-window {
    width: calc(100vw - 24px);
    right: 12px;
    bottom: 90px;
    max-height: 70vh;
  }

  #vox-chat-toggle {
    right: 16px;
    bottom: 16px;
  }
}
