/* ==========================================================================
   NovaAI — Official Design Tokens, Component System & Documentation Styles
   Pure Vanilla CSS (Zero External CDN Dependencies)
   ========================================================================== */

:root {
  /* Brand Accents */
  --nova-primary: #4f46e5;       /* Indigo 600 */
  --nova-primary-glow: rgba(79, 70, 229, 0.35);
  --nova-secondary: #9333ea;     /* Purple 600 */
  --nova-accent: #ec4899;        /* Pink 500 */
  --nova-cyan: #06b6d4;          /* Cyan 500 */
  --nova-emerald: #10b981;       /* Emerald 500 */
  --nova-amber: #f59e0b;         /* Amber 500 */
  --nova-rose: #f43f5e;          /* Rose 500 */

  /* Surface & Background (Dark Mode Default) */
  --nova-bg: #070A0F;
  --nova-surface: #0B0F19;
  --nova-surface-card: #0E1424;
  --nova-border: rgba(255, 255, 255, 0.08);
  --nova-border-hover: rgba(99, 102, 241, 0.4);
  --nova-text-main: #F8FAFC;
  --nova-text-muted: #94A3B8;

  /* Typography */
  --nova-font: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --nova-font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Light Theme Variables */
html.light:root {
  --nova-bg: #F8FAFC;
  --nova-surface: #FFFFFF;
  --nova-surface-card: #FFFFFF;
  --nova-border: #E2E8F0;
  --nova-border-hover: rgba(99, 102, 241, 0.5);
  --nova-text-main: #0F172A;
  --nova-text-muted: #64748B;
}

/* ==========================================================================
   Custom Scrollbar
   ========================================================================== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.2);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.4);
}

/* ==========================================================================
   Documentation Page Global Typography & Surfaces
   ========================================================================== */
.doc-page {
  font-family: var(--nova-font);
  background-color: var(--nova-bg);
  color: var(--nova-text-main);
  min-height: 100vh;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* ==========================================================================
   Documentation Layout (Rock-Solid Flex & Grid)
   ========================================================================== */
.doc-layout-container {
  max-width: 82rem;
  margin-left: auto;
  margin-right: auto;
  padding: 2rem 1.25rem 6rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  position: relative;
  z-index: 10;
}

@media (min-width: 1024px) {
  .doc-layout-container {
    flex-direction: row;
    align-items: stretch;
    gap: 3rem;
    padding: 2.5rem 2rem 8rem;
  }
}

/* Sidebar - Stable Fixed Navigation with Independent Scroll */
.doc-sidebar {
  width: 100%;
  flex-shrink: 0;
}

@media (min-width: 1024px) {
  .doc-sidebar {
    width: 18.5rem; /* ~296px */
    flex-shrink: 0;
    position: -webkit-sticky;
    position: sticky;
    top: 5rem;
    height: calc(100vh - 6.5rem);
    max-height: calc(100vh - 6.5rem);
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(99, 102, 241, 0.3) transparent;
  }
  .doc-sidebar::-webkit-scrollbar {
    width: 4px;
  }
  .doc-sidebar::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.3);
    border-radius: 4px;
  }
}

.doc-sidebar-sticky {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Main Content Area */
.doc-main {
  flex: 1 1 0%;
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 3.5rem;
}

.doc-section {
  scroll-margin-top: 6rem;
}

.doc-section > * + * {
  margin-top: 1rem;
}

/* Grids */
.doc-grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 1rem;
}
@media (min-width: 640px) {
  .doc-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.doc-grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
  margin-top: 1rem;
}
@media (min-width: 640px) {
  .doc-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ==========================================================================
   Cards & Surfaces
   ========================================================================== */
.glass-card {
  background-color: rgba(14, 20, 36, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--nova-border);
  border-radius: 1rem;
  transition: all 0.2s ease-in-out;
}

html.light .glass-card {
  background-color: #FFFFFF;
  border-color: #E2E8F0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
}

.glass-card:hover {
  border-color: var(--nova-border-hover);
}

/* Page Catalog Card */
.doc-page-card {
  display: block;
  padding: 1.1rem 1.25rem;
  border-radius: 0.875rem;
  background-color: rgba(14, 20, 36, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-decoration: none;
  transition: all 0.2s ease;
}

html.light .doc-page-card {
  background-color: #FFFFFF;
  border-color: #E2E8F0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.doc-page-card:hover {
  border-color: rgba(99, 102, 241, 0.5);
  background-color: rgba(79, 70, 229, 0.08);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.12);
}

html.light .doc-page-card:hover {
  background-color: #F8FAFC;
  border-color: #818CF8;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.08);
}

/* ==========================================================================
   Table of Contents Nav
   ========================================================================== */
.doc-toc-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.85rem;
  border-radius: 0.625rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #94A3B8;
  transition: all 0.15s ease-in-out;
  text-decoration: none;
  border: 1px solid transparent;
}

.doc-toc-link:hover {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.05);
}

html.light .doc-toc-link {
  color: #64748B;
}

html.light .doc-toc-link:hover {
  color: #0F172A;
  background: #F1F5F9;
}

.doc-toc-link.active {
  color: #FFFFFF;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.3), rgba(147, 51, 234, 0.25));
  border-color: rgba(99, 102, 241, 0.4);
}

html.light .doc-toc-link.active {
  color: #4F46E5;
  background: #EEF2FF;
  border-color: #C7D2FE;
}

/* ==========================================================================
   Code Snippet Box
   ========================================================================== */
.doc-code-box {
  border-radius: 0.875rem;
  background: #05070B;
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-top: 0.85rem;
  margin-bottom: 0.85rem;
}

html.light .doc-code-box {
  background: #0B0F19;
  border-color: #334155;
}

.doc-code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.75rem;
  font-family: var(--nova-font-mono);
  color: #94A3B8;
}

.doc-code-pre {
  margin: 0;
  padding: 1rem 1.25rem;
  font-family: var(--nova-font-mono);
  font-size: 0.78rem;
  line-height: 1.65;
  color: #E2E8F0;
  overflow-x: auto;
}

/* ==========================================================================
   Light Mode Typography & Element Overrides
   ========================================================================== */
html.light .doc-page h1,
html.light .doc-page h2,
html.light .doc-page h3,
html.light .doc-page .text-white {
  color: #0F172A !important;
}

html.light .doc-page .text-slate-100,
html.light .doc-page .text-slate-200,
html.light .doc-page .text-slate-300 {
  color: #334155 !important;
}

html.light .doc-page .text-slate-400 {
  color: #64748B !important;
}

html.light .doc-page .text-slate-500 {
  color: #94A3B8 !important;
}

html.light .doc-page .border-white\/10 {
  border-color: #E2E8F0 !important;
}

html.light .doc-page .bg-white\/5 {
  background-color: #F1F5F9 !important;
}

html.light .doc-page .bg-white\/10 {
  background-color: #E2E8F0 !important;
}

html.light header.doc-header,
html.light .doc-header {
  background-color: rgba(255, 255, 255, 0.92) !important;
  border-color: #E2E8F0 !important;
}

/* ==========================================================================
   Ambient Background Floating Orbs & Futuristic Glow Effects
   ========================================================================== */
@keyframes floatOrb1 {
  0%, 100% { transform: translate(0px, 0px) scale(1); }
  50% { transform: translate(30px, -25px) scale(1.08); }
}

@keyframes floatOrb2 {
  0%, 100% { transform: translate(0px, 0px) scale(1); }
  50% { transform: translate(-35px, 20px) scale(0.95); }
}

@keyframes subtlePulseGlow {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.65; }
}

.ambient-orb-1 {
  animation: floatOrb1 12s ease-in-out infinite;
  pointer-events: none;
}

.ambient-orb-2 {
  animation: floatOrb2 16s ease-in-out infinite;
  pointer-events: none;
}

.glow-pulse {
  animation: subtlePulseGlow 4s ease-in-out infinite;
}

/* Floating Corner Chatbot Widget Styling */
#corner-chatbot-widget {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}

#corner-chatbot-widget.collapsed {
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  pointer-events: none;
}

#corner-chatbot-launcher {
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

#corner-chatbot-launcher:hover {
  transform: scale(1.08);
}
/* ==========================================================================
   High-Contrast Dark & Light Mode Theme Adaptations
   ========================================================================== */

/* API Keys & Tokens Display */
.api-key-card {
  transition: all 0.2s ease;
}

html.dark .api-key-card {
  background: #0E131F !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

html:not(.dark) .api-key-card {
  background: #FFFFFF !important;
  border-color: #E2E8F0 !important;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05) !important;
}

/* API Key Hash Input Box */
html.dark .api-key-hash-box {
  background: #070A0F !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: #34D399 !important;
}

html:not(.dark) .api-key-hash-box {
  background: #F1F5F9 !important;
  border: 1px solid #CBD5E1 !important;
  color: #047857 !important;
}

html.dark .api-key-hash-text {
  color: #34D399 !important;
}

html:not(.dark) .api-key-hash-text {
  color: #047857 !important;
  font-weight: 700 !important;
}

/* Code Studio Live Canvas High-Contrast Adaptations */
html:not(.dark) #live-canvas-sandbox-stage .canvas-card,
html:not(.dark) .code-canvas-preview-card {
  background: #FFFFFF !important;
  border: 1px solid #E2E8F0 !important;
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.08) !important;
  color: #0F172A !important;
}

html:not(.dark) #live-canvas-sandbox-stage .canvas-card h4,
html:not(.dark) .code-canvas-preview-card h4,
html:not(.dark) .code-canvas-preview-card .card-main-title {
  color: #0F172A !important;
}

html:not(.dark) #live-canvas-sandbox-stage .canvas-card p,
html:not(.dark) .code-canvas-preview-card p,
html:not(.dark) .code-canvas-preview-card .card-subtext {
  color: #475569 !important;
}

html:not(.dark) #live-canvas-sandbox-stage .canvas-card .radar-box {
  background: #F8FAFC !important;
  border: 1px solid #E2E8F0 !important;
}

html:not(.dark) #live-canvas-sandbox-stage .canvas-card #radar-latency-num {
  color: #0891B2 !important;
}

html.dark #live-canvas-sandbox-stage .canvas-card,
html.dark .code-canvas-preview-card {
  background: #090F1E !important;
  border: 1px solid rgba(6, 182, 212, 0.3) !important;
  color: #FFFFFF !important;
}

html.dark #live-canvas-sandbox-stage .canvas-card h4,
html.dark .code-canvas-preview-card h4 {
  color: #FFFFFF !important;
}

/* Loading Showcase High-Contrast Adaptations */
html:not(.dark) .loading-step-card {
  background: #FFFFFF !important;
  border: 1px solid #E2E8F0 !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04) !important;
}

html:not(.dark) .loading-step-card h4 {
  color: #0F172A !important;
  font-weight: 700 !important;
}

html:not(.dark) .loading-step-card p {
  color: #475569 !important;
}

html:not(.dark) .shimmer-skeleton-bar {
  background: #E2E8F0 !important;
}

html.dark .shimmer-skeleton-bar {
  background: rgba(255, 255, 255, 0.08) !important;
}

/* ==========================================================================
   Sidebar Collapse & Expand System
   ========================================================================== */

/* Smooth layout transitions */
aside {
  transition: width 0.28s cubic-bezier(0.16, 1, 0.3, 1), transform 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.main-content-layout,
.flex-1.lg\:pl-64 {
  transition: padding-left 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

@media (min-width: 1024px) {
  body.sidebar-collapsed aside {
    width: 80px !important;
  }

  /* Logo: hide text, center icon */
  body.sidebar-collapsed aside .p-4.border-b a > div:last-child,
  body.sidebar-collapsed aside a[title="NovaAI Home"] > div:last-child,
  body.sidebar-collapsed aside .sidebar-logo-text {
    display: none !important;
  }
  body.sidebar-collapsed aside a[title="NovaAI Home"] {
    justify-content: center !important;
    width: 100% !important;
  }

  /* Category headers */
  body.sidebar-collapsed aside .category-header,
  body.sidebar-collapsed aside [class*="uppercase"][class*="tracking-wider"] {
    display: none !important;
  }

  /* Navigation links: hide label and badges, center icon */
  body.sidebar-collapsed aside a > div.flex > span,
  body.sidebar-collapsed aside a > div.flex > span.block,
  body.sidebar-collapsed aside nav a > span,
  body.sidebar-collapsed aside nav a > div:not(.sidebar-icon-box),
  body.sidebar-collapsed aside a > span.inline-block,
  body.sidebar-collapsed aside a > span[class*="text-[10px]"],
  body.sidebar-collapsed aside .sidebar-hide-on-collapse {
    display: none !important;
  }

  body.sidebar-collapsed aside a,
  body.sidebar-collapsed aside nav a {
    justify-content: center !important;
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }

  body.sidebar-collapsed aside a > div.flex {
    justify-content: center !important;
    gap: 0 !important;
  }

  body.sidebar-collapsed aside a svg,
  body.sidebar-collapsed aside a i,
  body.sidebar-collapsed aside nav a svg,
  body.sidebar-collapsed aside nav a i {
    margin: 0 auto !important;
  }

  /* Credit widget: hide */
  body.sidebar-collapsed aside .credit-widget,
  body.sidebar-collapsed aside .p-3.border-t:not(:last-child) {
    display: none !important;
  }

  /* User profile: hide name/role and logout button, center avatar */
  body.sidebar-collapsed aside .user-info,
  body.sidebar-collapsed aside .p-3.border-t:last-child .min-w-0.block,
  body.sidebar-collapsed aside .p-3.border-t:last-child button[title="Sign Out"],
  body.sidebar-collapsed aside .p-3.border-t:last-child a[title="Sign Out"] {
    display: none !important;
  }

  body.sidebar-collapsed aside .p-3.border-t:last-child > div {
    justify-content: center !important;
    padding: 0.25rem !important;
  }

  /* Main content layout adjustment */
  body.sidebar-collapsed .lg\:pl-64,
  body.sidebar-collapsed .main-content-layout {
    padding-left: 80px !important;
  }

  /* Flip collapse toggle icon */
  body.sidebar-collapsed #sidebar-toggle svg,
  body.sidebar-collapsed #sidebar-toggle i,
  body.sidebar-collapsed button[aria-label="Collapse Sidebar"] svg,
  body.sidebar-collapsed button[aria-label="Collapse Sidebar"] i {
    transform: rotate(180deg) !important;
    transition: transform 0.25s ease !important;
  }
}

/* ==========================================================================
   Landing Page Futuristic Micro-Animations & Interactive Spotlight System
   ========================================================================== */

/* 1. Interactive Mouse Spotlight Card Effect (Linear/Vercel Aesthetic) */
.spotlight-card {
  position: relative;
  isolation: isolate;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.28s ease, border-color 0.28s ease;
}

.spotlight-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: radial-gradient(420px circle at var(--mouse-x, -9999px) var(--mouse-y, -9999px), rgba(99, 102, 241, 0.45), rgba(168, 85, 247, 0.25) 30%, transparent 60%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 2;
}

.spotlight-card:hover::before {
  opacity: 1;
}

.spotlight-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 40px -15px rgba(99, 102, 241, 0.15);
}

html:not(.dark) .spotlight-card::before {
  background: radial-gradient(400px circle at var(--mouse-x, -9999px) var(--mouse-y, -9999px), rgba(99, 102, 241, 0.35), rgba(236, 72, 153, 0.2) 30%, transparent 60%);
}

/* 2. Floating Badge Levitation Physics */
@keyframes floatLevitate1 {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-9px) rotate(0.4deg);
  }
}

@keyframes floatLevitate2 {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-11px) rotate(-0.5deg);
  }
}

.animate-float-levitate-1 {
  animation: floatLevitate1 5.5s ease-in-out infinite;
}

.animate-float-levitate-2 {
  animation: floatLevitate2 6.5s ease-in-out infinite 1.2s;
}

/* 3. Hero Holographic Gradient Glow Line */
@keyframes cyberGlowSweep {
  0% {
    left: -40%;
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    left: 120%;
    opacity: 0;
  }
}

.cyber-glow-bar {
  position: relative;
  overflow: hidden;
}

.cyber-glow-bar::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 45%;
  background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.7), rgba(236, 72, 153, 0.7), transparent);
  animation: cyberGlowSweep 3.8s ease-in-out infinite;
  pointer-events: none;
}

/* 4. Marquee Card Lift on Hover */
.marquee-item {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease, box-shadow 0.2s ease;
}
.marquee-item:hover {
  transform: translateY(-3px) scale(1.02);
  border-color: rgba(99, 102, 241, 0.6) !important;
  box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.25);
}

/* 5. Animated Equalizer Waveform */
@keyframes eqBarPulse {
  0%, 100% { transform: scaleY(0.25); }
  50% { transform: scaleY(1); }
}

.eq-bar-active {
  animation: eqBarPulse 0.65s ease-in-out infinite alternate;
  transform-origin: bottom;
}

