:root {
  /* Teal workspace + deep-slate text, matching the palette established
     across the rest of the site (see homepage.php / header_gdp.php). */
  --main-color: #008995;
  --hover-color: #006B76;
  --primary: #0F172A;
  --secondary: #475569;
  --text-color: #0F172A;
  --text-muted: #64748B;
  --light-bg: #E6F5F6;
  --border-color: #E0EAE4;
  --accent: #008995;
  --accent-dark: #006B76;
  --row-hover: #F0FBFB;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', 'Segoe UI', sans-serif;
  color: var(--text-color);
  background: linear-gradient(160deg, #E6F5F6 0%, #F7FDFD 40%, #ffffff 75%);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.main-content { padding: 40px clamp(16px, 3vw, 60px); width: 100%; max-width: 100%; margin: 0 auto; flex: 1; }

.page-header { text-align: center; margin-bottom: 50px; }
.page-header h1 { color: var(--primary); font-size: 2.8em; margin-bottom: 15px; font-weight: 600; position: relative; display: inline-block; }
.page-header .info-icon { color: var(--main-color); font-size: 0.5em; cursor: help; position: absolute; top: -0.3em; right: -0.9em; transition: color 0.3s ease, transform 0.2s ease; text-decoration: none; }
.page-header .info-icon:hover { color: var(--hover-color); transform: scale(1.1); }
.page-header .info-icon:active { transform: scale(0.95); }

.controls-section { background: var(--light-bg); padding: 20px; border-radius: 8px; margin-bottom: 30px; }
.controls-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 20px; margin-bottom: 15px; }
.control-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.control-group input[type="text"] { padding: 8px 12px; border: 1px solid var(--border-color); border-radius: 4px; width: 200px; }
.control-group select { padding: 8px 12px; border: 1px solid var(--border-color); border-radius: 4px; background: white; }
.control-group button, .control-group input[type="submit"] { padding: 8px 16px; background: var(--main-color); color: white; border: none; border-radius: 4px; cursor: pointer; font-weight: 500; }
.control-group button:hover, .control-group input[type="submit"]:hover { background: var(--hover-color); }
.control-group .download-icon-btn { background: none; border: none; cursor: pointer; font-size: 24px; color: var(--primary); margin-left: auto; }

.alphabet-filter { display: flex; flex-wrap: wrap; gap: 5px; }
.alphabet-filter button { padding: 8px 10px; border: 1px solid var(--border-color); background: var(--light-bg); color: var(--text-color); cursor: pointer; border-radius: 4px; font-weight: 500; transition: all 0.3s; }
.alphabet-filter button:hover, .alphabet-filter button.active { background: var(--main-color); color: white; border-color: var(--main-color); }

/* Puts the A-Z filter and the Save/Download actions on one shared row
   instead of each stacking as its own full-width block -- the A-Z buttons
   submit the search form above via form="pathwayFilterForm" even though
   they're not its DOM descendant, so this row can be positioned freely.
   The row itself doesn't wrap -- .alphabet-filter (flexible, wraps its own
   letter buttons onto as many internal lines as needed) shrinks to make
   room, while the actions stay a fixed-width column pinned to the right
   instead of dropping to a 3rd line below the full-width letter grid. */
.alphabet-actions-row { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: nowrap; gap: 12px; }
.alphabet-actions-row .alphabet-filter { flex: 1 1 auto; min-width: 0; }
.pathway-actions-inline { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; flex: 0 0 auto; justify-content: flex-end; }
.pathway-actions-inline .download-options { margin-bottom: 0; }

@media (max-width: 700px) {
  .alphabet-actions-row { flex-wrap: wrap; }
  .pathway-actions-inline { justify-content: flex-start; }
}

.filter-panel { background: #E6F5F6; padding: 15px 20px; border-radius: 8px; margin-bottom: 20px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.filter-info { color: var(--primary); font-weight: 500; }
.filter-info .filter-tag { display: inline-block; background: white; border: 1px solid #B3E4E7; color: var(--main-color); border-radius: 20px; padding: 3px 12px; margin: 2px 4px 2px 0; font-size: 0.9em; }
.filter-actions { display: flex; gap: 10px; }
.reset-btn { background: var(--secondary); color: white; border: none; padding: 8px 16px; border-radius: 4px; cursor: pointer; font-size: 14px; transition: background 0.3s; }
.reset-btn:hover { background: var(--primary); }

.results-info { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 15px; }
.results-count { font-weight: 500; color: var(--main-color); }
.results-per-page { display: flex; align-items: center; gap: 10px; }
.results-per-page select { padding: 5px 10px; border: 1px solid var(--border-color); border-radius: 4px; }
.show-download-container { display: flex; flex-direction: column; align-items: flex-end; }

.btn { padding: 8px 16px; border: none; border-radius: 4px; cursor: pointer; font-size: 14px; transition: background 0.3s; }
.btn-secondary { background: var(--secondary); color: white; }
.btn-primary { background: var(--main-color); color: white; }
.btn:hover { opacity: 0.9; }

.download-options { background: var(--light-bg); padding: 15px 20px; border-radius: 8px; margin-bottom: 20px; }
.download-options-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.download-options-row label { font-weight: 500; font-size: 14px; }
.download-options-row select { padding: 6px 10px; border: 1px solid var(--border-color); border-radius: 4px; background: white; }
/* Single Download button + format menu (gdp_render_download_panel) */
.pathway-dl-wrap { position: relative; }
.pathway-dl-menu { position: absolute; top: 100%; left: 0; z-index: 50; margin-top: 4px; min-width: 140px; padding: 6px 0;
  background: var(--light-bg); border: 1px solid var(--border-color); border-radius: 8px; box-shadow: 0 10px 25px rgba(0,0,0,0.12); }
.pathway-dl-menu[hidden] { display: none; }
.pathway-dl-menu button { display: block; width: 100%; padding: 8px 16px; border: none; background: none; text-align: left;
  font-size: 14px; color: var(--text-color); cursor: pointer; }
.pathway-dl-menu button:hover { background: var(--border-color); color: var(--main-color); }

.pathway-table { width: 100%; border-collapse: collapse; background: white; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 10px rgba(15,23,42,0.08); }
.pathway-table thead { background: #B3E4E7; color: var(--primary); }
.pathway-table th { padding: 15px; text-align: left; font-weight: 700; border-bottom: 2px solid #4FC3CC; }
.pathway-table th:first-child { width: 50px; text-align: center; }
.pathway-table th.sortable { cursor: pointer; user-select: none; }
.pathway-table th.sortable:hover { background: #99E1E6; }
.pathway-table th.sortable:focus-visible { outline: 2px solid var(--main-color); outline-offset: -3px; background: #99E1E6; }
.sort-arrow { font-size: 0.8em; opacity: 0.7; }
.sort-arrow.active { opacity: 1; }
.pathway-table td { padding: 12px 15px; border-bottom: 1px solid var(--border-color); vertical-align: top; }
.pathway-table td:first-child { text-align: center; }
/* All rows plain white at rest -- zebra-striping was removed since it made
   the hover highlight inconsistent (invisible on an already-teal even row).
   Hover alone now marks focus on a single row, consistently. */
.pathway-table tbody tr:hover { background-color: var(--row-hover); }
/* Pathway ID / Pathway Name / Gene symbols are the row's identity -- plain
   dark text at rest, not colored (matches search_results.php's convention).
   Only genuine action links ("View", "View more/less") use the interactive
   teal, via .action-link. */
.pathway-table a { color: var(--primary); text-decoration: none; font-weight: 500; }
.pathway-table a:hover { color: var(--main-color); text-decoration: underline; }
.pathway-table a.action-link { color: var(--main-color); font-weight: 600; }
.pathway-table a.action-link:hover { color: var(--hover-color); }

.checkbox-container { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.position-number { font-size: 11px; color: var(--text-muted); font-weight: normal; }

.download-btn { background: var(--accent-dark); color: white; padding: 10px 20px; border: none; border-radius: 4px; cursor: pointer; font-weight: 600; margin-bottom: 20px; }
.download-btn:hover { background: #005a63; }

.pagination { display: flex; justify-content: center; align-items: center; gap: 8px; margin: 30px 0; }
.pagination .page-btn { padding: 8px 12px; border: 1px solid var(--border-color); background: white; color: var(--text-color); cursor: pointer; border-radius: 4px; text-decoration: none; font-size: 14px; min-width: 35px; text-align: center; transition: all 0.3s ease; }
.pagination .page-btn:hover:not(.active):not(.disabled) { background: var(--main-color); border-color: var(--main-color); color: white; }
.pagination .page-btn.active { background: var(--main-color); color: white; border-color: var(--main-color); }
.pagination .page-btn.disabled { opacity: 0.5; cursor: not-allowed; background: var(--light-bg); color: var(--text-muted); }
.pagination .page-btn.nav-btn { font-weight: bold; }
.pagination .ellipsis { padding: 8px 4px; color: var(--text-muted); }

.scroll-to-top { position: fixed; bottom: 30px; right: 30px; width: 50px; height: 50px; background: var(--main-color); color: white; border: none; border-radius: 50%; cursor: pointer; display: none; justify-content: center; align-items: center; font-size: 20px; box-shadow: 0 4px 12px rgba(0,137,149,0.3); transition: all 0.3s ease; z-index: 1000; }
.scroll-to-top:hover { background: var(--hover-color); transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,137,149,0.4); }
.scroll-to-top.show { display: flex; }
.scroll-to-top::before { content: "\2191"; font-weight: bold; font-size: 22px; }

#loader { border: 12px solid var(--light-bg); border-radius: 50%; border-top: 12px solid var(--main-color); width: 70px; height: 70px; animation: spin 1s linear infinite; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 9999; display: none; }
@keyframes spin { 100% { transform: translate(-50%, -50%) rotate(360deg); } }

.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 768px) {
  .page-header h1 { font-size: 2em; }
  .controls-section { padding: 14px; }
  .pathway-table th, .pathway-table td { padding: 10px 12px; font-size: 0.92em; }
}
@media (max-width: 480px) {
  .page-header h1 { font-size: 1.6em; }
  .control-group input[type="text"] { width: 100%; }
  .pathway-table th, .pathway-table td { padding: 8px 10px; font-size: 0.85em; }
  .scroll-to-top { width: 42px; height: 42px; bottom: 18px; right: 18px; }
}
