  * { box-sizing: border-box; }

  /* Websie theme */
:root {
  --accent-color: #ffb74d;
  --bg-color: #1c1c1c;
  --button-color: #ca2015;
}

/* Slate Blue */
/* :root {
  --accent-color: #7db8ff;
  --bg-color: #242b38;
  --button-color: #356ac3;
} */

/* TEAL   */
/* :root {
  --accent-color: #52e0d5;
  --bg-color: #243233;
  --button-color: #0f8b8d;
} */

/* ORANGE */
/* :root {
  --accent-color: #ffb347;
  --bg-color: #2d2a26;
  --button-color: #d97706;
} */

/* CRIMSON */
/* :root {
  --accent-color: #ff6b81;
  --bg-color: #2d262b;
  --button-color: #c62855;
} */

/* EMERALD */
/* :root {
  --accent-color: #38d39f;
  --bg-color: #252c2f;
  --button-color: #17896b;
} */

  body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background: rgb(211, 234, 243);
    color: #e7f0f8;
    height: 100vh;
    overflow: hidden;
  }

  /* === HEADER BAR === */
  header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 55px; /* increased height */
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid var(--bg-color);
    z-index: 20;
  }

  header img.logo {
    height: 26px;
    padding-left: 50px;
  }

/* Custom text selection color inside PDF.js text layer */
.textLayer ::selection {
  background: var(--accent-color); /* warm brownish highlight */
}

/* For Firefox */
.textLayer ::-moz-selection {
  background: var(--accent-color);
}

/* === PAGE INFO (Centered in header) === */
.page-info-container {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.page-info {
  font-size: 15px;
  color: #99a;
  user-select: none;
}

/* Divider line */
.page-divider {
  width: 1px;
  height: 22px;
  background: var(--bg-color);
  margin: 0 8px;
}

/* === ROTATE BUTTON === */
#rotateBtn {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  transition: transform 0.3s ease, background 0.2s ease;
}

#rotateBtn svg {
  width: 20px;
  height: 20px;
  stroke: #99a;             
  fill: #99a;
}

#printBtn i {
  width: 20px;
  height: 20px;
  color: #99a;
  margin-top: 4px;
}

#rotateBtn:hover {
  background: rgba(255,255,255,0.08);
}

#rotateBtn:hover svg {
  transform: rotate(180deg);
  stroke: #c7c7d1;           /* lighter on hover */
}

#rotateBtn:active svg {
  transform: rotate(360deg);
  stroke: #fff;              /* flash white when clicked */
}

  .toolbar-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #99a;
  }

  /* Divider between toolbar buttons */
.toolbar-divider {
  width: 1px;
  height: 22px;
  background: var(--bg-color);
  margin: 4px;
}

  .toolbar-buttons button {
    background: transparent;
    border: none;
    color: #ffffff;
    cursor: pointer;
    font-size: 16px;
    padding: 6px 0px;
    transition: background 0.2s ease, color 0.2s ease;
    border-radius: 6px;
    display: flex;
    align-items: center;
  }

  .toolbar-buttons button:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
  }

  /* Round blue download button */
  #downloadBtn {
    background: var(--button-color);
    color: #fff !important;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
  }

  .toolbar-buttons .zoom-icons {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke: #99a;
    fill: #99a;
  }

  .toolbar-buttons .fit-screen {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke: #99a;
    fill: #99a;
  }

  .toolbar-buttons .search {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke: #99a;
    fill: none;
  }

  .toolbar-buttons .fit-width {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke: #99a;
    fill: #99a;
  }

  .toolbar-buttons .fit-height {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke: #99a;
    fill: #99a;
    stroke-width: 0.25;
  }

  .toolbar-buttons svg {
    width: 20px;
    height: 20px;
    stroke: #fff;
  }

  /* === SEARCH BAR === */
#searchContainer {
  position: fixed;
  top: 65px;
  right: 12px;
  background: #2a2a33;
  padding: 6px 8px;
  border-radius: 6px;
  display: none;
  z-index: 120; /* stays above sidebar */
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  align-items: center;
  gap: 6px;
}

#searchContainer .search-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

#searchContainer button {
  background: #444;
  border: none;
  color: #fff;
  padding: 5px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}

#searchContainer button:hover {
  background: #666;
}

#searchContainer input {
  background: #3a3a44;
  border: none;
  color: #fff;
  padding: 6px 8px;
  border-radius: 4px;
  width: 180px;
  outline: none;
  font-size: 13px;
}
.text-highlight {
  background: rgba(255, 230, 0, 0.4);
  position: absolute;
  z-index: 10;
  border-radius: 2px;
  pointer-events: none;
}

  /* === PDF VIEWER === */
  #viewerContainer {
    position: absolute;
    top: 55px; /* matches header height */
    bottom: 0;
    left: 0;
    right: 0;
    overflow: auto;
    background: #e7eaf2;
  }

  .pdfViewer .page {
    margin: 20px auto; /* more page spacing */
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #ddd;
    border-radius: 4px;
  }

/* === FLOATING TOOL STRIP (Science.org-style) === */
#floatingTools {
  position: fixed;
  top: 50%;
  right: 15px;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: #fff;
  border-radius: 40px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  z-index: 50;
}

#floatingTools button {
  background: transparent;
  border: none;
  color: #333;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

#floatingTools button:hover {
  background: rgba(0,0,0,0.08);
  transform: scale(1.1);
}

/* Highlight info button when sidebar is open */
#floatingTools #infoToggleLeft {
  background: var(--button-color);
  color: #fff;
  transform: scale(0.9);
}

#floatingTools.sidebar-open #infoToggleLeft {
  background: #eaeaea;
  color: #333;
  transform: scale(0.9);
}

#floatingTools button {
  transition: background 0.25s ease, transform 0.25s ease;
}

#floatingTools button.active {
  background: var(--button-color);
  color: #fff;
  transform: scale(0.9);
}

#floatingTools i {
  font-size: 16px;
}

/* === Sidebar: inline Details & Close button === */
.sidebar-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 10px;
}

/* === Sidebar === */
#sidebar {
  position: fixed;
  right: -320px;
  top: 0;
  width: 320px;
  height: 100%;
  background: #141418;
  overflow-y: auto;
  border-left: 1px solid #333;
  padding: 16px;
  box-sizing: border-box;
  transition: right 0.35s ease;
  z-index: 1000;
}
#sidebar.open { right: 0; }
#sidebar h2 {
  font-size: 14px;
  margin-top: 0;
  margin-bottom: 10px;
  color: #ccc;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* === SLIDE-OUT SIDEBAR (Science.org look) === */
#sidebarDetails {
  position: fixed;
  top: 55px; /* below header */
  right: -440px;
  width: 440px;
  height: calc(100% - 55px);
  background: var(--bg-color);
  color: #fff;
  box-shadow: -4px 0 20px rgba(0,0,0,0.25);
  transition: right 0.35s ease;
  z-index: 60;
  overflow-y: auto;
}

#sidebarDetails.open { right: 0; }

#sidebarDetails h2 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 600;
  color: #fff;
}
#closeSidebar {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}
#closeSidebar:hover { color: #fff; }

#sidebarContent {
  padding: 20px 26px 50px;
  font-size: 14px;
  line-height: 1.6;
}

/* === Sidebar sections === */
.issue {
    display: flex;
    flex-direction: row;
}

.issue-details {
    display: flex;
    flex-direction: column;
    padding-left: 30px;
}

.article-cover img {
  width: 120px;
  margin-bottom: 14px;
}

.journal-title:hover { text-decoration: underline; }

.journal-meta a {
  display: block;
  color: #fff;
  font-size: 0.85rem;
  text-decoration: underline;
  font-weight: 600;
}

.journal-date {
  font-size: 13px;
  color: #fff;
  margin-bottom: 18px;
}

.section-label {
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 700;
  color: #99a;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.article-title {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  margin: 0 0 8px;
}
.article-link {
  color: var(--accent-color);
  text-decoration: none;
  font-size: 13px;
}
.article-link:hover { text-decoration: underline; }

.authors {
  margin-top: 14px;
  font-size: 13px;
  color: #99a;
}
.more-authors {
  color: var(--accent-color);
  cursor: pointer;
}
.more-authors:hover { text-decoration: underline; }

.copyright {
  font-size: 12px;
  color: #99a;
  margin-top: 14px;
  line-height: 1.5;
}

.doi {
  display: block;
  color: var(--accent-color);
  text-decoration: none;
  font-size: 13px;
  margin-top: 6px;
}
.doi:hover { text-decoration: underline; }

.publisher {
  margin-top: 22px;
}
.publisher h4 {
  font-size: 13px;
  text-transform: uppercase;
  color: #fff;
  margin: 0 0 4px;
}
.publisher p {
  font-size: 13px;
  color: #fff;
  margin: 0;
}

.show-affiliations {
    color: var(--accent-color);
    margin-right: 8px;
    cursor: pointer;
}

.show-affiliations:hover {
  text-decoration: underline;
}

.affiliations {
    font-size: 0.92em;
    color: #7d7d7d;
    line-height: 1.6;
}

.affiliations sup {
  font-size: 0.6rem;
}

/* --- Shift viewer + floating tools when sidebar is open --- */
#viewerContainer {
  transition: margin-right 0.35s ease;
}

#viewerContainer.sidebar-open {
  margin-right: 440px; /* same as sidebar width */
}

#floatingTools.sidebar-open {
  right: 460px; /* sidebar width + 24px spacing */
}

/* Scrollbar */
#sidebarDetails::-webkit-scrollbar {
  width: 8px;
}

#sidebarDetails::-webkit-scrollbar-track {
  background: transparent;
  margin-top: 8px;
  border-radius: 10px;
}

#sidebarDetails::-webkit-scrollbar-thumb {
  background: #99a;
  border-radius: 6px;
}

#sidebarDetails::-webkit-scrollbar-thumb:hover {
  background: #7b7c91;
}

  /* === CUSTOM SCROLLBAR === */
#viewerContainer::-webkit-scrollbar {
  width: 12px;
}

#viewerContainer::-webkit-scrollbar-track {
  background: transparent;
  margin-top: 2px;
  border-radius: 10px;
}

#viewerContainer::-webkit-scrollbar-thumb {
  background: #99a;
  border-radius: 6px;
  border: 3px solid #e7eaf2;
}

#viewerContainer::-webkit-scrollbar-thumb:hover {
  background: #7b7c91;
}

/* === Reference numbers in PDF text layer === */
.textLayer span.ref-number {
  color: var(--accent-color) !important;      /* warm brown tone */
  text-decoration: underline !important;
  text-decoration-color: var(--accent-color) !important;
  text-underline-offset: 2px;
  font-weight: 600;
  cursor: pointer;
}

.article-explorer {
    padding: 0 16px 20px;
}

.article-explorer-tabs {
    display: flex;
    gap: 6px;
    margin: 4px 0 18px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.article-explorer-tab {
    border: 0;
    background: transparent;
    color: #aaa;
    padding: 7px 9px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.article-explorer-tab:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

.article-explorer-tab.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

.cited-by-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    margin-left: 3px;
    padding: 0 5px;
    border-radius: 10px;
    font-size: 10px;
    background: rgba(255, 255, 255, 0.14);
}

.article-explorer-item {
    display: block;
    padding: 12px 2px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
    color: inherit;
    text-decoration: none;
}

.article-explorer-item:hover .article-explorer-title {
    text-decoration: underline;
}

.article-explorer-title {
    color: #eee;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.45;
}

.article-explorer-meta {
    margin-top: 6px;
    color: #999;
    font-size: 11px;
    line-height: 1.4;
}

.citation-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.09);
    color: #ccc;
}

.article-explorer-empty {
    padding: 25px 4px;
    color: #999;
    font-size: 13px;
    text-align: center;
}