/* Modern Styling using CSS Variables */
:root {
    --primary-color: #007acc;
    --primary-color-darker: #005c99;
    --primary-gradient-start: #007acc;
    --primary-gradient-end: #00aaff;

    --tab-blue: #1f77b4;
    --tab-orange: #ff7f0e;
    --tab-green: #2ca02c;
    --tab-red: #d62728;
    --tab-purple: #9467bd;
    --tab-brown: #8c564b;
    --tab-pink: #e377c2;
    --tab-gray: #7f7f7f;
    --tab-olive: #bcbd22;
    --tab-cyan: #17becf;

    --lms-red: #cc3333;
    --lms-red-darker: #A72A2A;
    --lms-gray: #999999;
    --lms-cyan: #00cccc;
    --lms-magenta: #cc00cc;
    --lms-yellow: #cccc00;
    --lms-orange: #cc6600;
    --lms-lightblue: #66cccc;
    --lms-lightred: #cc6666;
    --lms-blue: #0033cc;
    --lms-green: #33cc33;
    --lms-green-darker: #2AA72A;
    --lms-green-dark: #218321;
    --lms-lightgreen: #66cc66;

    --background-color: #f4f7f9;
    --card-background: #ffffff;
    --text-color: #333;
    --subtext-color: #555;
    --border-color: #ccd0d5;
    --card-radius: 10px;
    --box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12);

    --header-bg: rgba(34, 82, 156, 0.88);
    --header-highlight: linear-gradient(120deg, rgba(96, 165, 250, 0.36), rgba(129, 199, 255, 0.14));
    --header-border: rgba(191, 219, 254, 0.38);
    --header-text: #e8f1ff;
    --header-subtext: rgba(232, 241, 255, 0.75);
    --header-pill-hover: rgba(148, 197, 255, 0.26);
    --header-pill-active: linear-gradient(135deg, rgba(59, 130, 246, 0.88), rgba(96, 165, 250, 0.74));
}

/* Colorblind Mode Variables */
body.colorblind-mode {
    --primary-color: #0072B2;           /* Blue */
    --primary-gradient-start: #0072B2;
    --primary-gradient-end: #E69F00;    /* Orange */
    --text-color: #000;
    --subtext-color: #333;
    --border-color: #666;
}

body.colorblind-mode a {
    text-decoration: underline;
}
  
/* Global Reset & Base Styling */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
/* links */
a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.2s ease;
}
a:hover {
  color: var(--primary-gradient-end);
  text-decoration: underline;
}
fieldset {
  margin: 20px;
  padding: 0 10px 10px;
  border: 1px solid #999999;
  border-radius: 8px;
}
legend {
  padding: 0px 5px;
  text-align: center;
}
details {
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  background-color: var(--card-background);
  box-shadow: var(--box-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.3s ease;
  padding: 1rem 1rem;
  margin-bottom: 1rem;
}
details:last-child { margin-bottom: 0; }
details.summary {
  cursor: pointer;
}
details:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
  cursor: pointer;
}

body {
  font-family: 'Roboto', sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
  position: relative;
  padding: clamp(12px, 3vw, 20px);
}

body.nav-open {
  overflow: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Outer Wrapper */
.outer-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  background-color: #fff;
  border-radius: 12px;
  box-shadow: var(--box-shadow);
  overflow: visible;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px 28px;
  background: var(--header-bg);
  color: var(--header-text);
  border-bottom: 1px solid var(--header-border);
  box-shadow: 0 5px 14px rgba(15, 23, 42, 0.2);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  overflow: visible;
  isolation: isolate;
}

.header::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--header-highlight);
  opacity: 0.95;
  pointer-events: none;
  z-index: -1;
}

.header .header-container {
  position: relative;
  z-index: 1;
  width: min(1200px, 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
}
.header .logo {
  display: flex;
  align-items: center;
}

.header .logo a {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--header-text);
  text-decoration: none;
  transition: transform 0.3s ease;
}

.header .logo a:hover {
  transform: translateY(-1px);
}

.header .logo img {
  height: 48px;
  width: 48px;
  filter: drop-shadow(0 3px 8px rgba(15, 23, 42, 0.25));
}

.header .logo span {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--header-text);
  text-transform: none;
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.header .main-nav ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0;
  padding: 0;
}

.header .main-nav ul li {
  display: flex;
  align-items: center;
}

.header .main-nav ul li a,
.header .main-nav ul li button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.45rem 1.05rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(148, 163, 184, 0.12);
  color: var(--header-text);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.25s ease, background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}
.header .main-nav ul li button {
  cursor: pointer;
  background: rgba(148, 163, 184, 0.1);
}

.header .main-nav ul li a:hover,
.header .main-nav ul li button:hover {
  background: var(--header-pill-hover);
  border-color: rgba(148, 163, 184, 0.45);
  color: #ffffff;
  box-shadow: 0 5px 15px rgba(14, 116, 144, 0.24);
  transform: translateY(-1px);
}

.header .main-nav ul li a.is-active {
  background: var(--header-pill-active);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 16px 30px rgba(14, 116, 144, 0.35);
}

.header .main-nav ul li a:focus-visible,
.header .main-nav ul li button:focus-visible {
  outline: 3px solid rgba(125, 211, 252, 0.75);
  outline-offset: 3px;
}

.header .main-nav ul li.toggle-container {
  display: flex;
  align-items: center;
}
/* Toggle switch for colorblind mode */
.header .main-nav ul li.toggle-container .toggle-button {
  font-family: 'Poppins', sans-serif;
  margin: 0;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 1.05rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(148, 163, 184, 0.1);
  color: var(--header-text);
  cursor: pointer;
  transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.header .main-nav ul li.toggle-container .toggle-button:hover {
  background: rgba(148, 163, 184, 0.18);
  border-color: rgba(125, 211, 252, 0.42);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
  transform: translateY(-1px);
}

.header .main-nav ul li.toggle-container.is-active .toggle-button {
  background: rgba(148, 197, 255, 0.22);
  border-color: rgba(148, 197, 255, 0.6);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
}

.header .main-nav ul li.toggle-container .toggle-button input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.header .main-nav ul li.toggle-container .toggle-label {
  margin: 0;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
}

.header .main-nav ul li.toggle-container .switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 16px;
  flex-shrink: 0;
}

.header .main-nav ul li.toggle-container .toggle-label {
  margin: 0;
  color: inherit;
  font-weight: 600;
  line-height: 1;

}

.header .main-nav ul li.toggle-container .switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.header .main-nav ul li.toggle-container .slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 999px;
}

.header .main-nav ul li.toggle-container .slider:before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  top: 2px;
  left: 2px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

.header .main-nav ul li.toggle-container .switch input:checked + .slider {
  background-color: var(--primary-color);
}

.header .main-nav ul li.toggle-container .switch input:checked + .slider:before {
  transform: translateX(20px);
}
/* Navigation Toggle for mobile view */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(148, 163, 184, 0.12);
  color: var(--header-text);
  cursor: pointer;
  transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.nav-toggle:hover,
.nav-toggle:focus-visible {
  background: var(--header-pill-hover);
  border-color: rgba(148, 163, 184, 0.45);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
  transform: translateY(-1px);
  outline: none;
}

.nav-toggle .nav-toggle-icon {
  position: relative;
  width: 22px;
  height: 2px;
  background: var(--header-text);
  border-radius: 999px;
  transition: background 0.3s ease;
}

.nav-toggle .nav-toggle-icon::before,
.nav-toggle .nav-toggle-icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 22px;
  height: 2px;
  background: var(--header-text);
  border-radius: 999px;
  transition: transform 0.3s ease, top 0.3s ease, opacity 0.3s ease;
}

.nav-toggle .nav-toggle-icon::before {
  top: -6px;
}

.nav-toggle .nav-toggle-icon::after {
  top: 6px;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-icon {
  background: transparent;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-icon::before {
  top: 0;
  transform: rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-icon::after {
  top: 0;
  transform: rotate(-45deg);
}

.nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.nav-backdrop.is-visible {
  opacity: 1;
  pointer-events: auto;
}

/* Content Wrapper (Sidebar + Main) */
.content-wrapper {
  display: flex;
  min-height: 70vh;
  margin-top: 20px;
}

/* Sidebar */
.sidebar {
  width: 240px;
  background-color: #e9edf1;
  border-right: 1px solid var(--border-color);
  padding: 25px;
}
.sidebar h3 {
  margin-bottom: 15px;
  color: var(--text-color);
  font-size: 1.2rem;
}
.sidebar ul {
  list-style: none;
  padding-left: 0;
  margin-bottom: 20px;
}
.sidebar li {
  margin: 10px 0;
}
.sidebar a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.2s ease;
}
.sidebar a:hover {
  color: var(--primary-gradient-end);
  text-decoration: underline;
}
.sidebar .section-title {
  margin-top: 20px;
  margin-bottom: 10px;
  font-weight: 700;
  color: #111;
}
/* --- Modern Sidebar & content styles --- */
.modern-sidebar {
  position: relative;
  overflow: hidden;
  width: 260px;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.98) 0%, rgba(246, 250, 255, 0.98) 100%);
  border: 1px solid rgba(15, 76, 129, 0.12);
  padding: 26px 24px;
  border-radius: 14px;
  box-shadow: 0 5px 18px rgba(15, 76, 129, 0.08);
  margin: 10px;
  transition: box-shadow 0.35s ease, transform 0.35s ease;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.modern-sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(160deg, rgba(10, 132, 208, 0.12), rgba(255, 255, 255, 0));
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}
.modern-sidebar:hover {
  box-shadow: 0 5px 18px rgba(15, 76, 129, 0.08);
  transform: none;
}
.modern-sidebar:hover::before {
  opacity: 0;
}
.modern-sidebar h3 {
  margin-bottom: 18px;
  color: var(--primary-color, #0f4c81);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.modern-sidebar ul.sidebar-menu {
  list-style: none;
  padding-left: 0;
}
.modern-sidebar ul.sidebar-menu > li.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
  margin-bottom: 12px;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(15, 53, 88, 0.8);
  border: none;
}
.modern-sidebar ul.sidebar-menu > li.section-title::after {
  content: "";
  display: block;
  flex: 1 1 auto;
  height: 1px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(0, 122, 204, 0.28), transparent);
}
.modern-sidebar ul.sidebar-menu li a.sidebar-link {
  position: relative;
  display: block;
  padding: 11px 18px 11px 32px;
  color: #0f4c81;
  text-decoration: none;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.96rem;
  letter-spacing: 0.02em;
  line-height: 1.35;
  border-left: 3px solid transparent;
  transition: color 0.3s ease, border-color 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
  text-shadow: 0 0 1px rgba(15, 76, 129, 0.18);

}
.modern-sidebar ul.sidebar-menu li a.sidebar-link:hover {
  color: #0f4c81;
  border-left-color: rgba(62, 161, 238, 0.42);
  background-color: rgba(120, 198, 255, 0.18);
  box-shadow: 0 6px 14px rgba(15, 76, 129, 0.06);
}
.modern-sidebar ul.sidebar-menu li a.sidebar-link.active {
  color: #06345a;
  font-weight: 700;
  border-left-color: #0b6cbf;
  text-shadow: 0 0 1px rgba(10, 132, 208, 0.25);
  background-color: rgba(10, 132, 208, 0.22);
  box-shadow: 0 8px 18px rgba(10, 132, 208, 0.18);
}
body.dark-mode .modern-sidebar ul.sidebar-menu li a.sidebar-link.active {
  color: #e2efff;
  border-left-color: #6ea8ff;
  background-color: rgba(110, 168, 255, 0.28);
  box-shadow: 0 10px 24px rgba(16, 74, 168, 0.32);
  text-shadow: 0 0 2px rgba(110, 168, 255, 0.45);
}
/* Mobile sidebar toggle button */
.sidebar-toggle {
  display: none;
  background: var(--primary-color);
  color: #fff;
  border: none;
  padding: 10px 15px;
  margin: 0 10px 10px 10px;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
}

/* --- Sidebar Tabs styling --- */
.toggle-tabs {
  display: flex;
  margin-bottom: 1em;
  border-radius: 4px;
  overflow: hidden;
}
.toggle-tabs button {
  flex: 1;
  padding: 0.5em 0;
  background: #fff;               /* white background */
  border: 1px solid var(--primary-color);      /* blue outline */
  color: var(--primary-color);                 /* blue text */
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.toggle-tabs button:hover {
  background: #e6f2ff;
  color: #0056b3;
  transform: none;
}
.toggle-tabs button:not(:last-child) {
  border-right: none;            /* no double border */
}
.toggle-tabs button.active {
  background: var(--primary-color); /* solid blue when active */
  color: #fff;                    /* white text when active */
}


/* Main Content */
.main-content {
  flex: 1;
  padding: 25px;
}

/* Footer */
.footer {
  text-align: center;
  padding: 20px;
  font-size: 0.9em;
  color: #777;
  border-top: 1px solid var(--border-color);
  margin-top: 20px;
}
.footer .social-icons {
  margin-bottom: 10px;
}
.footer .social-icons a {
  margin: 0 8px;
  display: inline-block;
}
.footer .social-icons a img {
  width: 24px;
  height: 24px;
  filter: var(--icon-filter, none);
  transition: filter 0.2s ease;
}
.footer .social-icons a:hover img {
  filter: brightness(1.2);
}
.footer .legal-links {
  margin-top: 5px;
  font-size: 0.85em;
}
.footer .legal-links a {
  margin: 0 6px;
}

/* Forms, Inputs & Buttons */
form {
  margin-bottom: 20px;
}
label {
  display: block;
  margin-bottom: 8px;
  font-weight: bold;
}
input {
  accent-color: var(--primary-color);
}
input[type="text"],
input[type="number"],
input[type="file"],
select {
  width: 100%;
  padding: 10px 14px;
  margin-bottom: 8px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 1em;
}
input[type="radio"] + label,
input[type="checkbox"] + label {
  display: inline-block;
  font-weight: normal;
  margin-bottom: 0;
  margin-left: 4px;
}
button {
  background-color: var(--primary-color);
  color: #fff;
  border: none;
  padding: 12px 18px;
  border-radius: 6px;
  font-size: 1em;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
  margin-right: 5px;
}
button:hover {
  background-color: var(--primary-color-darker);
  transform: translateY(-2px);
}

/* Images */
img {
  max-width: 100%;
  border-radius: 6px;
  margin-top: 10px;
}

/* Tooltip Styling (for info buttons) */
.info-button {
  display: inline-block;
  margin-left: 10px;
  text-decoration: none;
  background-color: var(--primary-color);
  color: #fff;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  text-align: center;
  line-height: 22px;
  font-size: 12px;
}

/* User-manual sections shared by block diagram and process chain */
#userManual {
  margin: 8px 0 12px;
  padding: 10px 12px;
  background: #f9f9f9;
  border: 1px solid #ddd;
  font-size: 0.9em;
  line-height: 1.4;
}
body.dark-mode #userManual {
  background: #1f1f1f;
  color: var(--text-color);
  border-color: #444;
}

/* Grid Layout for Home and Other Pages */
.menu-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  padding: 0 20px;
}

/* Card Style for Home Page Sections */
.card {
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  padding: 25px;
  background-color: var(--card-background);
  box-shadow: var(--box-shadow);
  text-align: left;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.3s ease;
  font-family: 'Poppins', sans-serif;
}
.card h2 {
  color: var(--primary-color);
  margin-bottom: 15px;
  font-size: 1.8em;
}
.card ul {
  list-style: none;
  padding: 0;
  font-size: 1em;
  line-height: 1.8;
}
.card li {
  margin-bottom: 10px;
}
.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

/* Disable hover pop-out for SiSy II demo pages */
body.sisy2-page .card {
  transition: none;
}

body.sisy2-page .card:hover {
  transform: none;
  box-shadow: var(--sisy2-card-shadow, var(--box-shadow));
} 
/* Hero Section */
.hero {
  text-align: center;
  margin: 40px 0;
  padding: 40px 20px;
}
.hero h1 {
  font-size: 2.8em;
  margin-bottom: 15px;
}
.hero p {
  font-size: 1.2em;
  color: var(--subtext-color);
}

/* Adjustments relative to screen size */
@media (max-width: 1100px) {
  .header {
    padding: 12px 22px;
  }
  .header .header-container {
    gap: 20px;
  }
}
/* Toggle header menu */
@media (max-width: 900px) {
  .header {
    padding: 14px 20px;
  }
  .nav-toggle {
    display: inline-flex;
  }
  .header .header-container {
    align-items: center;
  }
  .header .main-nav {
    position: absolute;
    top: calc(100% + 12px);
    right: 16px;
    width: min(320px, calc(100vw - 32px));
    background: rgba(17, 53, 112, 0.96);
    border-radius: 20px;
    padding: 18px 16px;
    box-shadow: 0 24px 45px rgba(15, 23, 42, 0.35);
    transform-origin: top right;
    transform: scale(0.9);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 1001;
  }
  .header .main-nav.is-open {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
  }
  .header .main-nav ul {
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
  }
  .header .main-nav ul li {
    width: 100%;
    justify-content: stretch;
  }
  .header .main-nav ul li a,
  .header .main-nav ul li button {
    width: 100%;
  }
  body.dark-mode .header .main-nav {
    background: rgba(12, 32, 68, 0.96);
  }
}
/* Toggle sidebar */
@media (max-width: 768px) {
  .sidebar {
    display: none;
  }
  .sidebar.active {
    display: block;
    width: auto;
    margin: 0 10px 0 10px;
  }
  .content-wrapper {
    flex-direction: column;
  }
  .sidebar-toggle {
    display: block;
  }
  .menu-container {
    grid-template-columns: 1fr;
  }
  .main-content {
    padding: 20px;
  }
  table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 640px) {
  .outer-wrapper {
    border-radius: 12px;
  }
  .main-content {
    padding: 16px;
  }
}

/* Dark Mode Overrides */
/* ------------------------ */
/* Base Dark Mode Overrides */
/* ------------------------ */
body.dark-mode {
    background-color: #1a1f27;
    color: #f5f5f5;
    --primary-color: #5b8def;
    --primary-gradient-start: #5b8def;
    --primary-gradient-end: #3f6fd9;
    --text-color: #f5f5f5;
    --background-color: #1a1f27;
    --subtext-color: #c2c9d1;
    --border-color: #3a4250;
    --card-background: #262d37;
    --header-bg: rgba(18, 57, 128, 0.9);
    --header-highlight: linear-gradient(120deg, rgba(79, 135, 232, 0.4), rgba(59, 130, 246, 0.22));
    --header-border: rgba(96, 165, 250, 0.38);
    --header-text: #f1f6ff;
    --header-subtext: rgba(236, 244, 255, 0.76);
    --header-pill-hover: rgba(96, 165, 250, 0.28);
    --header-pill-active: linear-gradient(135deg, rgba(59, 130, 246, 0.94), rgba(37, 99, 235, 0.78));
  }

/* Outer Wrapper */
body.dark-mode .outer-wrapper {
  background-color: #202633; /* Slightly lighter to reduce contrast fatigue */
  box-shadow: none;          /* Remove the white shadow effect */
}

body.dark-mode .header .logo span {
  color: var(--header-text);
}
body.dark-mode .header .main-nav ul li a,
body.dark-mode .header .main-nav ul li button {
  border-color: rgba(59, 130, 246, 0.42);
  background: rgba(37, 99, 235, 0.2);
  color: var(--header-text);
}

body.dark-mode .toggle-tabs button {
  background: #1f2c45;
  border: 1px solid rgba(130, 170, 255, 0.6);
  color: #e2ebff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

body.dark-mode .toggle-tabs button:hover {
  background: #243552;
  color: #f0f5ff;
}

body.dark-mode .toggle-tabs button.active {
  background: linear-gradient(135deg, rgba(91, 141, 239, 0.94), rgba(63, 111, 217, 0.9));
  border-color: rgba(148, 197, 255, 0.75);
  color: #ffffff;
}

body.dark-mode .header .main-nav ul li.toggle-container .toggle-button {
  background: rgba(37, 99, 235, 0.18);
  border-color: rgba(96, 165, 250, 0.45);
}

body.dark-mode .header .main-nav ul li.toggle-container .toggle-button:hover {
  background: rgba(59, 130, 246, 0.28);
  border-color: rgba(148, 197, 255, 0.62);
}

body.dark-mode .header .main-nav ul li.toggle-container.is-active .toggle-button {
  background: rgba(59, 130, 246, 0.34);
  border-color: rgba(148, 197, 255, 0.68);
}

/* Sidebar */
body.dark-mode .modern-sidebar {
  background: linear-gradient(160deg, rgba(28, 36, 52, 0.94) 0%, rgba(20, 27, 39, 0.94) 100%);
  border-color: rgba(130, 170, 255, 0.18);
  color: #f5f5f5;
  box-shadow: 0 5px 14px rgba(2, 6, 16, 0.4);

}
body.dark-mode .modern-sidebar h3 {
  color: #a7c9ff; /* Accent color */
  letter-spacing: 0.12em;
}
body.dark-mode .modern-sidebar ul.sidebar-menu > li.section-title {
  color: rgba(226, 239, 255, 0.75);
  border: none;
}
body.dark-mode .modern-sidebar ul.sidebar-menu > li.section-title::after {
  background: linear-gradient(90deg, rgba(130, 170, 255, 0.4), transparent);
}
body.dark-mode .modern-sidebar ul.sidebar-menu li a {
  color: #8fb5ff;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-shadow: 0 0 1px rgba(130, 170, 255, 0.35);
}
body.dark-mode .modern-sidebar ul.sidebar-menu li a:hover {
  color: #b9d1ff;
  background-color: rgba(96, 168, 255, 0.2);
  border-left-color: rgba(96, 168, 255, 0.42);
}
body.dark-mode .modern-sidebar ul.sidebar-menu li a.sidebar-link.active {
  color: #e8f2ff;
  border-left-color: #76afff;
  background-color: rgba(110, 168, 255, 0.32);
  box-shadow: 0 10px 24px rgba(16, 74, 168, 0.3);
  text-shadow: 0 0 2px rgba(110, 168, 255, 0.42);
}
/* Hero Section */
body.dark-mode .hero {
  background-color: #242b36;
  color: #f5f5f5;
}

/* Cards on the Home Page (or anywhere else) */
body.dark-mode .card {
  background-color: #2a313d;  /* Slightly lighter gray for cards */
  border: 1px solid #465066;     /* Subtle border to separate from background */
  color: #f5f5f5;
}
body.dark-mode .card a {
  color: #82aaff;             /* Consistent link color */
}
body.dark-mode .card a:hover {
  background-color: #323a48;
}

/* Footer */
body.dark-mode .footer {
  background-color: #242b36;
  color: #f5f5f5;
}


/* Theory sections in dark mode */
body.dark-mode .theory-section,
body.dark-mode .theory-card,
body.dark-mode .fft-theory,
body.dark-mode .plot-theory {
  background-color: #1f1f1f;
  color: var(--text-color);
  border-color: var(--border-color);
}

/* Optional: Add transitions for a smoother switch */
body,
.header,
.modern-sidebar,
.hero,
.card,
.footer {
  transition: background-color 0.3s ease, color 0.3s ease;
}
  

/* process‑chain node shapes ------------------------------------- */
.node {             /* default rectangle (Re, Im, Filter, etc.)  */}
.node.mul {         /* circle with × */
  border-radius:50%;
  text-align:center;
  font-weight:bold;
  line-height:46px;           /* 50‑4 (border) */
}
.node.add { border-radius:50%; line-height:46px; font-weight:bold; }
.node.dot { width:10px; height:10px; border-radius:50%; }

/* override JS‑assigned colours */
.node.mul, .node.add { background:#fff; border:2px solid #000; }

#btnConnect.active {
  background-color: #ffd700;  /* gold */
  border-color:     #c0a000;
  color:            #000;
}

.quick-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 1em;
}
.quick-buttons button {
  padding: 4px 8px;
  font-size: 0.9em;
  cursor: pointer;
}

/* kernel UI as a 3×3 grid */
.kernel-grid {
  display: grid;
  grid-template-columns: repeat(3, 2.5em);
  gap: 0.2em;
  margin-bottom: 0.5em;
}
.kernel-cell {
  position: relative;
  width: 2.5em; height: 2.5em;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: white;
  border-radius: 0.2em;
  cursor: default;
}
.kernel-cell[data-val]:hover::after {
  content: attr(data-val);
  position: absolute;
  top: -1.5em; left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.75);
  color: #fff;
  padding: 0.2em 0.4em;
  border-radius: 0.2em;
  font-size: 0.75em;
  white-space: nowrap;
}

/* Ensure formulas remain readable in both themes */
.theory-section pre,
.theory-section .formula {
  color: #333;
}

body.dark-mode .theory-section pre,
body.dark-mode .theory-section .formula {
  color: #222;
  }

/* Custom font for navigation menus */
.header .main-nav ul li a,
.header .main-nav ul li button,
.modern-sidebar h3,
.modern-sidebar ul.sidebar-menu li a {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
}

/* News page */
.news-page {
  padding: 20px;
  max-width: 900px;
  margin: auto;
}

.news-header {
  margin-bottom: 2.5rem;
  text-align: center;
}

.news-header h1 {
  margin-bottom: 0.5rem;
}

.news-header p {
  color: #4b5563;
}

.news-timeline {
  display: flex;
  flex-direction: column;
}

.news-card {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.news-card__header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
  margin-bottom: 1rem;
}

.news-card h2 {
  margin: 0;
  font-size: 1.5rem;
  color: #1f2937;
}

.news-card__codename {
  margin: 0;
  color: #6b7280;
  font-weight: 500;
}

.news-card time {
  color: #2563eb;
  font-weight: 600;
}

.news-card ul {
  margin: 0;
  padding-left: 1.25rem;
  color: #1f2937;
}

.news-card li {
  margin-bottom: 0.5rem;
}

body.dark-mode .news-header p {
  color: #d1d5db;
}

body.dark-mode .news-card {
  background: #1f2937;
  border-color: #374151;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  color: #e5e7eb;
}

body.dark-mode .news-card h2 {
  color: #f9fafb;
}

body.dark-mode .news-card__codename {
  color: #cbd5f5;
}

body.dark-mode .news-card time {
  color: #93c5fd;
}

body.dark-mode .news-card ul {
  color: #e5e7eb;
}

body.dark-mode .news-card li {
  color: inherit;
}