/* ============================================
   CDAC CCEE Documentation - Modern Theme
   A vibrant, eye-friendly design with glassmorphism
   ============================================ */

/* ============ CSS Variables ============ */
:root {
  /* Primary Colors - Vibrant Indigo/Purple */
  --primary-50: #eef2ff;
  --primary-100: #e0e7ff;
  --primary-200: #c7d2fe;
  --primary-300: #a5b4fc;
  --primary-400: #818cf8;
  --primary-500: #6366f1;
  --primary-600: #4f46e5;
  --primary-700: #4338ca;

  /* Accent - Teal */
  --accent-400: #2dd4bf;
  --accent-500: #14b8a6;
  --accent-600: #0d9488;

  /* Warm Accent - Amber */
  --amber-400: #fbbf24;
  --amber-500: #f59e0b;
  --amber-600: #d97706;

  /* Success - Green */
  --green-400: #4ade80;
  --green-500: #22c55e;
  --green-600: #16a34a;

  /* Error - Rose */
  --rose-400: #fb7185;
  --rose-500: #f43f5e;
  --rose-600: #e11d48;

  /* Dark Theme Background */
  --bg-base: #0a0a12;
  --bg-surface: #12121f;
  --bg-elevated: #1a1a2e;
  --bg-card: #1e1e32;
  --bg-hover: #252542;

  /* Text Colors */
  --text-primary: #f0f0f5;
  --text-secondary: #a5a5b8;
  --text-muted: #6b6b80;

  /* Borders */
  --border-color: rgba(99, 102, 241, 0.2);
  --border-subtle: rgba(255, 255, 255, 0.06);

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
  --gradient-accent: linear-gradient(135deg, #14b8a6 0%, #06b6d4 100%);
  --gradient-warm: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  --gradient-surface: linear-gradient(180deg, rgba(99, 102, 241, 0.05) 0%, transparent 100%);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);

  /* Glass Effect */
  --glass-bg: rgba(30, 30, 50, 0.7);
  --glass-border: rgba(255, 255, 255, 0.1);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Override just-the-docs variables */
  --site-text-color: var(--text-primary);
  --site-background-color: var(--bg-base);
  --nav-background-color: var(--bg-surface);
  --link-color: var(--primary-400);
  --code-background-color: var(--bg-elevated);
  --search-background-color: var(--bg-elevated);
}

/* ============ Base Styles ============ */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.7;
  color: var(--text-primary);
  background: var(--bg-base);
  background-image:
    radial-gradient(at 20% 30%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
    radial-gradient(at 80% 70%, rgba(139, 92, 246, 0.06) 0%, transparent 50%);
  background-attachment: fixed;
  margin: 0;
  padding: 0;
}

/* ============ Layout Structure ============ */
.page-wrap {
  display: flex;
  min-height: 100vh;
}

.side-bar {
  width: 280px;
  min-width: 280px;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  overflow-y: auto;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--glass-border);
  z-index: 100;
  transition: transform var(--transition-base);
  scroll-behavior: auto;
}

.main {
  flex: 1;
  margin-left: 280px;
  min-width: 0;
  background: transparent;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.5rem 2rem;
  min-height: 3rem;
}

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

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.mobile-menu-toggle span {
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  transition: all var(--transition-fast);
  border-radius: 2px;
}

.mobile-menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

/* Site Title Wrap */
.site-title-wrap {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.site-title {
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
  display: inline-block;
}

/* ============ Typography ============ */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 2rem;
  margin-bottom: 1rem;
  line-height: 1.3;
}

h1 {
  font-size: 2.5rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  border-bottom: none;
  padding-bottom: 0;
}

h2 {
  font-size: 1.875rem;
  color: var(--primary-300);
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.5rem;
}

h3 {
  font-size: 1.5rem;
  color: var(--accent-400);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.3rem;
}

h4 {
  font-size: 1.25rem;
  color: var(--amber-400);
  border-bottom: none;
}

h5,
h6 {
  font-size: 1.1rem;
  color: var(--text-secondary);
  border-bottom: none;
}

p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

a {
  color: var(--primary-400);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-300);
  text-decoration: underline;
}

strong,
b {
  color: var(--text-primary);
  font-weight: 600;
}

/* ============ Sidebar Navigation ============ */
.site-nav {
  padding: 1rem 0;
}

.nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-list-item {
  margin: 0.25rem 0;
  position: relative;
}

/* Chevron icon for expandable items */
.nav-chevron {
  display: inline-block;
  margin-left: auto;
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.nav-list-expander-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.nav-list-expander-link.expanded .nav-chevron {
  transform: rotate(90deg);
}

.nav-list-link {
  color: var(--text-secondary);
  padding: 0.6rem 1.5rem;
  border-radius: 0 2rem 2rem 0;
  margin-right: 0.5rem;
  transition: all var(--transition-base);
  font-size: 0.9rem;
  display: block;
  border-left: 3px solid transparent;
  text-decoration: none;
}

.nav-list-link:hover {
  color: var(--text-primary);
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.15) 0%, transparent 100%);
  border-left-color: var(--primary-400);
  text-decoration: none;
  transform: translateX(4px);
}

.nav-list-link.active {
  color: var(--primary-300);
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.2) 0%, transparent 100%);
  border-left-color: var(--primary-400);
  font-weight: 600;
}

/* Child navigation lists */
.nav-list-child {
  list-style: none;
  padding-left: 1.5rem;
  margin: 0.25rem 0;
  display: none;
  border-left: 1px solid var(--border-subtle);
  margin-left: 1rem;
}

.nav-list-child .nav-list-link {
  font-size: 0.85rem;
  padding: 0.5rem 1.5rem;
  opacity: 0.9;
}

.nav-list-child .nav-list-child {
  padding-left: 1rem;
  margin-left: 0.5rem;
}

.nav-list-child .nav-list-child .nav-list-link {
  font-size: 0.8rem;
  padding: 0.4rem 1.5rem;
  opacity: 0.85;
}

.nav-list-child .nav-list-child .nav-list-child {
  padding-left: 0.75rem;
  margin-left: 0.5rem;
}

.nav-list-child .nav-list-child .nav-list-child .nav-list-link {
  font-size: 0.75rem;
  padding: 0.35rem 1.5rem;
  opacity: 0.8;
}

/* Parent items styling */
.nav-list>.nav-list-item {
  margin: 0.5rem 0;
}

.nav-list>.nav-list-item>.nav-list-link {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
}

/* ============ Main Content ============ */
.main-content {
  max-width: 900px;
  padding: 2rem 3rem;
}

.main-content-wrap {
  background: var(--gradient-surface);
  min-height: calc(100vh - 200px);
}

/* ============ Search ============ */
.search-input {
  background: var(--bg-elevated) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 12px !important;
  color: var(--text-primary) !important;
  padding: 0.75rem 1rem !important;
  transition: all var(--transition-base) !important;
}

.search-input:focus {
  border-color: var(--primary-400) !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2) !important;
  outline: none !important;
}

.search-input::placeholder {
  color: var(--text-muted) !important;
}

/* ============ Code Blocks ============ */
code {
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  background: rgba(99, 102, 241, 0.15);
  color: var(--amber-400);
  padding: 0.2em 0.5em;
  border-radius: 6px;
  font-size: 0.875em;
  border: 1px solid rgba(99, 102, 241, 0.2);
}

pre {
  background: var(--bg-elevated) !important;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  position: relative;
  margin: 1.5rem 0;
}

pre::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-primary);
  border-radius: 12px 12px 0 0;
}

pre code {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--text-primary);
  font-size: 0.85rem;
  line-height: 1.6;
}

/* Syntax Highlighting */
.highlight .k,
.highlight .kd,
.highlight .kn {
  color: #c792ea;
}

/* Keywords */
.highlight .s,
.highlight .s1,
.highlight .s2 {
  color: #c3e88d;
}

/* Strings */
.highlight .n,
.highlight .nf {
  color: #82aaff;
}

/* Names, Functions */
.highlight .c,
.highlight .c1,
.highlight .cm {
  color: #676e95;
  font-style: italic;
}

/* Comments */
.highlight .mi,
.highlight .mf {
  color: #f78c6c;
}

/* Numbers */
.highlight .o {
  color: #89ddff;
}

/* Operators */
.highlight .p {
  color: #89ddff;
}

/* Punctuation */
.highlight .nb {
  color: #ffcb6b;
}

/* Built-in */
.highlight .nc {
  color: #ffcb6b;
}

/* Class */

/* ============ Tables ============ */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 1.5rem 0;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  /* Mobile scrolling support */
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

thead {
  background: var(--gradient-primary);
}

th {
  color: white !important;
  font-weight: 600;
  padding: 1rem 1.25rem;
  text-align: left;
  border: none !important;
}

td {
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

tr {
  background: var(--bg-surface);
  transition: background var(--transition-fast);
}

tbody tr:hover {
  background: var(--bg-hover);
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:nth-child(even) {
  background: var(--bg-elevated);
}

tbody tr:nth-child(even):hover {
  background: var(--bg-hover);
}

/* ============ Blockquotes ============ */
blockquote {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.05) 100%);
  border-left: 4px solid var(--primary-400);
  border-radius: 0 12px 12px 0;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  color: var(--text-secondary);
}

blockquote p:last-child {
  margin-bottom: 0;
}

/* ============ Callout Boxes ============ */
/* Note - Blue */
.callout-note,
blockquote:has(> p:first-child > strong:first-child:contains("Note")) {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(59, 130, 246, 0.05) 100%);
  border-left-color: #3b82f6;
}

/* Tip - Green */
.callout-tip {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15) 0%, rgba(34, 197, 94, 0.05) 100%);
  border-left: 4px solid var(--green-500);
  border-radius: 0 12px 12px 0;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
}

/* Warning - Amber */
.callout-warning {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(245, 158, 11, 0.05) 100%);
  border-left: 4px solid var(--amber-500);
  border-radius: 0 12px 12px 0;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
}

/* Important - Rose */
.callout-important {
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.15) 0%, rgba(244, 63, 94, 0.05) 100%);
  border-left: 4px solid var(--rose-500);
  border-radius: 0 12px 12px 0;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all var(--transition-base);
  cursor: pointer;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white !important;
  box-shadow: var(--shadow-md), 0 0 20px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), 0 0 30px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary-400);
  color: var(--primary-400) !important;
}

.btn-outline:hover {
  background: rgba(99, 102, 241, 0.1);
  border-color: var(--primary-300);
  color: var(--primary-300) !important;
}

/* ============ Cards ============ */
.card {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 1.5rem;
  transition: all var(--transition-base);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  border-color: var(--primary-400);
}

/* ============ Lists ============ */
ul,
ol {
  padding-left: 1.5rem;
  margin: 1rem 0;
}

li {
  color: var(--text-secondary);
  margin: 0.5rem 0;
  line-height: 1.7;
}

li::marker {
  color: var(--primary-400);
}

ul li::marker {
  content: "▸ ";
}

/* ============ Horizontal Rule ============ */
hr {
  border: none;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary-400), transparent);
  margin: 2.5rem 0;
}

/* ============ Labels/Tags ============ */
.label {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.label-blue {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.label-green {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.label-yellow {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.label-red {
  background: rgba(244, 63, 94, 0.2);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.label-purple {
  background: rgba(139, 92, 246, 0.2);
  color: #a78bfa;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

/* ============ Table of Contents ============ */
.toc {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem;
  margin: 1.5rem 0;
}

.toc-title {
  color: var(--primary-300);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

/* ============ Footer ============ */
.site-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ============ Custom Scrollbar ============ */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-base);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-hover);
  border-radius: 10px;
  border: 2px solid var(--bg-base);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-600);
}

/* ============ Selection ============ */
::selection {
  background: rgba(99, 102, 241, 0.4);
  color: white;
}

/* ============ Animations ============ */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.7;
  }
}

@keyframes glow {

  0%,
  100% {
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
  }

  50% {
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.5);
  }
}

.animate-fade-in {
  animation: fadeIn 0.5s ease-out;
}

.animate-slide-in {
  animation: slideIn 0.5s ease-out;
}

/* ============ Hero Section ============ */
.hero {
  background: linear-gradient(135deg, var(--bg-elevated) 0%, var(--bg-base) 100%);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 3rem;
  margin: 1rem 0 2rem 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-primary);
}

.hero::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 50% 50%, rgba(99, 102, 241, 0.1) 0%, transparent 50%);
  pointer-events: none;
}

.hero h1 {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.hero p {
  font-size: 1.2rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 2rem auto;
}

/* ============ Module Cards Grid ============ */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.module-card {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 1.5rem;
  transition: all var(--transition-base);
  text-decoration: none !important;
  display: block;
  position: relative;
  overflow: hidden;
}

.module-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.module-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-400);
}

.module-card:hover::before {
  opacity: 1;
}

.module-card h3 {
  color: var(--text-primary) !important;
  margin: 0 0 0.5rem 0;
  font-size: 1.25rem;
  border: none;
  padding: 0;
}

.module-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
}

.module-card .icon {
  font-size: 2rem;
  margin-bottom: 1rem;
}

/* Card Color Variants */
.module-card.card-indigo {
  border-top: 3px solid var(--primary-500);
}

.module-card.card-teal {
  border-top: 3px solid var(--accent-500);
}

.module-card.card-amber {
  border-top: 3px solid var(--amber-500);
}

.module-card.card-green {
  border-top: 3px solid var(--green-500);
}

.module-card.card-rose {
  border-top: 3px solid var(--rose-500);
}

/* ============ MCQ Quiz Styles ============ */
.question-block {
  background: var(--bg-elevated) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 16px !important;
  padding: 1.5rem !important;
  margin-bottom: 1.5rem !important;
  transition: all var(--transition-base);
}

.question-block:hover {
  border-color: var(--primary-400) !important;
  box-shadow: var(--shadow-md);
}

.question-block h3 {
  color: var(--text-primary) !important;
  font-size: 1.1rem !important;
  margin: 0 0 1rem 0 !important;
  border: none !important;
  padding: 0 !important;
}

.question-block label {
  display: flex !important;
  align-items: center !important;
  padding: 0.75rem 1rem !important;
  border-radius: 10px !important;
  transition: all var(--transition-fast) !important;
  cursor: pointer;
  color: var(--text-secondary) !important;
}

.question-block label:hover {
  background: rgba(99, 102, 241, 0.1) !important;
  color: var(--text-primary) !important;
}

.question-block input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-radius: 50%;
  margin-right: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.question-block input[type="radio"]:checked {
  border-color: var(--primary-400);
  background: var(--primary-500);
}

.question-block input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
}

#result-container {
  background: var(--bg-elevated) !important;
  border: 1px solid var(--primary-400) !important;
  border-radius: 16px !important;
  padding: 2rem !important;
  margin-top: 2rem;
  animation: fadeIn 0.5s ease-out;
}

#result-container h3 {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0 0 1rem 0 !important;
  border: none !important;
}

/* MCQ Markdown/Code Styling */
.mcq-question-text,
.mcq-option-text {
  display: inline;
}

.mcq-question-text code,
.mcq-option-text code {
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  background: rgba(99, 102, 241, 0.2);
  color: var(--amber-400);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.85em;
  border: 1px solid rgba(99, 102, 241, 0.3);
  white-space: pre-wrap;
  word-break: break-word;
}

.question-block h3 .mcq-question-text code {
  font-size: 0.8em;
  display: inline-block;
  max-width: 100%;
  overflow-wrap: break-word;
}

/* For longer code blocks in questions */
.mcq-question-text code:only-child,
.mcq-question-text>code:first-child:last-child {
  display: block;
  margin-top: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--bg-surface);
  border-radius: 8px;
  line-height: 1.5;
}

/* ============ Aux Links ============ */
.aux-nav {
  display: flex;
  align-items: center;
}

.aux-nav-list {
  display: flex;
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.aux-nav-list-item a {
  background: var(--bg-elevated);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  text-decoration: none;
  font-size: 0.9rem;
  display: inline-block;
}

.aux-nav-list-item a:hover {
  background: var(--primary-500);
  color: white;
  text-decoration: none;
}

.btn-accent {
  background: var(--gradient-accent);
  color: white !important;
  box-shadow: var(--shadow-md), 0 0 20px rgba(20, 184, 166, 0.3);
}

.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), 0 0 30px rgba(20, 184, 166, 0.4);
  text-decoration: none;
}

/* Hero Buttons */
.hero-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 2rem;
  position: relative;
  z-index: 10;
}

.hero-buttons .btn {
  min-width: 160px;
}

/* ============ Quick Access Grid ============ */
.quick-access-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.access-card {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 1.5rem;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.access-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.access-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-400);
}

.access-card:hover::before {
  opacity: 1;
}

.access-card h3 {
  color: var(--text-primary) !important;
  margin: 0 0 1rem 0;
  font-size: 1.1rem;
  border: none;
  padding: 0;
}

.access-links {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.access-link {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  text-decoration: none !important;
  border: 1px solid transparent;
}

.access-link.notes {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(99, 102, 241, 0.05) 100%);
  color: var(--primary-300);
  border-color: rgba(99, 102, 241, 0.2);
}

.access-link.notes:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25) 0%, rgba(99, 102, 241, 0.1) 100%);
  border-color: var(--primary-400);
  transform: translateX(4px);
}

.access-link.mcq {
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.15) 0%, rgba(20, 184, 166, 0.05) 100%);
  color: var(--accent-400);
  border-color: rgba(20, 184, 166, 0.2);
}

.access-link.mcq:hover {
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.25) 0%, rgba(20, 184, 166, 0.1) 100%);
  border-color: var(--accent-500);
  transform: translateX(4px);
}

/* ============ Module Content Grid ============ */
.module-content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.content-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(99, 102, 241, 0.05) 100%);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 12px;
  text-decoration: none !important;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.content-link::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--primary-400);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.content-link:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-400);
}

.content-link:hover::before {
  opacity: 1;
}

.content-link.mcq {
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.1) 0%, rgba(20, 184, 166, 0.05) 100%);
  border-color: rgba(20, 184, 166, 0.2);
}

.content-link.mcq::before {
  background: var(--accent-500);
}

.content-link.mcq:hover {
  border-color: var(--accent-500);
}

.link-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.link-text {
  color: var(--text-primary);
  font-weight: 500;
  font-size: 0.95rem;
}

.content-link:hover .link-text {
  color: var(--primary-300);
}

.content-link.mcq:hover .link-text {
  color: var(--accent-400);
}

/* ============ Mobile Responsive ============ */
@media (max-width: 1024px) {
  .page-wrap {
    flex-direction: column;
  }

  .side-bar {
    transform: translateX(-100%);
    width: 280px;
    position: fixed;
    height: 100vh;
    z-index: 200;
  }

  .side-bar.mobile-open {
    transform: translateX(0);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
  }

  .main {
    margin-left: 0;
    width: 100%;
  }

  .mobile-menu-toggle {
    display: flex;
  }

  .site-header {
    padding: 0.75rem 1rem;
  }

  body.menu-open {
    overflow: hidden;
  }

  body.menu-open::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 150;
  }

  .hero {
    padding: 2rem 1.5rem;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .module-grid {
    grid-template-columns: 1fr;
  }

  .main-content {
    padding: 1.5rem;
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  h3 {
    font-size: 1.25rem;
  }

  .aux-nav-list {
    gap: 0.5rem;
  }

  .aux-nav-list-item a {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
  }
}

/* ============ Print Styles ============ */
@media print {
  body {
    background: white;
    color: black;
  }

  .side-bar,
  .search,
  .aux-nav {
    display: none !important;
  }

  pre,
  code {
    background: #f5f5f5;
    border: 1px solid #ddd;
  }
}

/* ============ Mermaid Diagrams ============ */
.mermaid {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  margin: 1.5rem 0;
  text-align: center;
  overflow: hidden;
  /* Changed for pan-zoom */
  position: relative;
}

.mermaid svg {
  max-width: 100%;
  height: auto;
}

/* Force Dark Theme Colors (Override inline styles) */
/* Nodes */
.mermaid .node rect,
.mermaid .node circle,
.mermaid .node ellipse,
.mermaid .node polygon,
.mermaid .node path {
  fill: var(--bg-surface) !important;
  stroke: var(--primary-400) !important;
  stroke-width: 2px !important;
}

/* Text */
.mermaid .node .label {
  color: var(--text-primary) !important;
  fill: var(--text-primary) !important;
}

.mermaid .edgeLabel {
  background-color: var(--bg-base) !important;
  color: var(--text-secondary) !important;
}

/* Edges */
.mermaid .edgePath .path {
  stroke: var(--text-secondary) !important;
  stroke-width: 2px !important;
}

/* Markers (Arrowheads) */
.mermaid marker path {
  fill: var(--text-secondary) !important;
  stroke: var(--text-secondary) !important;
}

/* Toolbar Styles */
.mermaid-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  background: var(--bg-elevated);
  padding: 6px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  opacity: 0;
  transition: opacity 0.2s;
}

.mermaid-wrapper:hover .mermaid-toolbar {
  opacity: 1;
}

.mermaid-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: 6px;
  width: 32px;
  height: 32px;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.mermaid-btn svg {
  width: 16px !important;
  height: 16px !important;
  min-width: 16px;
  min-height: 16px;
}

.mermaid-btn:hover {
  background: var(--primary-500);
  color: white;
  border-color: var(--primary-500);
}

/* Specific colors for specific node types if needed, using CSS variables */
.mermaid .node.section rect {
  fill: var(--bg-surface) !important;
}

/* Ensure mermaid diagrams are responsive on mobile */
@media (max-width: 768px) {
  .mermaid {
    padding: 1rem;
    font-size: 0.85rem;
  }
}