/* ================================================
   RAG CHATBOT WIDGET — Glassmorphic Floating Agent
   Matches the portfolio's dark cinematic aesthetic.
   Supports: Markdown rendering, Streaming cursor,
   Onboarding overlay, Session persistence.
   ================================================ */

/* --- CSS Custom Properties --- */
:root {
  --chat-bg: linear-gradient(135deg, rgba(16, 21, 44, 0.98) 0%, rgba(33, 20, 36, 0.98) 100%);
  --chat-glass: rgba(16, 20, 38, 0.85);
  --chat-border: rgba(255, 255, 255, 0.06);
  --chat-border-hover: rgba(255, 255, 255, 0.12);
  --chat-accent: #a855f7;
  --chat-accent-2: #22d3ee;
  --chat-accent-dim: rgba(168, 85, 247, 0.15);
  --chat-accent-glow: rgba(168, 85, 247, 0.35);
  --chat-accent-2-glow: rgba(34, 211, 238, 0.25);
  --chat-gradient: linear-gradient(135deg, #a855f7 0%, #6d28d9 40%, #06b6d4 100%);
  --chat-gradient-subtle: linear-gradient(135deg, rgba(168, 85, 247, 0.15) 0%, rgba(6, 182, 212, 0.10) 100%);
  --chat-text: #f3f4f6;
  --chat-text-muted: #9ca3af;
  --chat-user-bg: linear-gradient(135deg, #a855f7 0%, #06b6d4 100%);
  --chat-bot-bg: rgba(255, 255, 255, 0.035);
  --chat-radius: 24px;
  --chat-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --chat-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

/* ================================================
   3D SMART BALL TRIGGER — Rotating Sphere Widget
   ================================================ */
.rag-chat-trigger {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  perspective: 800px;
  padding: 0;
  outline: none;
}

/* The 3D sphere core */
.rag-chat-trigger .rag-orb {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--chat-gradient);
  box-shadow:
    0 0 20px rgba(168, 85, 247, 0.3),
    0 0 40px rgba(6, 182, 212, 0.15),
    inset 0 -8px 20px rgba(0, 0, 0, 0.3),
    inset 0 8px 16px rgba(255, 255, 255, 0.15);
  animation: rag-orb-float 4s ease-in-out infinite;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Glass highlight on sphere */
.rag-chat-trigger .rag-orb::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 12px;
  width: 28px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0) 100%);
  filter: blur(1px);
}

/* Rotating ring orbit around the sphere */
.rag-chat-trigger .rag-orbit-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 72px;
  height: 72px;
  margin: -36px 0 0 -36px;
  border-radius: 50%;
  border: 1.5px solid transparent;
  border-top-color: rgba(168, 85, 247, 0.5);
  border-right-color: rgba(34, 211, 238, 0.4);
  animation: rag-ring-spin 3s linear infinite;
  pointer-events: none;
}

/* Pulsing aura glow */
.rag-chat-trigger .rag-aura {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 80px;
  height: 80px;
  margin: -40px 0 0 -40px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.12) 0%, rgba(6, 182, 212, 0.06) 50%, transparent 70%);
  animation: rag-aura-pulse 3s ease-in-out infinite;
  pointer-events: none;
}

/* AI icon inside the sphere */
.rag-chat-trigger .rag-orb-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  color: rgba(255, 255, 255, 0.95);
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.3));
  z-index: 2;
}

/* Hover effects */
.rag-chat-trigger:hover {
  transform: scale(1.12);
}

.rag-chat-trigger:hover .rag-orb {
  box-shadow:
    0 0 30px rgba(168, 85, 247, 0.45),
    0 0 60px rgba(6, 182, 212, 0.25),
    inset 0 -8px 20px rgba(0, 0, 0, 0.3),
    inset 0 8px 16px rgba(255, 255, 255, 0.2);
}

.rag-chat-trigger:hover .rag-orbit-ring {
  animation-duration: 1.5s;
  border-top-color: rgba(168, 85, 247, 0.8);
  border-right-color: rgba(34, 211, 238, 0.7);
}

/* Keyframes */
@keyframes rag-orb-float {
  0%, 100% { transform: translateY(0) rotateY(0deg); }
  25% { transform: translateY(-3px) rotateY(10deg); }
  50% { transform: translateY(-5px) rotateY(0deg); }
  75% { transform: translateY(-3px) rotateY(-10deg); }
}

@keyframes rag-ring-spin {
  0% { transform: rotateX(65deg) rotateZ(0deg); }
  100% { transform: rotateX(65deg) rotateZ(360deg); }
}

@keyframes rag-aura-pulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.15); opacity: 1; }
}


/* --- Chat Panel --- */
.rag-chat-panel {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 10000;
  width: 420px;
  height: 600px;
  border-radius: var(--chat-radius);
  border: 1px solid var(--chat-border);
  background: var(--chat-bg);
  backdrop-filter: blur(32px) saturate(1.4);
  -webkit-backdrop-filter: blur(32px) saturate(1.4);
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.6),
    0 0 80px rgba(168, 85, 247, 0.08),
    0 0 120px rgba(6, 182, 212, 0.04);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  animation: rag-panel-open 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.rag-chat-panel.closing {
  animation: rag-panel-close 0.3s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes rag-panel-open {
  0% { opacity: 0; transform: scale(0.85) translateY(20px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes rag-panel-close {
  0% { opacity: 1; transform: scale(1) translateY(0); }
  100% { opacity: 0; transform: scale(0.85) translateY(20px); }
}

/* --- Panel Header — Minimal & Clean --- */
.rag-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--chat-border);
  flex-shrink: 0;
}

.rag-chat-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rag-header-sparkle {
  width: 18px;
  height: 18px;
  color: var(--chat-accent);
  display: flex;
  align-items: center;
  animation: rag-sparkle-pulse 2.5s ease-in-out infinite;
}

.rag-header-sparkle svg {
  width: 18px;
  height: 18px;
}

@keyframes rag-sparkle-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.9); }
}

.rag-header-title {
  font-family: var(--chat-font);
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.rag-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.rag-chat-reset,
.rag-chat-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.rag-chat-reset:hover,
.rag-chat-close:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.rag-chat-reset svg,
.rag-chat-close svg {
  width: 16px;
  height: 16px;
}

/* ================================================
   ONBOARDING OVERLAY
   ================================================ */
.rag-onboarding-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 24px;
  text-align: center;
  animation: rag-fade-in 0.4s ease-out forwards;
}

.rag-onboarding-subtitle {
  font-family: var(--chat-font);
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  margin: 0 0 24px 0;
  line-height: 1.5;
  max-width: 300px;
}

.rag-onboarding-form {
  width: 100%;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rag-onboarding-field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.25s, box-shadow 0.25s;
}

.rag-onboarding-field:focus-within {
  border-color: rgba(168, 85, 247, 0.35);
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.08);
}

.rag-onboarding-icon {
  display: flex;
  align-items: center;
  color: rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
}

.rag-onboarding-icon svg {
  width: 16px;
  height: 16px;
}

.rag-onboarding-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--chat-font);
  font-size: 14px;
  color: #ffffff;
  padding: 2px 0;
  min-width: 0;
  transition: border-color 0.2s;
}

.rag-onboarding-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.rag-onboarding-submit {
  margin-top: 6px;
  padding: 12px 24px;
  border-radius: 14px;
  border: none;
  background: var(--chat-user-bg);
  color: #ffffff;
  font-family: var(--chat-font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px rgba(168, 85, 247, 0.3);
}

.rag-onboarding-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(168, 85, 247, 0.4);
}

.rag-onboarding-skip {
  padding: 8px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.35);
  font-family: var(--chat-font);
  font-size: 12px;
  cursor: pointer;
  transition: color 0.2s;
}

.rag-onboarding-skip:hover {
  color: rgba(255, 255, 255, 0.6);
}

/* ================================================
   WELCOME SCREEN & SPHERE
   ================================================ */
.rag-welcome-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  text-align: center;
  animation: rag-fade-in 0.4s ease-out forwards;
}

@keyframes rag-fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.rag-sphere-wrap {
  margin-bottom: 20px;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.rag-sphere {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #e9d5ff, #c084fc 35%, #9333ea 60%, #06b6d4 90%, #1e1b4b 100%);
  box-shadow:
    0 8px 24px rgba(168, 85, 247, 0.35),
    0 4px 16px rgba(6, 182, 212, 0.15),
    inset 0 -10px 20px rgba(0, 0, 0, 0.5),
    inset 0 6px 14px rgba(255, 255, 255, 0.4),
    0 0 40px rgba(168, 85, 247, 0.2);
  animation: rag-sphere-float 4s ease-in-out infinite;
}

@keyframes rag-sphere-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.rag-welcome-heading {
  font-family: var(--chat-font);
  font-size: 22px;
  font-weight: 600;
  color: #ffffff;
  margin: 0 0 6px 0;
  letter-spacing: -0.02em;
}

.rag-welcome-subheading {
  font-family: var(--chat-font);
  font-size: 18px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.55);
  margin: 0 0 28px 0;
}

.rag-highlight {
  background: linear-gradient(135deg, #c084fc, #22d3ee);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 600;
}

/* --- Suggestion Chips — Horizontal Scrolling Row --- */
.rag-suggestions-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px;
  width: 100%;
  max-width: 380px;
  scrollbar-width: none;
}

.rag-suggestions-scroll::-webkit-scrollbar {
  display: none;
}

.rag-suggestion-chip {
  padding: 8px 14px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.65);
  font-family: var(--chat-font);
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.rag-suggestion-chip:hover {
  border-color: rgba(168, 85, 247, 0.4);
  color: #fff;
  background: rgba(168, 85, 247, 0.12);
  transform: translateY(-1px);
}

/* ================================================
   MESSAGES AREA
   ================================================ */
.rag-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}

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

.rag-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
}

/* ================================================
   MESSAGE BUBBLES
   ================================================ */
.rag-msg {
  display: flex;
  flex-direction: column;
  max-width: 88%;
  animation: rag-msg-in 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes rag-msg-in {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

.rag-msg.user {
  align-self: flex-end;
  align-items: flex-end;
}

.rag-msg.bot {
  align-self: flex-start;
  align-items: flex-start;
}

.rag-msg-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-family: var(--chat-font);
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--chat-text);
  word-break: break-word;
}

.rag-msg.user .rag-msg-bubble {
  background: var(--chat-user-bg);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.rag-msg.bot .rag-msg-bubble {
  background: var(--chat-bot-bg);
  border: 1px solid var(--chat-border);
  border-bottom-left-radius: 4px;
}

/* ================================================
   STREAMING CURSOR — Blinking caret at end of text
   ================================================ */
.rag-msg-bubble.rag-streaming::after {
  content: '▌';
  display: inline;
  color: var(--chat-accent);
  animation: rag-cursor-blink 0.8s steps(2) infinite;
  font-weight: 400;
  margin-left: 1px;
}

@keyframes rag-cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ================================================
   RICH MARKDOWN STYLES (inside .rag-msg-bubble)
   ================================================ */

/* Headings */
.rag-msg-bubble .rag-md-h2 {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  margin: 12px 0 6px 0;
  letter-spacing: -0.01em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 4px;
}

.rag-msg-bubble .rag-md-h3 {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  margin: 10px 0 4px 0;
}

.rag-msg-bubble .rag-md-h4 {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  margin: 8px 0 4px 0;
}

/* First heading in bubble — no top margin */
.rag-msg-bubble > .rag-md-h2:first-child,
.rag-msg-bubble > .rag-md-h3:first-child,
.rag-msg-bubble > .rag-md-h4:first-child {
  margin-top: 0;
}

/* Paragraphs */
.rag-msg-bubble .rag-md-p {
  margin: 4px 0;
  line-height: 1.65;
}

.rag-msg-bubble .rag-md-p:first-child {
  margin-top: 0;
}

.rag-msg-bubble .rag-md-p:last-child {
  margin-bottom: 0;
}

/* Spacer between blocks */
.rag-msg-bubble .rag-md-spacer {
  height: 6px;
}

/* Lists */
.rag-msg-bubble .rag-md-list {
  margin: 6px 0;
  padding-left: 18px;
}

.rag-msg-bubble .rag-md-list li {
  margin: 3px 0;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.88);
}

.rag-msg-bubble ul.rag-md-list li::marker {
  color: var(--chat-accent);
}

.rag-msg-bubble ol.rag-md-list li::marker {
  color: var(--chat-accent);
  font-weight: 600;
  font-size: 12px;
}

/* Bold & Italic */
.rag-msg-bubble strong {
  font-weight: 600;
  color: #ffffff;
}

.rag-msg-bubble em {
  font-style: italic;
  color: rgba(255, 255, 255, 0.8);
}

/* Inline Code */
.rag-inline-code {
  font-family: var(--chat-mono);
  font-size: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 5px;
  padding: 1px 6px;
  color: #c4b5fd;
}

/* Markdown Links */
.rag-md-link {
  color: #c084fc;
  text-decoration: none;
  border-bottom: 1px solid rgba(192, 132, 252, 0.3);
  transition: color 0.2s, border-color 0.2s;
  word-break: break-all;
}

.rag-md-link:hover {
  color: #e9d5ff;
  border-bottom-color: rgba(233, 213, 255, 0.6);
}

/* ================================================
   CODE BLOCKS WITH COPY BUTTON
   ================================================ */
.rag-code-block {
  margin: 10px 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.35);
}

.rag-code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.rag-code-lang {
  font-family: var(--chat-mono);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.rag-copy-btn {
  padding: 2px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.5);
  font-family: var(--chat-font);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.rag-copy-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.15);
}

.rag-code-block pre {
  margin: 0;
  padding: 12px 14px;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.06) transparent;
}

.rag-code-block pre::-webkit-scrollbar {
  height: 4px;
}

.rag-code-block pre::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
}

.rag-code-block code {
  font-family: var(--chat-mono);
  font-size: 12px;
  line-height: 1.6;
  color: #e2e8f0;
  white-space: pre;
}

/* ================================================
   TYPING INDICATOR
   ================================================ */
.rag-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px 18px;
  background: var(--chat-bot-bg);
  border: 1px solid var(--chat-border);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  max-width: 70px;
  align-self: flex-start;
}

.rag-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--chat-accent);
  animation: rag-typing-bounce 1.4s ease-in-out infinite;
}

.rag-typing-dot:nth-child(2) { animation-delay: 0.16s; }
.rag-typing-dot:nth-child(3) { animation-delay: 0.32s; }

@keyframes rag-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ================================================
   INPUT AREA — Single Row
   ================================================ */
.rag-chat-input-area {
  padding: 12px 14px 16px;
  flex-shrink: 0;
}

.rag-chat-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.25s, box-shadow 0.25s;
}

.rag-chat-input-row:focus-within {
  border-color: rgba(168, 85, 247, 0.35);
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.08);
}

.rag-wand-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
}

.rag-wand-icon svg {
  width: 16px;
  height: 16px;
}

.rag-chat-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--chat-font);
  font-size: 14px;
  color: #ffffff;
  padding: 2px 0;
  min-width: 0;
}

.rag-chat-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.rag-chat-send-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--chat-user-bg);
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(168, 85, 247, 0.3);
}

.rag-chat-send-btn:hover:not(:disabled) {
  transform: scale(1.08);
  box-shadow: 0 4px 14px rgba(168, 85, 247, 0.4);
}

.rag-chat-send-btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
  box-shadow: none;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.3);
}

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

/* --- Onboarding Divider --- */
.rag-onboarding-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 18px 0 12px 0;
  width: 100%;
}
.rag-onboarding-divider::before,
.rag-onboarding-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.12);
}
.rag-onboarding-divider span {
  padding: 0 10px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-family: var(--chat-font);
}

/* --- Quick Replies Wrapper --- */
.rag-quick-replies {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin-bottom: 14px;
}

/* --- Quick Reply Chip --- */
.rag-quick-chip {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%);
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--chat-font);
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 10px;
  outline: none;
}
.rag-quick-chip:hover {
  border-color: rgba(34, 211, 238, 0.35);
  color: #fff;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.12) 0%, rgba(34, 211, 238, 0.12) 100%);
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(34, 211, 238, 0.06);
}

/* --- Suggestions Section Label --- */
.rag-suggestions-label {
  align-self: flex-start;
  color: rgba(255, 255, 255, 0.4);
  font-size: 11px;
  font-family: var(--chat-font);
  margin-top: 4px;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* --- Professional SVG Icon inside Quick Chips --- */
.rag-chip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.75;
}
.rag-chip-icon svg {
  width: 100%;
  height: 100%;
}
.rag-quick-chip:hover .rag-chip-icon {
  opacity: 1;
}

/* --- Contextual Follow-Up Suggestions (after bot response) --- */
.rag-followups {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 4px 0;
  animation: ragFadeSlideUp 0.35s ease-out;
}

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

.rag-followup-chip {
  padding: 7px 14px;
  border-radius: 18px;
  border: 1px solid rgba(168, 85, 247, 0.2);
  background: rgba(168, 85, 247, 0.06);
  color: rgba(255, 255, 255, 0.7);
  font-family: var(--chat-font);
  font-size: 11.5px;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
  white-space: nowrap;
}
.rag-followup-chip:hover {
  border-color: rgba(34, 211, 238, 0.4);
  color: #fff;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.15), rgba(34, 211, 238, 0.12));
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(34, 211, 238, 0.08);
}

/* ================================================
   RESPONSIVE
   ================================================ */
@media (max-width: 480px) {
  .rag-chat-panel {
    width: calc(100vw - 20px);
    height: calc(100vh - 100px);
    bottom: 10px;
    right: 10px;
    border-radius: 16px;
  }
  
  .rag-chat-trigger {
    bottom: 18px;
    right: 18px;
    width: 54px;
    height: 54px;
  }
}

/* --- Hide trigger when panel is open --- */
.rag-chat-trigger.hidden {
  pointer-events: none;
  opacity: 0;
  transform: scale(0.6);
}
