:root {
  --bg: #0b1020;
  --card: #121a33;
  --text: #e8eefc;
  --muted: #b4c0df;
  --accent: #66d9ef;
  --border: #243055;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 800px at 20% -10%, #1a2550 0%, var(--bg) 50%) no-repeat fixed;
  min-height: 100vh;
}

header {
  padding: 24px;
  text-align: center;
}

h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0.3px;
}

main {
  max-width: 1100px;
  margin: 0 auto 64px;
  padding: 0 16px;
}

.controls {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: center;
  padding: 12px 0 24px;
  flex-wrap: nowrap;    /* keep everything on one line */
  width: 100%;          /* ADD THIS */
  max-width: 1400px;    /* ADD THIS - increase container width */
}


label { color: var(--muted); }

select, input[type="number"] {
  background: #0f1730;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 10px;
  outline: none;
}

button {
  background: var(--accent);
  color: #091121;
  border: 0;
  padding: 8px 14px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
}

button.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

button:disabled,
select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  margin: 16px auto;
}

.card-header h2 {
  margin: 4px 0 0 0;
  font-size: 18px;
}
.card-header p { color: var(--muted); margin-top: 6px; }

#tableWrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-top: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #0f1730;
}

thead th {
  position: sticky;
  top: 0;
  background: #0d142a;
  color: var(--muted);
  font-weight: 600;
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid #132047;
}

tbody tr:hover td {
  background: #0d1633;
}

.lipid-name {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color: #dbe7ff;
  white-space: nowrap;
}

.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.actions-left {
  flex: 1;
  min-width: 220px;
}

.actions-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: auto;
}

.plot { width: 100%; min-height: 420px; }
#plot { max-width: 980px; margin: 0 auto; }

footer {
  text-align: center;
  margin: 32px 0 18px;
  color: var(--muted);
  font-size: 12px;
}

.hidden { 
  display: none !important; 
}


.cd1-selector {
  display: flex;
  gap: 10px;
  margin: 14px 0;
  flex-wrap: wrap;
}

.cd1-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid #2f3c66;
  border-radius: 20px;
  padding: 6px 14px;
  color: #b4c0df;
  font-weight: 500;
  background: #101930;
  transition: all 0.2s ease;
  user-select: none;
}

.cd1-toggle input {
  display: none;
}

.cd1-toggle input:checked + span {
  color: #fff;
  font-weight: 600;
}

.cd1-toggle input:checked + span::after {
  content: " ✓";
  color: #00ff99;
  font-weight: 700;
}



#highResBtn {
  margin-left: 12px;
  padding: 6px 12px;
  font-size: 13px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  transition: background 0.2s ease;
}
#highResBtn:hover {
  background: #243055;
}


/* Fix alignment only for dataset info card */
#datasetInfo .actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  margin-top: 16px;
  padding-left: 0; /* aligns with Contributors column */
}

/* Lipid category block aligns label + dropdown inline */
#lipidCategoryBlock {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: 0px; /* spacing before CD1 buttons */
}

#lipidCategoryBlock label {
  color: var(--muted);
  font-weight: 600;
  min-width: 110px;       /* Same as .controls label for alignment */
  text-align: right;      /* Align text to right like other labels */
}
#lipidCategoryBlock select {
  width: 160px;
  background-color: #0e1428;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 14px;
}






.controls label {
  display: inline-block;
  min-width: 110px;     /* keeps long labels from pushing things */
  text-align: right;
  white-space: nowrap;
}

.controls select {
  width: 160px;         /* Fixed width - no stretching */
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.controls button {
  margin-left: 8px;      /* Add some space from the select */
  white-space: nowrap;   /* Prevent text wrapping */
  flex-shrink: 0;        /* Prevent button from shrinking */
}



/* ===========================
   Theme toggle + Light mode
   =========================== */

/* Slider-style theme toggle */
.theme-toggle {
  position: relative;      /* now positioned inside its container */
  top: 0;
  right: 0;
  z-index: 1;

  width: 56px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  outline: none;

  /* hide the emoji text visually; keep it for screen readers */
  text-indent: -9999px;
  overflow: hidden;
  margin-left: 10px;       /* small gap after the Guide button */
}


/* Track with neutral gray sun + moon icons (dark mode) */
.theme-toggle::before {
  content: "\263E\2600";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, #111827, #1f2937);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.7);

  display: flex;
  align-items: center;
  
  /* 1. Change to flex-start to anchor everything to the left (Moon side) */
  justify-content: flex-start;
  
  /* 2. Add padding-left to lock the Moon's position */
  /* Adjust this number (e.g., 8px) to set exactly where the Moon sits */
  padding-left: 12px; 

  white-space: nowrap;

  /* 3. Use letter-spacing to push the Sun away from the Moon */
  /* Increase/Decrease this to move ONLY the Sun */
  letter-spacing: 18px; 

  /* 4. Remove the negative margin hack, we don't need it with flex-start */
  margin-right: 0; 

  font-size: 13px;
  font-family: "Segoe UI Symbol", system-ui, -apple-system, sans-serif;
  color: rgba(229, 231, 235, 0.9);
  text-indent: 0;
  transition: all 0.22s ease-out;
}





/* Thumb */
.theme-toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #f9fafb;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.7);
  transform: translateX(0);
  transition:
    transform 0.22s ease-out,
    background 0.22s ease-out,
    box-shadow 0.22s ease-out;
}

.theme-toggle:hover::before {
  filter: brightness(1.08);
}

/* Light mode: light gray track, gray icons */
body.light-mode .theme-toggle::before {
  background: linear-gradient(135deg, #e5e7eb, #d1d5db);  /* light gray */
  box-shadow: 0 6px 16px rgba(148, 163, 184, 0.6);
  color: rgba(75, 85, 99, 0.95);  /* darker gray icons */
}


body.light-mode .theme-toggle::after {
  transform: translateX(26px);
  background: #ffffff;
  box-shadow: 0 4px 10px rgba(148, 163, 184, 0.7);
}

/* Light theme – design tokens + background */
body.light-mode {
  --bg: #f5f7ff;
  --card: rgba(232, 241, 255, 0.75);
  --text: #111827;
  --muted: #4b5563;
  --accent: #2563eb;
  --border: rgba(148, 163, 184, 0.7);

  color: var(--text);
  background: radial-gradient(
      1200px 800px at 20% -40%,
      #e3edff 0%,
      #f9fbff 45%,
      #eef2f7 100%
  ) no-repeat fixed;
}

/* Glassy cards in light mode */
body.light-mode .card {
  background: var(--card);
  border-color: rgba(148, 163, 184, 0.7);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

/* Inputs/selects on light background */
body.light-mode select,
body.light-mode input[type="number"] {
  background: rgba(248, 250, 252, 0.9);
  color: var(--text);
  border-color: rgba(148, 163, 184, 0.9);
}

/* Tables */
body.light-mode table {
  background: rgba(255, 255, 255, 0.94);
}

body.light-mode thead th {
  background: #e5edf9;
  color: var(--muted);
  border-bottom-color: #d1d5db;
}

/* Softer hover rows in light mode (fixes very dark bar) */
body.light-mode tbody tr:hover td {
  background: rgba(209, 213, 219, 0.7);
}

/* CD1 chips – stronger contrast in light mode */
body.light-mode .cd1-toggle {
  border-color: #9bb5ff;
  background: #d7e6ff;
  color: #111827;
  box-shadow: 0 4px 12px rgba(148, 163, 184, 0.45);
}


body.light-mode .cd1-toggle input:checked + span::after {
  color: #16a34a;
}

/* High-res button hover override */
body.light-mode #highResBtn:hover {
  background: rgba(37, 99, 235, 0.08);
}



/* Light-mode styling for the Lipid Classes dropdown */
body.light-mode #classSelect {
  background-color: #dbeafe !important;   /* light blue */
  color: #111827 !important;
  border-color: #9bb5ff !important;
}

/* Options inside the dropdown list */
body.light-mode #classSelect option {
  background-color: #f9fafb;
  color: #111827;
}




/* Admin panel metadata rows */
.controls-row {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: nowrap;        /* keep each pair on one line */
  margin-bottom: 12px;
}

.controls-row label {
  min-width: 110px;
  text-align: right;
  white-space: nowrap;
}

.controls-row input,
.controls-row select {
  width: 260px;             /* you can set 160 here if you want shorter fields */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* Make the Dataset Information card narrower and centered */
#metaSection,
#manageSection,
#lipidSection,
#overviewSection,
#successSection,
#modifySection {
  max-width: 1000px;   /* try 900 if you want it even tighter */
  margin: 0 auto 24px; /* center inside main */
}

.about-hero {
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 24px;
}

.logo-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  justify-items: center;
}

.logo-strip--secondary {
  margin-top: 24px;
  padding: 0 24px 24px;
}

.logo-badge {
  width: 100%;
  min-height: 78px;
  border: 1px solid var(--border);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  font-size: 14px;
  text-align: center;
  background: rgba(15, 23, 30, 0.6);
  color: var(--text);
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.logo-badge::after {
  content: "Replace with logo or institution";
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin-top: 4px;
}

.logo-badge:hover {
  border-color: var(--accent);
  box-shadow: 0 10px 24px rgba(6, 9, 25, 0.35);
}

.about-content {
  max-width: 900px;
}

.about-copy {
  margin-top: 12px;
  font-size: 16px;
  line-height: 1.6;
  text-align: left;
}

.footer-link {
  color: var(--muted);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.footer-link:hover {
  opacity: 0.8;
}

/* Sample comparison layout */
.compare-columns {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}

.compare-column {
  flex: 1;
  min-width: 260px;
}

.compare-column h3 {
  margin-top: 0;
  margin-bottom: 12px;
}

.compare-column .controls-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.compare-column .controls-row label {
  min-width: 120px;
  text-align: left;
}

.compare-column .controls-row select {
  flex: 1;
}

.compare-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  margin-top: 20px;
}

.compare-class-block {
  display: flex;
  align-items: center;
  gap: 10px;
}
