/* Theme-specific color overrides - ensuring proper contrast */
[data-md-color-scheme="default"] {
  --md-default-fg-color: #000000de;
  --md-default-fg-color--light: #000000c4;
  --md-default-fg-color--dark:  #0000008a;
}

[data-md-color-scheme="slate"] {
  /* Let Material handle dark mode colors properly for contrast */
  --md-default-fg-color: hsla(var(--md-hue), 75%, 95%, 1);
  --md-default-fg-color--light: hsla(var(--md-hue), 75%, 90%, 0.62);
  --md-default-fg-color--dark: hsla(var(--md-hue), 75%, 85%, 0.32);
}

/* Dark theme amber headers - Electric laboratory style */
[data-md-color-scheme="slate"] .md-typeset h1,
[data-md-color-scheme="slate"] .md-typeset h2,
[data-md-color-scheme="slate"] .md-typeset h3,
[data-md-color-scheme="slate"] .md-typeset h4,
[data-md-color-scheme="slate"] .md-typeset h5,
[data-md-color-scheme="slate"] .md-typeset h6 {
  color: #ffc107 !important; /* Electric amber headers */
  text-shadow: 0 0 8px rgba(255, 193, 7, 0.3); /* Subtle electric glow */
}

/* Sidebar navigation titles in dark mode */
[data-md-color-scheme="slate"] .md-nav__title,
[data-md-color-scheme="slate"] .md-nav__item .md-nav__link {
  color: #e0e0e0 !important; /* Light grey for navigation */
}

/* Table of contents and sidebar headers - Electric amber */
[data-md-color-scheme="slate"] .md-sidebar .md-nav__title {
  color: #ffc107 !important; /* Electric amber for main sidebar titles */
  font-weight: 600;
  text-shadow: 0 0 6px rgba(255, 193, 7, 0.2); /* Subtle glow for sidebar titles */
}

/* Active navigation items */
[data-md-color-scheme="slate"] .md-nav__item .md-nav__link--active {
  color: #ba68c8 !important; /* Light purple for active items */
}

/* Professor Torchenstein's Laboratory - Light theme inline code */
[data-md-color-scheme="default"] .md-typeset code:not(.highlight code) {
  background-color: #f3e5f5; /* Light purple lab background */
  color: #4a148c; /* Deep purple text */
  border: none;
  border-radius: 4px;
  padding: 0.15em 0.4em;
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(103, 58, 183, 0.15); /* Subtle purple shadow */
}

/* Refined Electric Amber - Dark theme inline code */
[data-md-color-scheme="slate"] .md-typeset code:not(.highlight code) {
  background-color: #2a2a2a; /* Softer dark background */
  color: #ffb74d; /* Softer amber text - less intense */
  border: none;
  border-radius: 4px;
  padding: 0.15em 0.4em;
  font-weight: 500; /* Reduced from 600 for less intensity */
  box-shadow: 0 1px 2px rgba(255, 152, 0, 0.2); /* Much subtler glow */
}


.md-grid {
  max-width: 1440px; 
}
/* Professor Torchenstein styling */
.md-header {
  background: linear-gradient(45deg, #673ab7, #9c27b0);
}

/* Lightning bolt decorations for important notes */
.admonition.lightning {
  border-left-color: #ffc107;
}

/* Code block styling for "lab experiments" */
.highlight .err {
  color: #ff6b6b; /* Red for "dangerous" code */
}

/* Mobile-first responsive images */
img {
  max-width: 100%;
  height: auto;
}

/* Professor Torchenstein themed admonitions */
.admonition.experiment {
  border-left-color: #673ab7;
}

.admonition.experiment .admonition-title::before {
  content: "🧪";
  margin-right: 0.5rem;
}

.admonition.warning .admonition-title::before {
  content: "⚡";
  margin-right: 0.5rem;
}

/* Course progress styling */
.course-meta {
  background: linear-gradient(135deg, #673ab71a, #9c27b01a);
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
  border-left: 4px solid #ffc107;
}

/* Better mobile navigation */
@media screen and (max-width: 768px) {
  .md-nav__title {
    font-size: 0.9rem;
  }
  
  .md-tabs__item {
    min-width: auto;
  }
  
  .md-content__inner {
    margin: 0 1rem;
  }
}

/* Professor quotes styling - Glowing Energy Field
   Electric laboratory experiment in progress with improved readability */
   
[data-md-color-scheme="default"] .md-typeset blockquote {
  background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%);
  border: none;
  border-left: 8px solid #9c27b0;
  border-radius: 12px;
  font-style: italic;
  font-size: 1.1em; /* Increased from 1.05em */
  font-weight: 400; /* Explicitly set for better readability */
  position: relative;
  padding: 1.75rem 2rem 1.75rem 4rem; /* Adjusted padding */
  margin: 2em 0;
  box-shadow: 
    0 0 0 1px rgba(156, 39, 176, 0.1),
    0 8px 24px rgba(103, 58, 183, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

[data-md-color-scheme="slate"] .md-typeset blockquote {
  background: linear-gradient(135deg, #2a1a3e 0%, #1a0f2e 100%);
  border: none;
  border-left: 8px solid #ffc107;
  border-radius: 12px;
  font-style: italic;
  font-size: 1.1em; /* Increased from 1.05em */
  font-weight: 400;
  color: #e8e8e8; /* Improved text contrast in dark mode */
  position: relative;
  padding: 1.75rem 2rem 1.75rem 4rem;
  margin: 2em 0;
  box-shadow: 
    0 0 0 1px rgba(255, 193, 7, 0.2),
    0 8px 32px rgba(255, 193, 7, 0.2),
    0 0 60px rgba(255, 193, 7, 0.1),
    inset 0 1px 0 rgba(255, 193, 7, 0.1);
  animation: subtle-glow 3s ease-in-out infinite;
}

@keyframes subtle-glow {
  0%, 100% { 
    box-shadow: 
      0 0 0 1px rgba(255, 193, 7, 0.2),
      0 8px 32px rgba(255, 193, 7, 0.2),
      0 0 60px rgba(255, 193, 7, 0.1),
      inset 0 1px 0 rgba(255, 193, 7, 0.1);
  }
  50% { 
    box-shadow: 
      0 0 0 1px rgba(255, 193, 7, 0.3),
      0 8px 32px rgba(255, 193, 7, 0.3),
      0 0 80px rgba(255, 193, 7, 0.15),
      inset 0 1px 0 rgba(255, 193, 7, 0.15);
  }
}

.md-typeset blockquote p {
  margin: 0;
  line-height: 1.8; /* Increased from 1.7 for better readability */
}

/* Quote icon - Speech Bubble indicates Professor Torchenstein is speaking */
[data-md-color-scheme="default"] .md-typeset blockquote::before {
  content: "💬";
  font-size: 2.5em;
  position: absolute;
  top: 1.2rem;
  left: 0.8rem;
  font-style: normal;
  animation: quote-bounce 3s ease-in-out infinite;
}

[data-md-color-scheme="slate"] .md-typeset blockquote::before {
  content: "💬";
  font-size: 2.5em;
  position: absolute;
  top: 1.2rem;
  left: 0.8rem;
  font-style: normal;
  filter: drop-shadow(0 0 10px #ffc107);
  animation: quote-bounce 3s ease-in-out infinite;
}

@keyframes quote-bounce {
  0%, 100% { 
    transform: translateY(0);
  }
  50% { 
    transform: translateY(-3px);
  }
}

/* Code copy button enhancement */
.md-code__content {
  position: relative;
}

/* Math expressions - Enhanced for better LaTeX rendering */
[data-md-color-scheme="default"] .arithmatex {
  color: #673ab7;
  font-weight: 500;
}

[data-md-color-scheme="slate"] .arithmatex {
  color: #ba68c8; /* Lighter purple for dark mode */
  font-weight: 500;
}

/* MathJax specific styling for better integration */
.MathJax_Display {
  margin: 1em 0 !important;
}

.MathJax {
  outline: 0;
}

/* Enhanced Jupyter notebook specific math styling */
.jupyter-notebook .MathJax_Display {
  text-align: center !important;
  margin: 1em 0 !important;
}

/* Force MathJax to process in notebook cells */
.jupyter-notebook .cell .MathJax,
.jupyter-notebook .cell .MathJax_Display {
  display: block !important;
  visibility: visible !important;
}

/* Ensure mkdocs-jupyter content gets processed */
.jupyter-notebook pre code {
  white-space: pre-wrap;
}

/* Fix for notebook math rendering */
.jupyter-notebook .highlight pre {
  background: transparent;
}

/* Ensure math displays properly in both light and dark mode */
[data-md-color-scheme="default"] .MathJax {
  color: var(--md-default-fg-color);
}

[data-md-color-scheme="slate"] .MathJax {
  color: var(--md-default-fg-color);
}

/* Fix for inline math in lists */
li .MathJax {
  display: inline-block;
}

/* Ensure math text doesn't break weirdly */
.MathJax_Display, .MathJax {
  word-wrap: normal;
  word-break: normal;
}

/* Specific fixes for mkdocs-jupyter LaTeX rendering */
.jupyter-notebook .cell .text_cell_render {
  line-height: 1.5;
}

.jupyter-notebook .cell .text_cell_render p {
  margin: 0.5em 0;
}

/* Ensure math in code blocks (like %%latex magic) gets processed */
.jupyter-notebook .cell .input .highlight,
.jupyter-notebook .cell .output .highlight {
  background: var(--md-code-bg-color);
  border-radius: 0.2rem;
  padding: 0.5rem;
}

/* Style for math that appears in output cells */
.jupyter-notebook .output_html .MathJax_Display {
  margin: 0.5em 0;
}
