/* DocuForge AI — Strict 3-Color Neon & Dynamic Contrast System */
:root {
  /* Strict 3-Color Neon Palette */
  --neon-lime: #E3FF28;
  --neon-magenta: #EE29FF;
  --neon-purple: #7A49FF;

  /* Dark Monokai Glass Canvas (Default) */
  --bg-darker: #0B0719;
  --bg-dark: #120C29;
  --bg-card: rgba(18, 12, 41, 0.78);
  --bg-card-hover: rgba(28, 19, 64, 0.88);
  --bg-input: rgba(11, 7, 25, 0.95);
  
  --text-main: #FFFFFF;
  --text-muted: #A0A5C0;
  
  --border: rgba(122, 73, 255, 0.25);
  --border-glow: rgba(227, 255, 40, 0.4);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-display: 'Outfit', sans-serif;
  --font-sans: 'Inter', sans-serif;
}

/* LIGHT MODE: High-Contrast Inverted Cards on Full Neon Gradient Background */
body.light-theme {
  background: linear-gradient(135deg, #E3FF28 0%, #EE29FF 50%, #7A49FF 100%) !important;
  background-attachment: fixed !important;
  color: #0F172A;
}

body.light-theme .sidebar {
  background: rgba(15, 23, 42, 0.92) !important;
  backdrop-filter: blur(20px);
  border-right: 1px solid rgba(227, 255, 40, 0.3);
  color: #FFFFFF !important;
}

body.light-theme .sidebar h2,
body.light-theme .sidebar p,
body.light-theme .user-info h4 {
  color: #FFFFFF !important;
}

body.light-theme .sidebar .nav-menu button {
  color: #CBD5E1 !important;
}

body.light-theme .sidebar .nav-menu button.active {
  background: rgba(227, 255, 40, 0.18) !important;
  color: var(--neon-lime) !important;
  border-left: 4px solid var(--neon-lime) !important;
}

body.light-theme .card {
  background: rgba(15, 23, 42, 0.88) !important;
  backdrop-filter: blur(24px);
  border: 1px solid rgba(238, 41, 255, 0.35) !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3) !important;
  color: #F8FAFC !important;
}

body.light-theme .header-title h1 {
  background: linear-gradient(135deg, #0F172A, #381DA3) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
}

body.light-theme .header-title p,
body.light-theme .format-selection h4,
body.light-theme .text-muted-theme {
  color: #0F172A !important;
  font-weight: 700 !important;
}

body.light-theme textarea,
body.light-theme .markdown-body {
  background: #0B0719 !important;
  color: #F8FAFC !important;
  border: 1px solid rgba(227, 255, 40, 0.4) !important;
}

body.light-theme textarea:focus {
  border-color: var(--neon-lime) !important;
  box-shadow: 0 0 20px rgba(227, 255, 40, 0.4) !important;
}

body.light-theme .radio-label {
  background: rgba(255, 255, 255, 0.95) !important;
  color: #0F172A !important;
  border: 1px solid rgba(15, 23, 42, 0.3) !important;
  font-weight: 700 !important;
}

body.light-theme .radio-label:has(input:checked) {
  background: #0F172A !important;
  color: var(--neon-lime) !important;
  border-color: #0F172A !important;
}

body.light-theme .btn.primary {
  background: #0F172A !important;
  color: var(--neon-lime) !important;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.4) !important;
}

body.light-theme .btn.secondary {
  background: rgba(255, 255, 255, 0.95) !important;
  color: #0F172A !important;
  border: 1px solid rgba(15, 23, 42, 0.4) !important;
  font-weight: 700 !important;
}

/* BASE STYLES */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-darker);
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(122, 73, 255, 0.18) 0%, transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(238, 41, 255, 0.15) 0%, transparent 45%),
    radial-gradient(circle at 50% 50%, rgba(227, 255, 40, 0.08) 0%, transparent 50%);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.4s ease, color 0.4s ease;
}

/* App Layout Grid */
.app-container {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
  background: rgba(11, 7, 25, 0.88);
  backdrop-filter: blur(16px);
  border-right: 1px solid var(--border);
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 2.5rem;
}

.logo-img {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid var(--neon-lime);
  box-shadow: 0 0 15px rgba(227, 255, 40, 0.4);
}

.logo h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--neon-lime), #FFFFFF);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-grow: 1;
}

.nav-menu button,
.nav-menu a {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 500;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: var(--transition);
}

.nav-menu button:hover,
.nav-menu a:hover,
.nav-menu button.active,
.nav-menu a.active {
  color: var(--text-main);
  background: rgba(122, 73, 255, 0.15);
  border-color: rgba(122, 73, 255, 0.4);
}

.nav-menu button.active,
.nav-menu a.active {
  border-left: 4px solid var(--neon-lime);
  background: linear-gradient(90deg, rgba(227, 255, 40, 0.12), rgba(122, 73, 255, 0.05));
  color: var(--neon-lime);
  box-shadow: inset 0 0 15px rgba(227, 255, 40, 0.1);
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  cursor: pointer;
}

.user-profile:hover {
  background: rgba(122, 73, 255, 0.15);
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--neon-lime), var(--neon-magenta));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: var(--bg-darker);
  box-shadow: 0 0 12px rgba(227, 255, 40, 0.3);
}

.user-info h4 {
  font-size: 0.9rem;
  font-weight: 600;
}

.user-info p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Main Content Area */
.main-content {
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
}

.header-title h1 {
  font-family: var(--font-display);
  font-size: 2.3rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #FFFFFF 60%, var(--neon-lime));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-title p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.5rem 1.2rem;
  border-radius: 50px;
  background: rgba(227, 255, 40, 0.1);
  color: var(--neon-lime);
  border: 1px solid rgba(227, 255, 40, 0.3);
  box-shadow: 0 0 15px rgba(227, 255, 40, 0.15);
}

.status-badge::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--neon-lime);
  box-shadow: 0 0 10px var(--neon-lime);
}

/* Dashboard 2-column Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: stretch;
}

/* Card Styling */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.5);
  transition: var(--transition);
}

.card:hover {
  border-color: rgba(122, 73, 255, 0.5);
}

.card h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
}

/* Form inputs & Format Radios */
.form-group {
  display: flex;
  flex-grow: 1;
}

textarea {
  background-color: var(--bg-input);
  border: 1px solid var(--border);
  color: #E2E8F0;
  padding: 1.2rem;
  border-radius: var(--radius-md);
  font-family: 'Consolas', 'Fira Code', 'Monaco', monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  width: 100%;
  min-height: 280px;
  flex-grow: 1;
  resize: vertical;
  transition: var(--transition);
}

textarea:focus {
  outline: none;
  border-color: var(--neon-lime);
  box-shadow: 0 0 15px rgba(227, 255, 40, 0.25);
}

.format-selection {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
}

.format-selection h4 {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 600;
}

.radio-group {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.55rem 0.9rem;
  background-color: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  color: var(--text-muted);
}

.radio-label input {
  display: none;
}

.radio-label:hover {
  border-color: var(--neon-magenta);
  color: var(--text-main);
}

.radio-label:has(input:checked) {
  border-color: var(--neon-lime);
  color: var(--neon-lime);
  background: rgba(227, 255, 40, 0.12);
  box-shadow: 0 0 12px rgba(227, 255, 40, 0.15);
}

/* Action row */
.action-row {
  display: flex;
  justify-content: flex-end;
}

/* Buttons */
.btn {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.8rem 1.6rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn.primary {
  background: linear-gradient(135deg, var(--neon-lime), #C6FF00);
  color: #0B0719;
  box-shadow: 0 0 20px rgba(227, 255, 40, 0.3);
}

.btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(227, 255, 40, 0.5);
}

.btn.secondary {
  background: rgba(238, 41, 255, 0.1);
  color: var(--neon-magenta);
  border: 1px solid rgba(238, 41, 255, 0.4);
}

.btn.secondary:hover {
  background: rgba(238, 41, 255, 0.2);
  border-color: var(--neon-magenta);
  box-shadow: 0 0 15px rgba(238, 41, 255, 0.3);
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
}

/* Output actions layout */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.output-card textarea {
  min-height: 440px;
  background-color: var(--bg-input);
  border: 1px solid var(--border);
  color: #F8FAFC;
  padding: 1.25rem;
  border-radius: var(--radius-md);
  font-family: 'Consolas', 'Fira Code', 'Monaco', monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  width: 100%;
  resize: vertical;
}

/* Markdown Preview Container */
.markdown-body {
  padding: 1.25rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: #F8FAFC;
  min-height: 440px;
  overflow-y: auto;
  font-size: 0.95rem;
  line-height: 1.7;
}

.markdown-body h1, .markdown-body h2, .markdown-body h3 {
  font-family: var(--font-display);
  color: var(--neon-lime);
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

.markdown-body h1 { border-bottom: 1px solid var(--border); padding-bottom: 0.3rem; }
.markdown-body code {
  background: rgba(122, 73, 255, 0.2);
  color: var(--neon-magenta);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
}
.markdown-body pre {
  background: rgba(18, 12, 41, 0.9);
  border: 1px solid var(--border);
  padding: 1rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 1rem 0;
}
.markdown-body pre code {
  background: transparent;
  color: #E2E8F0;
  padding: 0;
}
.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}
.markdown-body th, .markdown-body td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
}
.markdown-body th {
  background: rgba(122, 73, 255, 0.2);
  color: var(--neon-lime);
}

/* Modal Operational Drawer */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 1;
  transition: var(--transition);
}

.modal-content {
  background: var(--bg-dark);
  border: 1px solid var(--neon-purple);
  box-shadow: 0 0 40px rgba(122, 73, 255, 0.4);
  border-radius: var(--radius-lg);
  padding: 2.2rem;
  width: 100%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

body.light-theme .modal-content {
  background: #0F172A !important;
  color: #FFFFFF !important;
  border-color: var(--neon-lime) !important;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.close-modal-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-main);
  font-size: 0.9rem;
}

body.light-theme .modal-input {
  background: #0B0719 !important;
  color: #FFFFFF !important;
}

/* Hidden Class */
.hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 1024px) {
  .app-container {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
}

@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .main-content {
    padding: 1.5rem;
  }
}

/* ==========================================
   🧠 RAG CODEBASE & TECHNICAL DOCS STYLING
   ========================================== */
.rag-quick-tag {
  background: rgba(122, 73, 255, 0.15);
  color: var(--neon-purple);
  border: 1px solid rgba(122, 73, 255, 0.4);
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.rag-quick-tag:hover {
  background: var(--neon-purple);
  color: #0B0719;
  border-color: var(--neon-purple);
  box-shadow: 0 0 12px rgba(122, 73, 255, 0.5);
}

.citation-card {
  background: rgba(11, 7, 25, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.citation-card:hover {
  border-color: var(--neon-purple);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(122, 73, 255, 0.2);
}

.citation-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}
.citation-title {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--neon-purple);
}
.citation-match-badge {
  background: rgba(227, 255, 40, 0.15);
  color: var(--neon-lime);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
}

.citation-text {
  font-size: 0.82rem;
  line-height: 1.5;
  color: #E2E8F0;
  background: rgba(0, 0, 0, 0.4);
  padding: 10px;
  border-radius: 6px;
  border-left: 3px solid var(--neon-purple);
  font-family: 'Consolas', 'Fira Code', monospace;
  white-space: pre-wrap;
  max-height: 160px;
  overflow-y: auto;
}

.citation-footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Mobile RAG & Touch UX Optimizations (< 768px) */
@media (max-width: 768px) {
  #view-rag-container > div:first-of-type {
    grid-template-columns: 1fr !important;
  }
  
  #rag-citations-grid {
    grid-template-columns: 1fr !important;
  }

  #mermaid-render-box {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

button, input, select, textarea, .nav-menu button, .rag-quick-tag {
  min-height: 44px;
  touch-action: manipulation;
}


