/* ============================================================
   eQuilibrator — Design System
   Fonts: Lora (headings) · DM Sans (body) · IBM Plex Mono (data)
   ============================================================ */

/* ── Design Tokens ──────────────────────────────────────────── */
:root {
  --sidebar-bg:      #1A2640;
  --sidebar-hover:   #243352;
  --sidebar-text:    #8AAAC8;
  --sidebar-leaf:    #4D9FD6;

  --accent:          #1B5FA8;
  --accent-h:        #144A87;
  --accent-lt:       #EAF2FB;

  --bg:              #F6F4EF;
  --surface:         #FFFFFF;
  --border:          #E1DDD6;
  --border-h:        #C0BAB0;

  --text:            #1C1C1A;
  --text-2:          #68655E;
  --text-3:          #9B978F;

  --warn-bg:         #FEFAE6;
  --warn-bd:         #D4AF37;
  --warn-txt:        #7A5A00;
  --err-bg:          #FEF0EE;
  --err-bd:          #CC4433;

  --sidebar-w:       210px;
  --topbar-h:        54px;
  --radius:          6px;
  --radius-lg:       10px;
  --radius-xl:       14px;

  --shadow-xs:  0 1px 2px rgba(0,0,0,.05);
  --shadow-sm:  0 1px 4px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:  0 4px 16px rgba(0,0,0,.09), 0 2px 5px rgba(0,0,0,.05);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.10), 0 3px 10px rgba(0,0,0,.06);

  --ease: cubic-bezier(.25,.46,.45,.94);
  --dur:  0.17s;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  zoom: 1.2;
}

/* ── Typography ─────────────────────────────────────────────── */
h1, h2, h3, h4, h5 {
  font-family: 'Lora', Georgia, serif;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--dur) var(--ease);
}
a:hover {
  color: var(--accent-h);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

sub, sup { font-size: .73em; line-height: 0; }

/* Ensure tables always inherit font and line-height from context */
table, tr, td, th { font-size: inherit; line-height: inherit; }

/* ── Sidebar Navigation ─────────────────────────────────────── */
nav.menu {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100dvh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: visible;
}

.menu .logo {
  padding: 22px 18px 18px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.menu .logo a { display: block; }
.menu .logo img {
  width: 75%;
  max-width: 130px;
  display: block;
  opacity: .92;
  /* keep logo visible on dark bg */
  filter: brightness(1.08);
}

.menu-items {
  flex: 1;
  padding: 6px 0;
  overflow: visible;
}

.menu-items ul { list-style: none; }
.menu-items li { position: relative; }

.menu-items li a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 18px;
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: .01em;
  text-decoration: none;
  border-left: 2px solid transparent;
  transition:
    background var(--dur) var(--ease),
    color var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}
.menu-items li a:hover {
  background: var(--sidebar-hover);
  color: #fff;
  border-left-color: var(--sidebar-leaf);
  text-decoration: none;
}
.menu-items li a:focus-visible {
  outline: none;
  background: var(--sidebar-hover);
  color: #fff;
}

.menu-items img {
  width: 30px;
  height: 30px;
  opacity: 1;
  flex-shrink: 0;
  transition: opacity var(--dur) var(--ease);
}
.menu-items li a:hover img { opacity: 1; }

.menu-items sup { color: #FF7E6B; font-size: .68em; }

/* ── Nav Dropdown ────────────────────────────────────────────── */
.dropdown { position: static; }

.dropdown-content {
  display: none;
  position: absolute;
  left: 100%;
  top: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 185px;
  z-index: 200;
  overflow: hidden;
}

.dropdown-content a {
  display: block;
  padding: 10px 16px;
  color: var(--text);
  font-size: 13.5px;
  border-left: 2px solid transparent;
  transition: background var(--dur), border-color var(--dur);
}
.dropdown-content a:hover {
  background: var(--accent-lt);
  border-left-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.dropdown:hover .dropdown-content { display: block; }
.dropdown:hover > a {
  background: var(--sidebar-hover);
  color: #fff;
  border-left-color: var(--sidebar-leaf);
}
.dropdown:hover > a img { opacity: .9; }

/* ── Top Search Bar ──────────────────────────────────────────── */
.searchBar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  z-index: 50;
  box-shadow: var(--shadow-xs);
}

.searchBar form,
.searchBar .mui-form--inline {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 600px;
  padding: 0;
}

.searchBar .mui-textfield {
  flex: 1;
  padding-top: 0;
}
.searchBar .mui-textfield::after { display: none !important; }

.searchBar #queryField {
  width: 100% !important;
  height: 36px;
  padding: 0 14px !important;
  border: 1.5px solid var(--border) !important;
  border-bottom: 1.5px solid var(--border) !important;
  border-radius: var(--radius) !important;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color var(--dur), box-shadow var(--dur);
  box-shadow: none;
}
.searchBar #queryField:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(27,95,168,.12) !important;
  background: var(--surface);
  outline: none !important;
}

.searchButtonSmall {
  width: 30px;
  height: 30px;
  padding: 6px;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  opacity: .5;
  transition: opacity var(--dur), background var(--dur), filter var(--dur);
  flex-shrink: 0;
}
.searchButtonSmall:hover {
  opacity: 1;
  background: var(--accent);
  filter: invert(1);
}

/* ── Main Content Layout ─────────────────────────────────────── */
.centerize {
  position: static;
  left: auto;
}

#internal {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  padding: 36px 44px;
  max-width: 900px;
  text-align: left;
}

/* ── Home / Welcome ──────────────────────────────────────────── */
#welcome {
  position: static;
  transform: none;
  top: auto;
  width: auto;
  margin-left: var(--sidebar-w);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 80px 40px 60px;
  text-align: center;
}

#welcome .mainTitle,
.mainTitle {
  font-family: 'Lora', Georgia, serif;
  font-size: 38px;
  font-weight: 400;
  color: var(--accent);
  letter-spacing: -.3px;
}

#welcome form {
  width: 100%;
  max-width: min(1360px, 90%);
}

#welcomeSearchBar {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-xl);
  height: 56px;
  width: 100%;
  margin: 20px auto;
  overflow: hidden;
  transition: border-color var(--dur), box-shadow var(--dur);
}
#welcomeSearchBar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(27,95,168,.10);
}

#welcomeSearchBar .searchHint { flex: 1; }

#welcomeSearchBar #queryField {
  flex: 1;
  width: 100%;
  border: none;
  padding: 0 22px;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  color: var(--text);
  background: transparent;
  outline: none;
}
#welcomeSearchBar #queryField:focus {
  border: none;
  box-shadow: none;
  outline: none;
}
#welcomeSearchBar #queryField::placeholder { color: var(--text-3); }

.searchButtonLarge {
  width: 44px;
  height: 44px;
  margin: 4px;
  padding: 11px;
  background: var(--accent);
  border: none;
  border-radius: calc(var(--radius-xl) - 4px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--dur);
}
.searchButtonLarge:hover { background: var(--accent-h); }
.searchButtonLarge img { filter: invert(1); width: 100%; display: block; }

#welcome input:focus { outline: none; }
#welcome a { color: var(--accent); }

#exampleText {
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.75;
  margin: 4px 0 12px;
}
#exampleText a {
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  padding-bottom: 1px;
}
#exampleText a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
  text-decoration: none;
}

/* ── Panels ──────────────────────────────────────────────────── */
.mui-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin: 16px 0;
  display: block;
  width: 100%;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  padding: 0;
}

.mui-panel .title {
  background: var(--accent-lt);
  color: var(--accent-h);
  font-family: 'Lora', Georgia, serif;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.mui-panel > table,
.mui-panel .mui-table { margin: 0; }

/* Plain tables inside panels match mui-table cell spacing */
.mui-panel table:not(.mui-table) td,
.mui-panel table:not(.mui-table) th {
  padding: 8px 4px;
  vertical-align: middle;
}

/* Pathway step 1 form table column widths */
.pathway-form-table { width: 100%; }
.pathway-form-table .col-label { width: 40%; }
.pathway-form-table .col-input { width: 30%; }

/* Pad non-table content that sits directly inside a panel */
.mui-panel > form,
.mui-panel > p,
.mui-panel > ol,
.mui-panel > ul,
.mui-panel > .paragraph,
.mui-panel > div:not(.title) {
  padding: 14px 20px;
}
.mui-panel > br { display: none; }

/* ── Tables ──────────────────────────────────────────────────── */
.mui-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.mui-table th {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-2);
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  background: var(--bg);
}
.mui-table--centered th { text-align: center !important; }
.mui-table--centered td { text-align: center; }

.mui-table td {
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.mui-table tr:last-child td { border-bottom: none; }
.mui-table tbody tr:hover td { background: rgba(0,0,0,.016); }

.mui-table .column1 {
  width: 22%;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.mui-btn,
a.mui-btn,
button.mui-btn,
input[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
  border: 1.5px solid transparent;
  text-decoration: none;
  margin: 3px 2px;
  vertical-align: middle;
  transition: background var(--dur), border-color var(--dur), box-shadow var(--dur), color var(--dur);
}

.mui-btn--primary,
input[type="submit"] {
  background: var(--accent);
  color: #fff !important;
  border-color: var(--accent);
}
.mui-btn--primary:hover,
input[type="submit"]:hover {
  background: var(--accent-h);
  border-color: var(--accent-h);
  color: #fff;
  text-decoration: none;
  box-shadow: var(--shadow-md);
}

.mui-btn:not(.mui-btn--primary) {
  background: var(--surface);
  color: var(--accent);
  border-color: var(--border);
}
.mui-btn:not(.mui-btn--primary):hover {
  background: var(--accent-lt);
  border-color: var(--accent);
  text-decoration: none;
}

/* ── Form Inputs ─────────────────────────────────────────────── */
input[type="text"],
input[type="number"],
select {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color var(--dur), box-shadow var(--dur);
  -webkit-appearance: none;
}
input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(27,95,168,.1);
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%2368655E' d='M5 6L0 0h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  cursor: pointer;
}

/* MUI textfield reset */
.mui-textfield { padding-top: 0 !important; }
.mui-textfield::after { display: none !important; }
.mui-textfield > label { font-size: 13px; color: var(--text-2); }
.mui-form--inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* ── jQuery UI Slider ────────────────────────────────────────── */
.ui-slider {
  background: var(--border) !important;
  border: none !important;
  border-radius: 3px !important;
  height: 4px !important;
  box-shadow: none !important;
  cursor: pointer;
}
.ui-slider .ui-slider-range {
  background: var(--accent) !important;
  border: none !important;
  border-radius: 3px !important;
}
.ui-slider .ui-slider-handle {
  width: 16px !important;
  height: 16px !important;
  top: -6px !important;
  border-radius: 50% !important;
  background: var(--surface) !important;
  border: 2px solid var(--accent) !important;
  box-shadow: var(--shadow-sm) !important;
  cursor: grab;
  transition: box-shadow var(--dur);
  outline: none;
}
.ui-slider .ui-slider-handle:hover,
.ui-slider .ui-slider-handle.ui-state-active {
  box-shadow: 0 0 0 4px rgba(27,95,168,.15) !important;
  cursor: grabbing;
}

/* ── jQuery UI Button (.buttonset) ──────────────────────────── */
.ui-button {
  display: inline-flex !important;
  align-items: center;
  padding: 6px 14px !important;
  font-family: 'DM Sans', sans-serif !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  color: var(--text-2) !important;
  background: var(--surface) !important;
  border: 1.5px solid var(--border) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  text-shadow: none !important;
  cursor: pointer;
  transition: background var(--dur), color var(--dur);
}
.ui-button:first-child { border-radius: var(--radius) 0 0 var(--radius) !important; }
.ui-button:last-child  { border-radius: 0 var(--radius) var(--radius) 0 !important; }
.ui-button.ui-state-active,
.ui-button:hover {
  background: var(--accent-lt) !important;
  color: var(--accent) !important;
  border-color: var(--accent) !important;
  z-index: 1;
}
.ui-button .ui-button-text { padding: 0 !important; }
.ui-buttonset .ui-button { margin-right: -1px; }

/* ── Autocomplete ────────────────────────────────────────────── */
.autocomplete-suggestions {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: auto;
  margin-top: 4px;
  z-index: 1000;
}
.autocomplete-suggestion {
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background var(--dur);
}
.autocomplete-suggestion:last-child { border-bottom: none; }
.autocomplete-no-suggestion { padding: 10px 16px; color: var(--text-2); font-size: 14px; }
.autocomplete-selected { background: var(--accent-lt); }
.autocomplete-suggestions strong { font-weight: 600; color: var(--accent); }
.autocomplete-group strong {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 8px 16px 4px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

/* ── Search Results ──────────────────────────────────────────── */
#searchResults { text-align: left; border: none; }

#searchResults .resultTitle {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-2);
  margin: 28px 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  width: 100%;
}

.compoundSearchResults,
.enzymeSearchResults {
  transition: box-shadow var(--dur), transform var(--dur) var(--ease),
              background var(--dur), border-color var(--dur);
}
#searchResults .compoundSearchResults:hover {
  background: var(--accent-lt);
  border-color: var(--accent);
  box-shadow: var(--shadow-md) !important;
  transform: translateY(-1px);
}
#searchResults .compoundSearchResults:hover .title {
  background: transparent;
}
#searchResults .compoundSearchResults:hover .mui-table tbody tr:hover td,
#searchResults .compoundSearchResults:hover .mui-table tbody tr td {
  background: transparent;
}

#searchResults .compoundSearchResults .column1 { width: 18%; color: var(--text-2); font-size: 13px; font-weight: 500; }
#searchResults .compoundSearchResults .column2 { width: 56%; text-align: left; }
#searchResults .compoundSearchResults .column3 { width: 26%; text-align: center; }

#searchResults .enzymeSearchResults .reactionLink { color: var(--accent); }
#searchResults .enzymeSearchResults .viewAllLink { color: var(--sidebar-leaf); }
#searchResults .image img { border: none; max-height: 120px; }

/* ── Parsed Reaction / Title ─────────────────────────────────── */
.parsedRxn, .compoundSelector, .compound, .enzyme {
  font-family: 'Lora', Georgia, serif;
  font-size: 22px;
  font-weight: 400;
  margin: 20px 0 14px;
  color: var(--text);
}
.parsedRxn, .reactionController { text-align: center; }

/* ── Warnings & Errors ───────────────────────────────────────── */
.warning {
  background: var(--warn-bg);
  border: 1px solid var(--warn-bd);
  border-left: 3px solid var(--warn-bd);
  color: var(--warn-txt);
  border-radius: var(--radius);
  padding: 12px 18px;
  margin: 12px 0;
  max-width: 560px;
  font-size: 14px;
}
.warning a { color: var(--warn-txt); text-decoration: underline; }

.error, .errorMsg {
  background: var(--err-bg);
  border: 1px solid #EDA8A0;
  border-left: 3px solid var(--err-bd);
  border-radius: var(--radius);
  padding: 12px 18px;
  margin: 12px auto;
  max-width: 560px;
  font-size: 14px;
}
.missingCount { color: #CC3333; font-weight: 600; }

/* ── Pathway build: spinner / result / error ────────────────── */
.pathway-spinner {
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 14px auto;
  color: var(--text-2);
  font-size: 14px;
}
.pathway-spinner:not([hidden]) { display: flex; }
.pathway-spinner__dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--accent-lt);
  border-top-color: var(--accent);
  animation: pathway-spin 0.8s linear infinite;
}
@keyframes pathway-spin {
  to { transform: rotate(360deg); }
}
.pathway-build-result {
  margin: 14px auto;
  padding: 14px 18px;
  background: var(--accent-lt);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  max-width: 560px;
  text-align: center;
}
.pathway-build-result p { margin: 0 0 10px; color: var(--text); font-size: 14px; }
.pathway-build-error {
  background: var(--err-bg);
  border: 1px solid #EDA8A0;
  border-left: 3px solid var(--err-bd);
  border-radius: var(--radius);
  padding: 12px 18px;
  margin: 14px auto;
  max-width: 560px;
  font-size: 14px;
  text-align: center;
}

/* ── Pathway result report, embedded in the analysis modal ─────── */
.pathway-embed-body {
  margin: 0;
  background: var(--bg);
}
.pathway-embed-content {
  padding: 24px 28px 32px;
  text-align: left;
}
.pathway-chart-container {
  position: relative;
  width: 100%;
  height: 360px;
  margin: 0 auto 24px;
}

/* step 1: the build's progress bar, with a count of mapped reactions */
.pathway-build-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0;
  color: var(--text-2);
  font-size: 14px;
}
.pathway-build-progress[hidden] { display: none; }
.pathway-build-progress progress {
  flex: 0 1 320px;
  height: 10px;
  accent-color: var(--accent);
}
.pathway-build-progress span {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* step 1: the save icon beside the example link */
.pathway-example-save {
  text-decoration: none;
  margin-left: 2px;
}

/* ── Pathway analysis modal ──────────────────────────────────── */
.pathway-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(28, 28, 26, 0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.pathway-modal-overlay[hidden] { display: none; }
.pathway-modal {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  width: min(900px, 100%);
  /* 100% of the overlay (a fixed box the size of the window, less its 24px
     padding) rather than 90vh: body has zoom: 1.2 on desktop widths, and
     viewport units inside a zoomed element are magnified with it, so 90vh
     rendered as 108% of the window and the title and close button ended up
     off-screen. A percentage of the overlay holds at any zoom. */
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pathway-modal__close {
  position: absolute;
  top: 8px;
  right: 12px;
  z-index: 1;
  border: none;
  background: transparent;
  font-size: 28px;
  line-height: 1;
  color: var(--text-2);
  cursor: pointer;
}
.pathway-modal__close:hover { color: var(--text); }
.pathway-modal__loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 60px 40px;
  color: var(--text-2);
  font-size: 15px;
}
.pathway-modal__loading[hidden] { display: none; }
.pathway-modal__frame {
  flex: 1;
  width: 100%;
  min-height: 70vh;
  border: none;
}
.pathway-modal__frame[hidden] { display: none; }

/* ── Sliders / Concentration controls ───────────────────────── */
.sliderContainer { width: 65%; min-width: 80px; }

/* ── Toggle Switch ───────────────────────────────────────────── */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}
.switch input { display: none; }

/* .slider is used for both the toggle AND jQuery UI slider — scope carefully */
.switch .slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  cursor: pointer;
  border-radius: 26px;
  transition: background var(--dur);
}
.switch .slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 4px;
  top: 4px;
  background: #fff;
  border-radius: 50%;
  box-shadow: var(--shadow-xs);
  transition: transform var(--dur) var(--ease);
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(24px); }
.switch .slider.round { border-radius: 26px; }
.switch .slider.round::before { border-radius: 50%; }

/* Reset old style.css label/checkbox hack */
input[type=checkbox] { height: auto; width: auto; visibility: visible; }
label {
  cursor: default;
  text-indent: 0;
  width: auto;
  height: auto;
  background: none !important;
  display: inline;
  border-radius: 0;
  position: static;
}
label::after { display: none !important; }
input:checked + label { background: none !important; }
input:checked + label::after { display: none !important; }
label:active::after { display: none !important; }

/* ── Examples hover panel ────────────────────────────────────── */
#examplesHover {
  display: inline-block;
  position: relative;
  cursor: pointer;
}
#examplesHover img { display: block; opacity: .6; transition: opacity var(--dur); }
#examplesHover:hover img { opacity: 1; }

#examplesPanel {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 540px;
  z-index: 300;
  text-align: left;
}

/* ── Graph / Plot link icon ──────────────────────────────────── */
.graphLink { float: left; margin-right: 8px; }
.graphLink img { width: 27px; height: 27px; vertical-align: middle; opacity: .55; }
.graphLink:hover img { opacity: 1; }

/* ── Misc ────────────────────────────────────────────────────── */
.paragraph { text-align: justify; line-height: 1.78; }
.paragraph .footnote { font-size: 80%; color: var(--text-2); margin-top: 10px; }

.paragraph ol,
.paragraph ul {
  padding-left: 1.5em;
  margin: 6px 0;
}
.paragraph li { margin-bottom: 6px; line-height: 1.7; }

.subscript { font-size: 75%; vertical-align: bottom; }

.input-box { position: relative; }
.unit { position: absolute; left: 82px; top: 6px; font-size: 12px; color: var(--text-2); z-index: 9; }

.customConcentrations { display: none; }

.logoLarge img { max-width: 300px; border: none; margin: 20px auto; display: block; text-align: center; }

#figureContainer { margin: 16px auto 36px; width: 600px; height: 300px; }
#figureContainer #legendContainer { float: right; }
#figureContainer #dgFigure { clear: both; }

.refsList { text-align: left; }
.refsList a { color: var(--sidebar-leaf); }

.adminLink { font-size: 11px; color: var(--text-3); }
.printable  { margin: 10%; font-size: 18px; }

/* ── Table variants ──────────────────────────────────────────── */
table.compoundInfo,
table.enzymeInfo { width: 100%; }

.results td, .compoundInfo td, .speciesInfo td,
.enzymeInfo td, .reactionInfo td, .formationEnergyInfo td { padding: 10px 20px; }

table.reactionInfo,
table.speciesInfo,
table.formationEnergyInfo { text-align: center; padding: 0; width: 100%; }

.speciesSource.last td,
td.reference.border { border-bottom: 1px solid var(--border); }

/* ── Pathway table ───────────────────────────────────────────── */
.pathwayPageTable .column1 { width: 40%; }
.pathwayPageTable .column2 { width: 15%; }
.pathwayPageTable .column3 { width: 45%; }

/* ── Graph Modal ─────────────────────────────────────────────── */
#graphModal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}

#graphModalBackdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(3px);
}

#graphModalDialog {
  position: relative;
  background: var(--bg);
  border-radius: var(--radius-xl);
  width: 90vw;
  max-width: 1100px;
  height: 82vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 1;
}

#graphModalClose {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 30px;
  height: 30px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  color: var(--text-2);
  line-height: 1;
  transition: background var(--dur), border-color var(--dur), color var(--dur);
}
#graphModalClose:hover {
  background: var(--err-bg);
  border-color: var(--err-bd);
  color: var(--err-bd);
}

#graphModalFrame {
  flex: 1;
  border: none;
  width: 100%;
}

/* ── Hamburger button (hidden on desktop) ────────────────────── */
.menu-toggle {
  display: none;
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 102;
  background: var(--sidebar-bg);
  border: none;
  border-radius: var(--radius);
  width: 40px;
  height: 40px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  box-shadow: var(--shadow-md);
}
.menu-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--sidebar-text);
  border-radius: 2px;
  transition: transform var(--dur) var(--ease), opacity var(--dur);
}
body.nav-open .menu-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.nav-open .menu-toggle span:nth-child(2) { opacity: 0; }
body.nav-open .menu-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Nav overlay (mobile backdrop) ──────────────────────────── */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 99;
  backdrop-filter: blur(2px);
}
body.nav-open .nav-overlay { display: block; }

/* ── Responsive: phone & tablet ───────────────────────────────── */
/* 860px covers iPad-portrait widths (~768–834px) too — at those
   widths the fixed 210px sidebar leaves too little room to read
   data tables comfortably, so they get the off-canvas nav as well. */
@media (max-width: 860px) {
  body { zoom: 1; }

  .menu-toggle { display: flex; }

  nav.menu {
    transform: translateX(-100%);
    transition: transform 0.25s var(--ease);
    z-index: 101;
  }
  body.nav-open nav.menu { transform: translateX(0); }

  .searchBar {
    left: 0;
    padding: 0 12px 0 58px;
  }

  #internal {
    margin-left: 0;
    padding: 20px 16px;
    max-width: 100%;
  }

  #welcome {
    margin-left: 0;
    padding: 64px 20px 40px;
  }

  #welcome .mainTitle,
  .mainTitle {
    font-size: 26px;
  }

  #welcomeSearchBar { height: 50px; }

  #examplesPanel {
    width: calc(100vw - 32px);
    left: 50%;
    transform: translateX(-50%);
  }

  .sliderContainer { width: 100%; }

  .mui-panel { overflow-x: auto; }

  #figureContainer { width: 100%; height: 240px; }

  #graphModalDialog { width: 100vw; height: 100vh; border-radius: 0; }

  /* Key/value panel tables (label cell + value cell) read better stacked
     than squeezed side-by-side — e.g. ΔrG' labels with links/superscripts
     next to a number. Grid-style tables (.mui-table--centered) keep their
     columns and scroll horizontally instead via .mui-panel overflow-x above. */
  .mui-panel:not(.compoundSearchResults):not(.enzymeSearchResults)
    table.mui-table:not(.mui-table--centered) tr {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 0;
  }
  .mui-panel:not(.compoundSearchResults):not(.enzymeSearchResults)
    table.mui-table:not(.mui-table--centered) td {
    width: auto !important;
    padding: 0 20px;
    border-bottom: none;
  }
  .mui-panel:not(.compoundSearchResults):not(.enzymeSearchResults)
    table.mui-table:not(.mui-table--centered) tr:not(:last-child) {
    border-bottom: 1px solid var(--border);
  }
}
