/* Agni Docs - Search & AI Assistant */
/* v3 - Complete rewrite */

/* ================================================================
   CUSTOM BACKGROUND - Retell-style grid with Agni orange glow
   ================================================================ */

/* Radial gradient glow behind the hero/landing area */
body::before {
  content: "";
  position: fixed;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 120%;
  height: 60%;
  background: radial-gradient(
    ellipse at center,
    rgba(255, 69, 0, 0.08) 0%,
    rgba(255, 127, 80, 0.04) 30%,
    transparent 70%
  );
  pointer-events: none;
  z-index: 0;
}

/* Light mode: warm orange glow on white background */
html.light body::before,
html:not(.dark) body::before {
  background: radial-gradient(
    ellipse at center,
    rgba(255, 69, 0, 0.18) 0%,
    rgba(255, 127, 80, 0.10) 25%,
    rgba(255, 165, 0, 0.05) 50%,
    transparent 70%
  );
}

/* Dark mode: stronger glow */
html.dark body::before {
  background: radial-gradient(
    ellipse at center,
    rgba(255, 69, 0, 0.12) 0%,
    rgba(255, 127, 80, 0.05) 35%,
    transparent 70%
  );
}

/* Grid line enhancement - more visible in light mode */
html.light [class*="grid-background"],
html:not(.dark) [class*="grid-background"],
html.light [style*="grid"],
html:not(.dark) [style*="grid"] {
  opacity: 0.8;
}

html.dark [class*="grid-background"],
html.dark [style*="grid"] {
  opacity: 0.6;
}

/* Hero section gradient accent */
main > div:first-child,
article > div:first-child {
  position: relative;
}

/* FORCE HIDE "Powered by mintlify" footer - multiple selectors for reliability */
a[href*="mintlify.com"] { visibility: hidden !important; font-size: 0 !important; height: 0 !important; overflow: hidden !important; display: inline-block !important; }
footer a[href*="mintlify.com"],
div a[href*="mintlify.com"],
span a[href*="mintlify.com"] { visibility: hidden !important; }
/* Replace powered-by area content with Agni branding via CSS */
a[href*="mintlify.com"]::after {
  content: "Agni by Ravan.ai";
  visibility: visible !important;
  font-size: 14px !important;
  color: inherit !important;
  display: inline !important;
}

/* Hide Mintlify's native search dialog (but NOT the mobile sidebar) */
div[class*="cmdk-dialog"],
div[class*="CommandMenu"],
div[class*="search-dialog"],
div[class*="SearchDialog"] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  opacity: 0 !important;
  z-index: -1 !important;
}
#agni-search-overlay,
#agni-search-overlay * {
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}
#agni-search-overlay { z-index: 99999 !important; }
#agni-search-overlay:not(.active) { display: none !important; }

/* ===== OVERLAY ===== */
#agni-search-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 99999;
  justify-content: center;
  align-items: flex-start;
  padding: 8vh 16px 0;
}
#agni-search-overlay.active { display: flex; }

/* ===== MODAL ===== */
#agni-search-modal {
  width: 100%;
  max-width: 640px;
  max-height: 78vh;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: agni-pop 0.18s cubic-bezier(0.16,1,0.3,1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  /* Dark */
  background: #18141a;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 24px 80px rgba(0,0,0,0.65);
  color: #ddd;
}
@keyframes agni-pop {
  from { opacity: 0; transform: translateY(-12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===== MODAL HEADER ===== */
.agni-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.agni-modal-title {
  font-size: 14px;
  font-weight: 700;
  color: #FF4500;
  letter-spacing: 0.01em;
}
.agni-clear-btn {
  font-size: 12px;
  color: rgba(255,255,255,0.35);
  background: none;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.15s;
}
.agni-clear-btn:hover { color: #FF4500; border-color: rgba(255,69,0,0.3); }

/* ===== SCROLL PROGRESS BAR ===== */
#agni-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, #FF4500, #FF7F50);
  z-index: 99998;
  transition: width 0.1s linear;
  border-radius: 0 2px 2px 0;
}

/* ===== COPY BUTTON ON CODE BLOCKS ===== */
.agni-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.5);
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  z-index: 2;
}
.agni-copy-btn:hover { background: rgba(255,69,0,0.15); color: #FF7F50; border-color: rgba(255,69,0,0.3); }

/* ===== PANELS ===== */
#agni-panel-ai { display: none; flex-direction: column; flex: 1; min-height: 0; }
#agni-panel-ai.active { display: flex; }

/* ===== PAGEFIND ===== */
#agni-search-container { flex: 1; overflow-y: auto; }
#agni-search-modal .pagefind-ui {
  --pagefind-ui-scale: 0.9;
  --pagefind-ui-primary: #FF4500;
  --pagefind-ui-text: #ddd;
  --pagefind-ui-background: #18141a;
  --pagefind-ui-border: rgba(255,255,255,0.08);
  --pagefind-ui-tag: rgba(255,69,0,0.1);
  --pagefind-ui-border-width: 1px;
  --pagefind-ui-border-radius: 8px;
  --pagefind-ui-font: inherit;
}
#agni-search-modal .pagefind-ui .pagefind-ui__search-input {
  font-size: 15px;
  padding: 14px 16px;
  background: transparent;
  color: #ddd;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  border-radius: 0;
  width: 100%;
  box-sizing: border-box;
}
#agni-search-modal .pagefind-ui .pagefind-ui__search-input::placeholder { color: rgba(255,255,255,0.25); }
#agni-search-modal .pagefind-ui .pagefind-ui__search-input:focus { outline: none; }
#agni-search-modal .pagefind-ui .pagefind-ui__search-clear { color: #FF4500; right: 12px; }
#agni-search-modal .pagefind-ui .pagefind-ui__results-area { padding: 6px 10px 10px; }
#agni-search-modal .pagefind-ui .pagefind-ui__result { padding: 10px; border-radius: 8px; border: none; }
#agni-search-modal .pagefind-ui .pagefind-ui__result:hover { background: rgba(255,255,255,0.04); }
#agni-search-modal .pagefind-ui .pagefind-ui__result-link { color: #FF7F50; font-weight: 500; }
#agni-search-modal .pagefind-ui .pagefind-ui__result-excerpt { color: rgba(255,255,255,0.45); font-size: 13px; }
#agni-search-modal .pagefind-ui .pagefind-ui__message { color: rgba(255,255,255,0.35); padding: 28px; text-align: center; }

/* ===== AI CHAT - Modern Assistant Layout ===== */
#agni-ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Shared message row — full width, no bubbles */
.agni-msg-row {
  width: 100%;
  padding: 16px 20px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  box-sizing: border-box;
}
.agni-msg-row + .agni-msg-row { border-top: 1px solid rgba(255,255,255,0.04); }

/* Avatar */
.agni-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  font-weight: 700;
}
.agni-msg-row.user .agni-msg-avatar {
  background: rgba(255,69,0,0.15);
  color: #FF4500;
}
.agni-msg-row.assistant .agni-msg-avatar {
  background: linear-gradient(135deg, #FF4500, #FF7F50);
  color: #fff;
  font-size: 13px;
}

/* Message content */
.agni-msg-content {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  line-height: 1.7;
  color: #ddd;
  word-break: break-word;
}
.agni-msg-row.user .agni-msg-content { color: rgba(255,255,255,0.8); }

/* Sender label */
.agni-msg-label {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.agni-msg-row.user .agni-msg-label { color: rgba(255,255,255,0.35); }
.agni-msg-row.assistant .agni-msg-label { color: #FF4500; }

/* Markdown inside AI response */
.agni-msg-body h1 { font-size: 17px; font-weight: 700; margin: 4px 0 8px; color: #fff; }
.agni-msg-body h2 { font-size: 15px; font-weight: 700; margin: 16px 0 6px; color: #fff; border-bottom: 1px solid rgba(255,255,255,0.06); padding-bottom: 6px; }
.agni-msg-body h3 { font-size: 14px; font-weight: 700; margin: 12px 0 4px; color: #eee; }
.agni-msg-body p { margin: 0 0 10px; }
.agni-msg-body p:last-child { margin-bottom: 0; }
.agni-msg-body ul, .agni-msg-body ol { margin: 6px 0 10px; padding-left: 22px; }
.agni-msg-body li { margin: 4px 0; }
.agni-msg-body li::marker { color: #FF4500; }
.agni-msg-body strong { color: #fff; font-weight: 600; }
.agni-msg-body em { font-style: italic; color: rgba(255,255,255,0.65); }
.agni-msg-body a { color: #FF7F50; text-decoration: none; border-bottom: 1px solid rgba(255,127,80,0.3); }
.agni-msg-body a:hover { border-bottom-color: #FF7F50; }
.agni-msg-body code {
  background: rgba(255,255,255,0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "SF Mono", "Fira Code", "Cascadia Code", Consolas, monospace;
  font-size: 12.5px;
  color: #FF7F50;
}
.agni-msg-body pre {
  background: #0d0d14;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 14px 16px;
  overflow-x: auto;
  margin: 10px 0;
  font-size: 12.5px;
  line-height: 1.55;
}
.agni-msg-body pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  color: #ddd;
}
.agni-msg-body hr { border: none; border-top: 1px solid rgba(255,255,255,0.06); margin: 14px 0; }
.agni-msg-body blockquote {
  border-left: 3px solid #FF4500;
  padding: 6px 14px;
  margin: 10px 0;
  background: rgba(255,69,0,0.04);
  border-radius: 0 8px 8px 0;
  color: rgba(255,255,255,0.6);
}

/* Thinking animation */
.agni-msg-thinking {
  width: 100%;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(255,255,255,0.35);
  font-size: 13px;
  border-top: 1px solid rgba(255,255,255,0.04);
}
.agni-msg-thinking .agni-msg-avatar {
  background: linear-gradient(135deg, #FF4500, #FF7F50);
  color: #fff;
  width: 28px; height: 28px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0; font-weight: 700;
}
.agni-dots { display: flex; gap: 5px; }
.agni-dots span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #FF4500;
  opacity: 0.25;
  animation: agni-pulse 1.4s ease-in-out infinite;
}
.agni-dots span:nth-child(2) { animation-delay: 0.2s; }
.agni-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes agni-pulse {
  0%, 70%, 100% { opacity: 0.25; transform: scale(1); }
  35% { opacity: 1; transform: scale(1.3); }
}

/* ===== AI INPUT ===== */
#agni-ai-input-wrap {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
  background: rgba(0,0,0,0.2);
}
#agni-ai-input {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 10px 14px;
  color: #ddd;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  resize: none;
  min-height: 20px;
  max-height: 120px;
  line-height: 1.5;
}
#agni-ai-input::placeholder { color: rgba(255,255,255,0.2); }
#agni-ai-input:focus { border-color: rgba(255,69,0,0.5); }
#agni-ai-send {
  background: #FF4500;
  color: #fff;
  border: none;
  border-radius: 12px;
  width: 42px;
  height: 42px;
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  align-self: flex-end;
}
#agni-ai-send:hover { background: #e63e00; }
#agni-ai-send:disabled { opacity: 0.35; cursor: default; }

/* ===== WELCOME ===== */
.agni-welcome { text-align: center; padding: 32px 20px 24px; }
.agni-welcome-icon { font-size: 28px; margin-bottom: 8px; }
.agni-welcome h3 { font-size: 17px; font-weight: 700; margin: 0 0 4px; color: #FF4500; }
.agni-welcome p { font-size: 13px; color: rgba(255,255,255,0.35); margin: 0 0 16px; }
.agni-suggestions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.agni-sug {
  background: rgba(255,69,0,0.06);
  border: 1px solid rgba(255,69,0,0.12);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  color: #FF7F50;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.agni-sug:hover { background: rgba(255,69,0,0.12); border-color: rgba(255,69,0,0.25); }

/* ===== FOOTER ===== */
.agni-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11px;
  padding: 8px 16px;
  border-top: 1px solid rgba(255,255,255,0.04);
  flex-shrink: 0;
  color: rgba(255,255,255,0.18);
}
.agni-footer kbd {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 4px;
  padding: 0 5px;
  font-size: 10px;
  font-family: inherit;
  line-height: 1.7;
}

/* ================================================================
   LIGHT MODE
   ================================================================ */
html.light #agni-search-overlay, html:not(.dark) #agni-search-overlay { background: rgba(0,0,0,0.3); }
html.light #agni-search-modal, html:not(.dark) #agni-search-modal {
  background: #fff;
  border-color: rgba(0,0,0,0.08);
  box-shadow: 0 24px 80px rgba(0,0,0,0.18);
  color: #222;
}
html.light .agni-tabs, html:not(.dark) .agni-tabs { background: rgba(0,0,0,0.02); border-bottom-color: rgba(0,0,0,0.06); }
html.light .agni-tab, html:not(.dark) .agni-tab { color: rgba(0,0,0,0.35); }
html.light .agni-tab:hover, html:not(.dark) .agni-tab:hover { color: rgba(0,0,0,0.6); }
html.light .agni-tab.active, html:not(.dark) .agni-tab.active { color: #FF4500; }

/* Pagefind light */
html.light #agni-search-modal .pagefind-ui, html:not(.dark) #agni-search-modal .pagefind-ui {
  --pagefind-ui-text: #222; --pagefind-ui-background: #fff; --pagefind-ui-border: rgba(0,0,0,0.06);
}
html.light #agni-search-modal .pagefind-ui .pagefind-ui__search-input,
html:not(.dark) #agni-search-modal .pagefind-ui .pagefind-ui__search-input {
  color: #222; border-bottom-color: rgba(0,0,0,0.06);
}
html.light #agni-search-modal .pagefind-ui .pagefind-ui__search-input::placeholder,
html:not(.dark) #agni-search-modal .pagefind-ui .pagefind-ui__search-input::placeholder { color: rgba(0,0,0,0.3); }
html.light #agni-search-modal .pagefind-ui .pagefind-ui__result:hover,
html:not(.dark) #agni-search-modal .pagefind-ui .pagefind-ui__result:hover { background: rgba(0,0,0,0.03); }
html.light #agni-search-modal .pagefind-ui .pagefind-ui__result-excerpt,
html:not(.dark) #agni-search-modal .pagefind-ui .pagefind-ui__result-excerpt { color: rgba(0,0,0,0.45); }

/* AI chat light */
html.light .agni-msg-row + .agni-msg-row, html:not(.dark) .agni-msg-row + .agni-msg-row { border-top-color: rgba(0,0,0,0.04); }
html.light .agni-msg-content, html:not(.dark) .agni-msg-content { color: #333; }
html.light .agni-msg-row.user .agni-msg-content, html:not(.dark) .agni-msg-row.user .agni-msg-content { color: rgba(0,0,0,0.7); }
html.light .agni-msg-row.user .agni-msg-label, html:not(.dark) .agni-msg-row.user .agni-msg-label { color: rgba(0,0,0,0.35); }
html.light .agni-msg-row.user .agni-msg-avatar, html:not(.dark) .agni-msg-row.user .agni-msg-avatar { background: rgba(255,69,0,0.08); }
html.light .agni-msg-body h1, html.light .agni-msg-body h2, html.light .agni-msg-body h3,
html:not(.dark) .agni-msg-body h1, html:not(.dark) .agni-msg-body h2, html:not(.dark) .agni-msg-body h3 { color: #111; }
html.light .agni-msg-body h2, html:not(.dark) .agni-msg-body h2 { border-bottom-color: rgba(0,0,0,0.06); }
html.light .agni-msg-body strong, html:not(.dark) .agni-msg-body strong { color: #111; }
html.light .agni-msg-body code, html:not(.dark) .agni-msg-body code { background: rgba(0,0,0,0.05); color: #cc3700; }
html.light .agni-msg-body pre, html:not(.dark) .agni-msg-body pre {
  background: #1e1e2e; color: #ddd; border-color: rgba(0,0,0,0.08);
}
html.light .agni-msg-body a, html:not(.dark) .agni-msg-body a { color: #cc3700; border-bottom-color: rgba(204,55,0,0.3); }
html.light .agni-msg-body blockquote, html:not(.dark) .agni-msg-body blockquote { color: rgba(0,0,0,0.5); background: rgba(255,69,0,0.03); }
html.light .agni-msg-body hr, html:not(.dark) .agni-msg-body hr { border-top-color: rgba(0,0,0,0.06); }
html.light .agni-msg-body em, html:not(.dark) .agni-msg-body em { color: rgba(0,0,0,0.55); }
html.light .agni-msg-thinking, html:not(.dark) .agni-msg-thinking { color: rgba(0,0,0,0.3); border-top-color: rgba(0,0,0,0.04); }
html.light .agni-modal-header, html:not(.dark) .agni-modal-header { border-bottom-color: rgba(0,0,0,0.06); }
html.light .agni-clear-btn, html:not(.dark) .agni-clear-btn { color: rgba(0,0,0,0.35); border-color: rgba(0,0,0,0.08); }
html.light .agni-clear-btn:hover, html:not(.dark) .agni-clear-btn:hover { color: #FF4500; border-color: rgba(255,69,0,0.3); }
html.light .agni-copy-btn, html:not(.dark) .agni-copy-btn { background: rgba(0,0,0,0.05); border-color: rgba(0,0,0,0.08); color: rgba(0,0,0,0.4); }
html.light .agni-copy-btn:hover, html:not(.dark) .agni-copy-btn:hover { background: rgba(255,69,0,0.08); color: #cc3700; border-color: rgba(255,69,0,0.2); }
html.light #agni-ai-input-wrap, html:not(.dark) #agni-ai-input-wrap { background: rgba(0,0,0,0.02); border-top-color: rgba(0,0,0,0.06); }
html.light #agni-ai-input, html:not(.dark) #agni-ai-input {
  background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.08); color: #222;
}
html.light #agni-ai-input::placeholder, html:not(.dark) #agni-ai-input::placeholder { color: rgba(0,0,0,0.25); }
html.light #agni-ai-input:focus, html:not(.dark) #agni-ai-input:focus { border-color: rgba(255,69,0,0.4); }
html.light .agni-welcome p, html:not(.dark) .agni-welcome p { color: rgba(0,0,0,0.35); }
html.light .agni-sug, html:not(.dark) .agni-sug { color: #cc3700; background: rgba(255,69,0,0.04); border-color: rgba(255,69,0,0.12); }
html.light .agni-sug:hover, html:not(.dark) .agni-sug:hover { background: rgba(255,69,0,0.08); }
html.light .agni-footer, html:not(.dark) .agni-footer { color: rgba(0,0,0,0.18); border-top-color: rgba(0,0,0,0.04); }
html.light .agni-footer kbd, html:not(.dark) .agni-footer kbd { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.06); }

/* ================================================================
   BACK TO TOP BUTTON
   ================================================================ */
#agni-back-to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: #FF4500;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.25s, transform 0.25s, background 0.15s;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(255,69,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}
#agni-back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
#agni-back-to-top:hover { background: #e63e00; }
html.light #agni-back-to-top, html:not(.dark) #agni-back-to-top {
  box-shadow: 0 4px 16px rgba(255,69,0,0.2);
}

/* ================================================================
   READING TIME
   ================================================================ */
.agni-reading-time {
  display: inline-block;
  background: rgba(255,69,0,0.08);
  color: #FF4500;
  font-size: 12px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 12px;
  margin-top: 6px;
  letter-spacing: 0.01em;
}
html.light .agni-reading-time, html:not(.dark) .agni-reading-time {
  background: rgba(255,69,0,0.06);
  color: #cc3700;
}

/* ================================================================
   RELATED ARTICLES
   ================================================================ */
.agni-related-articles {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.agni-related-articles h4 {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 12px;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.agni-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}
.agni-related-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  color: #ddd;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
}
.agni-related-card:hover {
  background: rgba(255,69,0,0.06);
  border-color: rgba(255,69,0,0.15);
  color: #FF7F50;
}
.agni-related-arrow { font-size: 15px; opacity: 0.4; transition: opacity 0.15s; }
.agni-related-card:hover .agni-related-arrow { opacity: 1; }

/* Related articles light mode */
html.light .agni-related-articles, html:not(.dark) .agni-related-articles { border-top-color: rgba(0,0,0,0.06); }
html.light .agni-related-articles h4, html:not(.dark) .agni-related-articles h4 { color: rgba(0,0,0,0.4); }
html.light .agni-related-card, html:not(.dark) .agni-related-card {
  background: rgba(0,0,0,0.02);
  border-color: rgba(0,0,0,0.06);
  color: #333;
}
html.light .agni-related-card:hover, html:not(.dark) .agni-related-card:hover {
  background: rgba(255,69,0,0.04);
  border-color: rgba(255,69,0,0.12);
  color: #cc3700;
}

/* ================================================================
   MOBILE RESPONSIVE
   ================================================================ */

/* Tablet and below */
@media (max-width: 768px) {
  /* Search overlay - less top padding on mobile */
  #agni-search-overlay {
    padding: 4vh 8px 0;
  }

  /* Search modal - full width, taller */
  #agni-search-modal {
    max-width: 100%;
    max-height: 85vh;
    border-radius: 12px;
    font-size: 14px;
  }

  /* Modal header */
  .agni-modal-header {
    padding: 10px 12px;
  }

  /* AI messages - tighter padding */
  .agni-msg-row {
    padding: 12px 12px;
    gap: 10px;
  }

  /* Avatar - slightly smaller */
  .agni-msg-avatar {
    width: 24px;
    height: 24px;
    font-size: 12px;
    border-radius: 6px;
  }
  .agni-msg-row.assistant .agni-msg-avatar {
    font-size: 11px;
  }

  /* Message content */
  .agni-msg-content {
    font-size: 13px;
  }

  /* Code blocks - horizontal scroll */
  .agni-msg-body pre {
    padding: 10px 12px;
    font-size: 11.5px;
    border-radius: 8px;
  }

  /* AI input area */
  #agni-ai-input-wrap {
    padding: 10px 10px;
    gap: 6px;
  }
  #agni-ai-input {
    padding: 8px 12px;
    font-size: 14px;
    border-radius: 10px;
  }
  #agni-ai-send {
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }

  /* Welcome section */
  .agni-welcome {
    padding: 20px 14px 18px;
  }
  .agni-welcome-icon {
    font-size: 24px;
  }
  .agni-welcome h3 {
    font-size: 15px;
  }

  /* Suggestion chips - wrap better */
  .agni-suggestions {
    gap: 5px;
  }
  .agni-sug {
    padding: 5px 10px;
    font-size: 11px;
    white-space: normal;
    text-align: left;
  }

  /* Footer */
  .agni-footer {
    padding: 6px 10px;
    font-size: 10px;
  }

  /* Related articles - single column */
  .agni-related-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .agni-related-articles {
    margin-top: 32px;
    padding-top: 16px;
  }
  .agni-related-card {
    padding: 10px 12px;
    font-size: 13px;
  }

  /* Back to top - smaller and closer to edge */
  #agni-back-to-top {
    bottom: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  /* Progress bar */
  #agni-progress-bar {
    height: 2px;
  }

  /* Reading time badge */
  .agni-reading-time {
    font-size: 11px;
    padding: 2px 8px;
  }

  /* Copy button on code blocks */
  .agni-copy-btn {
    font-size: 10px;
    padding: 2px 8px;
    top: 6px;
    right: 6px;
  }

  /* Thinking animation */
  .agni-msg-thinking {
    padding: 12px 12px;
    gap: 10px;
    font-size: 12px;
  }
  .agni-msg-thinking .agni-msg-avatar {
    width: 24px;
    height: 24px;
    font-size: 11px;
  }
}

/* Small phones */
@media (max-width: 480px) {
  #agni-search-overlay {
    padding: 2vh 4px 0;
  }

  #agni-search-modal {
    max-height: 90vh;
    border-radius: 10px 10px 0 0;
  }

  .agni-msg-row {
    padding: 10px 10px;
    gap: 8px;
  }

  .agni-msg-avatar {
    width: 22px;
    height: 22px;
    font-size: 11px;
    border-radius: 5px;
  }

  .agni-msg-content {
    font-size: 13px;
    line-height: 1.6;
  }

  .agni-msg-body h1 { font-size: 15px; }
  .agni-msg-body h2 { font-size: 14px; }
  .agni-msg-body h3 { font-size: 13px; }

  .agni-msg-body pre {
    padding: 8px 10px;
    font-size: 11px;
    margin: 8px -10px;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .agni-msg-body ul, .agni-msg-body ol {
    padding-left: 16px;
  }

  .agni-welcome {
    padding: 16px 10px 14px;
  }
  .agni-welcome h3 {
    font-size: 14px;
  }
  .agni-welcome p {
    font-size: 12px;
    margin-bottom: 12px;
  }

  .agni-suggestions {
    flex-direction: column;
    align-items: stretch;
  }
  .agni-sug {
    text-align: center;
  }

  #agni-ai-input-wrap {
    padding: 8px 8px;
  }
  #agni-ai-input {
    padding: 8px 10px;
    font-size: 14px;
  }
  #agni-ai-send {
    width: 36px;
    height: 36px;
  }

  .agni-footer kbd {
    display: none;
  }
  .agni-footer {
    font-size: 10px;
    padding: 5px 8px;
  }

  #agni-back-to-top {
    bottom: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    font-size: 15px;
  }

  /* Pagefind search input */
  #agni-search-modal .pagefind-ui .pagefind-ui__search-input {
    font-size: 14px;
    padding: 12px 12px;
  }
}
