/* Base Styles & Color Variables */
:root {
  /* Default: Dark Theme */
  --bg-primary: #0f141a;
  --bg-secondary: #181f27;
  --bg-tertiary: #222a33;
  --text-primary: #e8eef3;
  --text-secondary: #bec6cf;
  --text-muted: #828c97;
  --accent-primary: #60afff;
  --accent-secondary: #2a7fff;
  --accent-tertiary: #30a44c; /* Green for tips, success */
  --warning-color: #f85149; /* Red for warnings */
  --border-color: #333c47;
  --code-bg: #282c34; /* Match Prism Okaidia BG */
  --code-text: #abb2bf; /* Match Prism Okaidia text */
  --card-shadow: rgba(0, 0, 0, 0.2);
  --header-gradient-start: var(--bg-secondary);
  --header-gradient-end: var(--bg-tertiary);
  --link-color: var(--accent-primary);
  --link-hover-color: #80c0ff;
  --placeholder-bg: var(--bg-secondary);
  --placeholder-icon: var(--text-muted);
  --placeholder-border: var(--border-color);

  /* RGB versions */
  --accent-primary-rgb: 96, 175, 255;
  --accent-tertiary-rgb: 48, 164, 76;
  --warning-color-rgb: 248, 81, 73;
  --bg-secondary-rgb: 24, 31, 39;

  /* Prism Theme specific overrides */
  --prism-bg: var(--code-bg);
  --prism-color: var(--code-text);
  --prism-border: var(--border-color);
  --prism-button-bg: var(--bg-tertiary);
  --prism-button-hover-bg: var(--bg-secondary);
  --prism-button-color: var(--text-secondary);
  --prism-string-color: #98c379; /* Default string color (Okaidia green) */
  --prism-raw-string-color: #7c8591; /* Muted color for raw C++ strings */


  --sidebar-width: 280px;
  --transition-speed: 0.3s;
  --color-transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease, border-color var(--transition-speed) ease;
}

/* Light Theme Variables */
body[data-theme="light"] {
  --bg-primary: #ffffff;
  --bg-secondary: #f6f8fa;
  --bg-tertiary: #eaeef2;
  --text-primary: #24292f;
  --text-secondary: #57606a;
  --text-muted: #6a737d;
  --accent-primary: #0969da;
  --accent-secondary: #0550ae;
  --accent-tertiary: #1a7f37;
  --warning-color: #cf222e;
  --border-color: #d0d7de;
  --code-bg: #f5f5f5;
  --code-text: #333333;
  --card-shadow: rgba(140, 149, 159, 0.15);
  --header-gradient-start: #f6f8fa;
  --header-gradient-end: #eaeef2;
  --link-color: var(--accent-primary);
  --link-hover-color: #0550ae;
  --placeholder-bg: #f6f8fa;
  --placeholder-icon: #8c959f;
  --placeholder-border: #d0d7de;

  /* RGB versions */
  --accent-primary-rgb: 9, 105, 218;
  --accent-tertiary-rgb: 26, 127, 55;
  --warning-color-rgb: 207, 34, 46;
  --bg-secondary-rgb: 246, 248, 250;

  /* Prism Theme specific overrides for light */
  --prism-bg: var(--code-bg);
  --prism-color: var(--code-text);
  --prism-border: var(--border-color);
  --prism-button-bg: var(--bg-tertiary);
  --prism-button-hover-bg: #d8dee4;
  --prism-button-color: var(--text-secondary);
  --prism-string-color: #032f62; /* Default light string color */
  --prism-raw-string-color: #6a737d; /* Muted color for raw C++ strings */
}

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

html {
  scroll-behavior: smooth; /* Smooth scrolling for anchor links */
}

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  display: flex;
  min-height: 100vh;
  transition: var(--color-transition);
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Links */
a {
    color: var(--link-color);
    text-decoration: none;
    transition: color var(--transition-speed);
}
a:hover {
    color: var(--link-hover-color);
    text-decoration: underline;
}

/* Sidebar */
.sidebar {
  background-color: var(--bg-secondary);
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  overflow-y: auto;
  border-right: 1px solid var(--border-color);
  padding-top: 1rem;
  padding-bottom: 1rem;
  transition: transform var(--transition-speed) ease, var(--color-transition);
  z-index: 1001;
}
.sidebar.collapsed { /* Used for hiding on desktop */
  transform: translateX(calc(-1 * var(--sidebar-width)));
}
.sidebar-header {
  padding: 0.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--color-transition);
}

/* MODIFIED: Styles for the logo, now applied to the anchor tag */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--accent-primary);
  font-weight: 600;
  font-size: 1.2rem;
  transition: color var(--transition-speed);
  text-decoration: none; /* Ensure no underline on the link */
}
.sidebar-logo:hover {
    color: var(--link-hover-color); /* Optional: change color on hover */
    text-decoration: none; /* Keep underline off on hover */
}

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.25rem;
  padding: 0.25rem;
  border-radius: 4px;
  transition: color var(--transition-speed);
  display: none; /* Hide by default, show via media query */
}
.sidebar-toggle:hover {
  color: var(--text-primary);
}
.sidebar h2 {
  padding: 1.5rem 1.5rem 1rem;
  color: var(--text-primary);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  transition: var(--color-transition);
}
.sidebar-nav {
  list-style: none;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.75rem 1.5rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition-speed);
  border-left: 3px solid transparent;
  font-size: 0.95rem;
}
.sidebar-nav a i {
  width: 1.1em;
  text-align: center;
  color: var(--text-muted);
  transition: color var(--transition-speed);
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border-left-color: var(--accent-primary);
}
.sidebar-nav a:hover i,
.sidebar-nav a.active i {
  color: var(--accent-primary);
}
.sidebar-nav a.active {
  font-weight: 500;
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 0;
  transition: margin-left var(--transition-speed) ease, var(--color-transition);
  background-color: var(--bg-primary);
  overflow-x: hidden;
}
.main-content.collapsed { /* Used when sidebar is hidden on desktop */
  margin-left: 0;
}

/* Header */
.main-header {
  background: linear-gradient(135deg, var(--header-gradient-start), var(--header-gradient-end));
  padding: 2rem 2.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: var(--color-transition);
}
.header-content h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--accent-primary); /* Fallback */
}
.header-content p {
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 700px;
  margin: 0;
  transition: var(--color-transition);
}

/* Theme Toggle Button */
.theme-toggle {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-speed);
  margin-left: 1rem;
  position: relative;
  overflow: hidden;
}
.theme-toggle:hover {
  border-color: var(--accent-primary);
  background-color: var(--accent-secondary);
  color: #fff;
}
.theme-toggle i { /* Icons inside toggle */
  position: absolute;
  transition: transform 0.4s ease-in-out;
  transform-origin: center center;
}
/* Sun/Moon Animation States */
body[data-theme="dark"] .theme-toggle .theme-icon-sun { transform: scale(1) rotate(0deg); }
body[data-theme="dark"] .theme-toggle .theme-icon-moon { transform: scale(0) rotate(90deg); }
body[data-theme="light"] .theme-toggle .theme-icon-sun { transform: scale(0) rotate(-90deg); }
body[data-theme="light"] .theme-toggle .theme-icon-moon { transform: scale(1) rotate(0deg); }

/* Content Area */
.content {
  padding: 2.5rem;
  max-width: 960px;
  margin: 0 auto;
}

/* Sections */
.section {
  margin-bottom: 3.5rem;
  opacity: 0; /* Start hidden for animation */
  transform: translateY(15px);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
  transition-delay: 0.1s; /* Stagger animation */
}
.section.in-view { /* Class added by JS */
  opacity: 1;
  transform: translateY(0);
}
.section h2 {
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--accent-primary);
  position: relative;
  transition: var(--color-transition);
}
.section h2::before { /* Accent bar before heading */
  content: "";
  position: absolute;
  left: -2.5rem;
  top: 5px;
  height: 24px;
  width: 4px;
  background-color: var(--accent-primary);
  border-radius: 2px;
  opacity: 0.8;
  transition: background-color var(--transition-speed);
}
.section p,
.section ul,
.section ol,
.section li {
  color: var(--text-secondary);
  transition: var(--color-transition);
}
.section p { margin-bottom: 1.25rem; }
.section ul,
.section ol { margin: 1rem 0 1.5rem 1.5rem; }
.section li { margin-bottom: 0.6rem; }

/* Inline Code */
.section code:not(pre > code) { /* Target only inline code */
  background-color: var(--code-bg);
  color: var(--code-text);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.9em;
  border: 1px solid var(--border-color);
  transition: var(--color-transition);
}

/* --- Updated/Added Prism / Code Block CSS --- */

/* Code Blocks Container */
.code-block-container {
  position: relative;
  margin: 1.75rem 0;
}

/* PrismJS Syntax Highlighting Base */
pre[class*="language-"] {
  background: var(--prism-bg) !important;
  color: var(--prism-color) !important;
  border: 1px solid var(--prism-border) !important;
  border-radius: 6px;
  padding: 1.25rem !important;
  padding-top: 3em !important; /* Add padding top to make space for toolbar */
  margin: 0 !important;
  transition: var(--color-transition);
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace !important;
  font-size: 0.9em !important;
  line-height: 1.5 !important;
  white-space: pre-wrap !important;
  word-wrap: break-word !important;
  position: relative; /* Needed for toolbar positioning */
}
code[class*="language-"] {
  color: var(--prism-color) !important;
  background: none !important;
  text-shadow: none !important;
  font-family: inherit !important;
  font-size: inherit !important;
  line-height: inherit !important;
}

/* --- FIX FOR C++ RAW STRING HIGHLIGHTING --- */
/* Target string tokens specifically within C++ */
.language-cpp .token.string {
    color: var(--prism-string-color) !important; /* Use the default string color first */
}
/* Override specifically for C++ Raw String Literals if Prism assigns a specific class or uses string */
.language-cpp .token.string.raw-string
/* If prism adds a 'raw-string' class (check dev tools) */
 {
    color: var(--prism-raw-string-color) !important;
}
/* If raw strings are just token.string within raw literal syntax `R"rawliteral(...)rawliteral";` */
/* This is harder with CSS alone. Let's default to the muted raw string color for C++ strings. */
.language-cpp .token.string {
    color: var(--prism-raw-string-color) !important; /* Apply muted color */
}
/* Re-apply normal string color for regular quoted strings if needed (might need JS or Prism plugin) */
/* Example (pseudo-selector): .language-cpp .token.string:not(:raw) { color: var(--prism-string-color) !important; } */


/* Prism Line Numbers */
.line-numbers .line-numbers-rows {
  border-right: 1px solid var(--prism-border) !important;
  opacity: 0.6;
  transition: border-color var(--transition-speed);
  padding-right: 1em !important;
  /* Adjust top position to align with code content after adding padding to pre */
  top: 1.25rem !important;
  padding-top: 0 !important; /* Reset padding top */
}
.line-numbers-rows > span:before {
  color: var(--text-muted) !important;
  transition: color var(--transition-speed);
}

/* Prism Toolbar & Copy Button */
div.code-toolbar {
    position: relative; /* Ensure toolbar positioning context */
}
div.code-toolbar > .toolbar {
    position: absolute;
    top: 0.6em; /* Adjust position to fit within top padding */
    right: 0.6em;
    opacity: 1; /* MODIFIED: Make toolbar always visible */
    transition: none; /* MODIFIED: Remove fade transition */
    z-index: 3; /* Above code */
    background: none; /* Remove default toolbar background */
    border: none;
    padding: 0;
}
/* REMOVED: Hover rule is no longer needed
div.code-toolbar:hover > .toolbar {
    opacity: 1;
} */

.toolbar .toolbar-item > button {
    background: var(--prism-button-bg);
    color: var(--prism-button-color); /* Icon color */
    border: 1px solid var(--prism-border);
    border-radius: 4px;
    /* MODIFIED: Adjust padding for icon */
    padding: 0.4em 0.6em;
    font-size: 1em; /* Make icon size relative */
    line-height: 1; /* Ensure icon aligns well */
    box-shadow: none;
    transition: all 0.2s ease;
    cursor: pointer;
    display: inline-flex; /* Align icon nicely */
    align-items: center;
    justify-content: center;
    min-width: 36px; /* Ensure minimum size */
    min-height: 36px;
}
.toolbar .toolbar-item > button:hover {
    background: var(--prism-button-hover-bg);
    border-color: var(--accent-primary);
    color: var(--text-primary); /* Use primary text for icon hover */
}
.toolbar .toolbar-item > button:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(var(--accent-primary-rgb), 0.4);
}
.toolbar .toolbar-item > button i.fas { /* MODIFIED: Style the icon */
    font-size: 0.9em; /* Adjust icon size */
    margin: 0; /* Remove any margin */
}

/* Copied state style */
.toolbar .toolbar-item > button.copied,
.toolbar .toolbar-item > button[data-copy-state="copied"] {
  background-color: var(--accent-tertiary) !important;
  color: #fff !important; /* White icon on green background */
  border-color: var(--accent-tertiary) !important;
}
.toolbar .toolbar-item > button.copied:hover,
.toolbar .toolbar-item > button[data-copy-state="copied"]:hover {
  background-color: #258c40 !important; /* Slightly darker green */
}

/* Specific Prism Light Theme Token Overrides */
body[data-theme="light"] .token.comment,
body[data-theme="light"] .token.prolog,
body[data-theme="light"] .token.doctype,
body[data-theme="light"] .token.cdata { color: #6a737d; }
body[data-theme="light"] .token.punctuation { color: #6a737d; }
body[data-theme="light"] .token.property,
body[data-theme="light"] .token.tag,
body[data-theme="light"] .token.boolean,
body[data-theme="light"] .token.number,
body[data-theme="light"] .token.constant,
body[data-theme="light"] .token.symbol,
body[data-theme="light"] .token.deleted { color: #005cc5; }
body[data-theme="light"] .token.selector,
body[data-theme="light"] .token.attr-name,
body[data-theme="light"] .token.string, /* Base string color */
body[data-theme="light"] .token.char,
body[data-theme="light"] .token.builtin,
body[data-theme="light"] .token.inserted { color: #032f62; }
body[data-theme="light"] .token.operator,
body[data-theme="light"] .token.entity,
body[data-theme="light"] .token.url,
body[data-theme="light"] .language-css .token.string,
body[data-theme="light"] .style .token.string { color: #d73a49; }
body[data-theme="light"] .token.atrule,
body[data-theme="light"] .token.attr-value,
body[data-theme="light"] .token.keyword { color: #d73a49; }
body[data-theme="light"] .token.function,
body[data-theme="light"] .token.class-name { color: #6f42c1; }
body[data-theme="light"] .token.regex,
body[data-theme="light"] .token.important,
body[data-theme="light"] .token.variable { color: #e36209; }

/* Raw string override for light theme */
body[data-theme="light"] .language-cpp .token.string {
    color: var(--prism-raw-string-color) !important; /* Muted string in light mode too */
}


/* Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 1.75rem 0;
}
.card {
  background-color: var(--bg-secondary);
  border-radius: 8px;
  padding: 1.75rem;
  border: 1px solid var(--border-color);
  transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease, var(--color-transition);
  box-shadow: 0 2px 4px var(--card-shadow);
}
.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px var(--card-shadow);
  border-color: var(--accent-primary);
}
.card h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  color: var(--accent-primary);
  font-size: 1.15rem;
  transition: color var(--transition-speed);
}
.card ul {
    margin-left: 0.5rem;
    padding-left: 1rem;
}

/* Notes, Tips, Warnings */
.note, .tip, .warning {
  padding: 1.25rem 1.5rem;
  margin: 1.75rem 0;
  border-radius: 6px;
  border-left: 5px solid var(--accent-primary);
  background-color: rgba(var(--accent-primary-rgb), 0.1);
  transition: var(--color-transition), border-color var(--transition-speed);
}
.tip {
  border-left-color: var(--accent-tertiary);
  background-color: rgba(var(--accent-tertiary-rgb), 0.1);
}
.warning {
  border-left-color: var(--warning-color);
  background-color: rgba(var(--warning-color-rgb), 0.1);
}
.note::before, .tip::before, .warning::before {
  display: block;
  font-weight: 600;
  margin-bottom: 0.75rem;
  font-size: 1.05em;
}
.note::before { content: "📝 Note"; color: var(--accent-primary); }
.tip::before { content: "💡 Tip"; color: var(--accent-tertiary); }
.warning::before { content: "⚠️ Warning"; color: var(--warning-color); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.35rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
  transition: all var(--transition-speed) ease;
  border: 1px solid transparent;
  cursor: pointer;
  gap: 0.6rem;
  font-size: 0.95rem;
}
.btn i { line-height: 1; }
.btn-primary {
  background-color: var(--accent-secondary);
  color: #ffffff;
  border-color: var(--accent-secondary);
}
.btn-primary:hover {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(var(--accent-primary-rgb), 0.3);
}
.btn-outline {
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}
.btn-outline:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background-color: rgba(var(--accent-primary-rgb), 0.1);
  transform: translateY(-2px);
}

/* Tabs */
.tabs {
  border-bottom: 1px solid var(--border-color);
  display: flex;
  margin-bottom: 1.75rem;
  transition: var(--color-transition);
}
.tab {
  padding: 0.85rem 1.35rem;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px; /* Overlap border */
  color: var(--text-muted);
  transition: all var(--transition-speed);
  font-weight: 500;
}
.tab:hover {
  color: var(--text-primary);
  border-bottom-color: var(--border-color);
}
.tab.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
}
.tab-content {
  display: none;
  animation: tabFadeIn 0.4s ease-out;
}
.tab-content.active { display: block; }
@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.75rem 0;
  background-color: var(--bg-secondary);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  transition: var(--color-transition);
}
th, td {
  padding: 0.85rem 1.1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  transition: var(--color-transition);
  font-size: 0.95rem;
}
th {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  font-weight: 600;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background-color: var(--bg-tertiary); }

/* Circuit Diagram Placeholder */
.circuit-diagram {
    margin: 1.75rem 0; /* Consistent margin */
}
.circuit-diagram .placeholder-img {
  padding: 2rem;
  border-radius: 6px;
  background-color: var(--placeholder-bg);
  color: var(--placeholder-icon);
  transition: var(--color-transition);
  border: 1px dashed var(--placeholder-border);
  display: flex; /* Use flexbox */
  flex-direction: column; /* Stack icon and text */
  align-items: center; /* Center horizontally */
  justify-content: center; /* Center vertically */
  min-height: 250px;
  text-align: center;
}
.circuit-diagram .placeholder-img i {
  color: var(--placeholder-icon);
  transition: color var(--transition-speed);
  margin-bottom: 1rem; /* Space between icon and text */
}

/* Footer */
.footer {
  background-color: var(--bg-secondary);
  padding: 2.5rem;
  text-align: center;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  margin-top: 3rem;
  transition: var(--color-transition);
}
.footer p { margin-bottom: 0.5rem; font-size: 0.9rem; }
.footer a { color: var(--link-color); }
.footer a:hover { color: var(--link-hover-color); }

/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: all var(--transition-speed) ease;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  box-shadow: 0 4px 12px var(--card-shadow);
  z-index: 999;
  border: 1px solid var(--border-color);
}
.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.back-to-top:hover {
  background-color: var(--accent-secondary);
  color: #fff;
  transform: translateY(-3px);
  border-color: var(--accent-secondary);
}

/* Responsive Design */

/* Tablet and Smaller Desktop */
@media (max-width: 992px) {
  .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-width))); /* Hidden by default */
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.2);
  }
  .sidebar.active { /* Class to show sidebar on mobile */
    transform: translateX(0);
  }
  .sidebar-toggle {
    display: block; /* Show toggle button */
  }
  .main-content {
    margin-left: 0; /* Main content always takes full width */
  }
  .main-content.collapsed {
    margin-left: 0; /* No change needed */
  }
  .main-header {
    padding: 1.5rem 1.5rem;
  }
  .content {
    padding: 2rem;
    max-width: 100%; /* Allow content to use more width */
  }
  .section h2::before {
    left: -2rem;
  }
}

/* Mobile */
@media (max-width: 576px) {
  :root {
    --sidebar-width: 250px;
  }
  .main-header {
    padding: 1rem 1rem;
    flex-direction: column; /* Stack header content */
    align-items: flex-start; /* Align items left */
    padding-bottom: 0.5rem; /* Reduce bottom padding */
    position: relative; /* Needed if theme toggle is absolute */
  }
  .header-content h1 {
    font-size: 1.5rem;
  }
   .header-content p {
    font-size: 0.9rem;
    margin-bottom: 0.5rem; /* Add space before toggle if stacked below */
  }
  .theme-toggle {
    position: absolute; /* Position top right */
    top: 0.8rem;
    right: 0.8rem;
    margin-left: 0; /* Override desktop margin */
    width: 40px;
    height: 40px;
  }
  .content {
    padding: 1.5rem 1rem;
  }
  .section h2 {
    font-size: 1.5rem;
  }
   .section h2::before {
    left: -1.5rem;
    height: 20px;
    top: 3px;
   }
  .card-grid {
    grid-template-columns: 1fr;
  }
  .tabs {
    flex-wrap: wrap;
  }
  .tab {
    padding: 0.6rem 1rem;
  }
  th, td {
    padding: 0.6rem 0.8rem;
    font-size: 0.9rem;
  }
  .back-to-top {
    bottom: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
  }
   pre[class*="language-"], code[class*="language-"] {
      font-size: 0.85em !important; /* Slightly smaller code on mobile */
   }
   .toolbar .toolbar-item > button {
       font-size: 0.8em; /* Smaller copy button */
       padding: 0.3em 0.6em;
   }
   div.code-toolbar > .toolbar {
       top: 0.4em; /* Adjust position slightly for smaller buttons */
       right: 0.4em;
   }
}