/* WP Scholar — Frontend widget styles (matches preview.html) */

.wp-scholar {
  --scholar-navy:        #1e2a3a;
  --scholar-navy-light:  #253244;
  --scholar-gold:        #BFAA7C;
  --scholar-gold-deep:   #8f7a4f;
  --scholar-gold-pale:   #fdf8ef;
  --scholar-content-bg:  #f8f8f6;
  --scholar-surface:     #ffffff;
  --scholar-ink:         #2b2b2b;
  --scholar-muted:       #6b7280;
  --scholar-border:      #e5e7eb;
  --scholar-sidebar-hover: rgba(255,255,255,0.06);
  --scholar-row-hover:   #fdf8ef;
  --scholar-radius:      3px;
  --scholar-height:      720px;

  display: flex;
  flex-direction: column;
  height: var(--scholar-height);
  font-family: 'Lato', sans-serif;
  font-size: 14px;
  color: var(--scholar-ink);
  position: relative;
  overflow: hidden;
  border-top: 3px solid var(--scholar-gold);
}

/* ── Gate messages ── */
.wp-scholar--gate {
  display: block;
  height: auto;
  min-height: unset;
  padding: 1.5rem;
  background: var(--scholar-gold-pale);
  border: 1px solid #e8e0d0;
  border-top: 3px solid var(--scholar-gold);
  border-radius: 4px;
  font-size: 0.95rem;
  color: #4a3f2f;
}

/* ── Copy protection ── */
.scholar-protected,
.scholar-protected * {
  user-select: none !important;
  -webkit-user-select: none !important;
}
.scholar-protected .scholar-search__input {
  user-select: text !important;
  -webkit-user-select: text !important;
}

/* ── Download hidden ── */
.scholar-no-download .scholar-file-row__dl { display: none; }
.scholar-no-download .scholar-filelist__header > div:last-child { display: none; }
.scholar-no-download .scholar-filelist__header,
.scholar-no-download .scholar-file-row,
.scholar-no-download .scholar-skeleton-row {
  grid-template-columns: 28px 1fr 100px 76px 100px;
}

/* ── Search bar ── */
.scholar-search {
  background: var(--scholar-navy);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.scholar-search__input {
  flex: 1;
  background: rgba(255,255,255,0.09);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: var(--scholar-radius);
  padding: 8px 14px;
  color: #fff;
  font-family: 'Lato', sans-serif;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.scholar-search__input::placeholder { color: rgba(255,255,255,0.38); }
.scholar-search__input:focus {
  border-color: var(--scholar-gold);
  background: rgba(255,255,255,0.12);
  outline: 2px solid var(--scholar-gold);
  outline-offset: -1px;
}
.scholar-search__btn {
  background: var(--scholar-gold);
  border: none;
  border-radius: var(--scholar-radius);
  width: 36px; height: 36px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
  color: #fff;
}
.scholar-search__btn:hover { background: var(--scholar-gold-deep); }
.scholar-search__btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* Academic search toolbar button */
.scholar-acad-btn {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--scholar-radius);
  width: 36px; height: 36px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: rgba(255,255,255,0.75);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.scholar-acad-btn:hover { background: rgba(255,255,255,0.18); color: #fff; border-color: rgba(255,255,255,0.3); }
.scholar-acad-btn.active { background: var(--scholar-gold); border-color: var(--scholar-gold); color: var(--scholar-navy); }
.scholar-acad-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.scholar-mobile-toggle {
  display: none;
  background: none; border: none;
  color: rgba(255,255,255,0.7);
  cursor: pointer; padding: 6px; border-radius: var(--scholar-radius);
  align-items: center; justify-content: center;
}
.scholar-mobile-toggle:hover { color: #fff; }

/* Mobile toolbar title (current folder name) — hidden on desktop */
.scholar-search__title {
  display: none;
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: rgba(255,255,255,0.88);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 4px;
}
/* Close-search button — hidden on desktop */
.scholar-search__close {
  display: none;
  background: none; border: none;
  cursor: pointer;
  color: rgba(255,255,255,0.7);
  width: 32px; height: 32px;
  border-radius: var(--scholar-radius);
  flex-shrink: 0;
  align-items: center; justify-content: center;
  transition: color 0.12s;
}
.scholar-search__close:hover { color: #fff; }

/* ── Two-column body ── */
.scholar-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Sidebar ── */
.scholar-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--scholar-navy);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}
/* Tree takes natural height; Browse by Type follows directly below last folder item */
.scholar-tree {
  flex: 0 0 auto;
}
.scholar-sidebar__heading {
  padding: 16px 20px 10px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.32);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  margin-bottom: 4px;
}
/* Close button hidden on desktop — only shown in mobile drawer */
.scholar-sidebar__close { display: none; }

/* ── Tree nodes (expandable) ── */
.scholar-tree__row {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 7px 10px 7px 6px;
  border-left: 3px solid transparent;
  transition: background 0.1s, border-color 0.1s;
}
.scholar-tree__row:hover { background: var(--scholar-sidebar-hover); }
.scholar-tree__row.active {
  border-left-color: var(--scholar-gold);
  background: rgba(191,170,124,0.11);
}
.scholar-tree__chevron {
  background: none; border: none;
  cursor: pointer;
  color: rgba(255,255,255,0.35);
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  border-radius: 3px;
  padding: 0;
  transition: color 0.12s, background 0.12s;
}
.scholar-tree__chevron:hover { color: rgba(255,255,255,0.72); background: rgba(255,255,255,0.08); }
.scholar-tree__chevron svg { display: block; transition: transform 0.18s; }
.scholar-tree__chevron.open > svg { transform: rotate(90deg); }
.scholar-tree__chevron-ph { width: 20px; height: 20px; flex-shrink: 0; display: inline-block; }
.scholar-tree__name {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  background: none; border: none;
  cursor: pointer;
  color: rgba(255,255,255,0.68);
  font-family: 'Lato', sans-serif;
  font-size: 13.5px;
  line-height: 1.35;
  text-align: left;
  padding: 2px 4px;
  min-width: 0;
  border-radius: 3px;
}
.scholar-tree__name:hover { color: rgba(255,255,255,0.92); }
.scholar-tree__row.active .scholar-tree__name { color: #fff; }
.scholar-tree__name:focus-visible { outline: 2px solid var(--scholar-gold); outline-offset: -2px; }
.scholar-tree__name span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scholar-tree__icon { flex-shrink: 0; }
.scholar-tree__icon svg { display: block; }
.scholar-tree__count {
  margin-left: auto;
  font-size: 11px;
  color: rgba(255,255,255,0.28);
  background: rgba(255,255,255,0.07);
  padding: 1px 6px;
  border-radius: 10px;
  flex-shrink: 0;
}
@keyframes scholar-spin { to { transform: rotate(360deg); } }
.scholar-spin { animation: scholar-spin 0.75s linear infinite; display: block; }

/* ── Type filter (pinned at bottom of sidebar) ── */
.scholar-filter {
  border-top: 1px solid rgba(255,255,255,0.07);
  padding: 12px 0 10px;
  flex-shrink: 0;
}
.scholar-filter__heading {
  padding: 0 20px 7px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
}
.scholar-filter__btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 18px 7px 17px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  cursor: pointer;
  color: rgba(255,255,255,0.6);
  font-family: 'Lato', sans-serif;
  font-size: 13px;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}
.scholar-filter__btn:hover { background: var(--scholar-sidebar-hover); color: rgba(255,255,255,0.88); }
.scholar-filter__btn.active { border-left-color: var(--scholar-gold); color: #fff; }
.scholar-filter__btn:focus-visible { outline: 2px solid var(--scholar-gold); outline-offset: -2px; }
.scholar-filter__dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ── Content area ── */
.scholar-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--scholar-content-bg);
  overflow: hidden;
  position: relative;
}

/* ── Breadcrumb ── */
.scholar-breadcrumb {
  background: var(--scholar-navy);
  padding: 9px 24px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.wp-scholar .scholar-breadcrumb__back,
.wp-scholar .scholar-breadcrumb__fwd {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #ffffff !important;
  border: 1px solid #cccccc;
  border-radius: var(--scholar-radius);
  color: #1a1a1a !important;
  cursor: pointer;
  font-family: 'Lato', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  padding: 5px 10px;
  min-height: 30px;
  flex-shrink: 0;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.wp-scholar .scholar-breadcrumb__back { margin-right: 6px; }
.wp-scholar .scholar-breadcrumb__fwd  { margin-right: 12px; }
.wp-scholar .scholar-breadcrumb__back:not(:disabled):hover,
.wp-scholar .scholar-breadcrumb__fwd:not(:disabled):hover {
  background: #f0f0f0 !important;
  border-color: #aaaaaa;
  color: #1a1a1a !important;
}
.wp-scholar .scholar-breadcrumb__back:disabled,
.wp-scholar .scholar-breadcrumb__fwd:disabled {
  display: none;
}
.wp-scholar .scholar-breadcrumb__back:focus-visible,
.wp-scholar .scholar-breadcrumb__fwd:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.scholar-breadcrumb__path {
  display: flex; align-items: center; flex: 1; min-width: 0;
}

.scholar-breadcrumb__btn {
  font-size: 12.5px;
  color: var(--scholar-gold);
  background: none; border: none;
  cursor: pointer;
  font-family: 'Lato', sans-serif;
  padding: 0; line-height: 1;
  transition: color 0.12s;
}
.scholar-breadcrumb__btn:hover { color: #fff; text-decoration: underline; }
.scholar-breadcrumb__btn:focus-visible { outline: 2px solid var(--scholar-gold); outline-offset: 2px; border-radius: 2px; }
.scholar-breadcrumb__btn.current { color: rgba(255,255,255,0.82); cursor: default; pointer-events: none; }
.scholar-breadcrumb__sep { color: rgba(255,255,255,0.8); margin: 0 8px; font-size: 12px; }

/* ── File list area ── */
.scholar-filelist {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #e5e7eb transparent;
}

/* ── File list header ── */
.scholar-filelist__header {
  display: grid;
  grid-template-columns: 28px 1fr 100px 76px 100px 36px;
  gap: 0 12px;
  padding: 7px 24px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--scholar-muted);
  border-bottom: 2px solid var(--scholar-border);
  background: var(--scholar-surface);
  position: sticky; top: 0; z-index: 1;
}

/* ── File rows ── */
.scholar-file-row {
  display: grid;
  grid-template-columns: 28px 1fr 100px 76px 100px 36px;
  gap: 0 12px;
  align-items: center;
  padding: 0 24px;
  min-height: 52px;
  border-bottom: 1px solid var(--scholar-border);
  background: var(--scholar-surface);
  transition: background 0.1s;
}
.scholar-file-row:hover { background: var(--scholar-row-hover); }
.scholar-file-row__icon { display: flex; align-items: center; }
.scholar-file-row__icon svg { display: block; }
.scholar-file-row__name {
  display: block;
  width: 100%;
  font-size: 14.5px;
  color: var(--scholar-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  padding-right: 8px;
  cursor: pointer;
  background: none; border: none;
  font-family: 'Lato', sans-serif;
  text-align: left;
  line-height: 1.4;
  touch-action: manipulation;
}
.scholar-file-row__name:hover { color: var(--scholar-gold-deep); text-decoration: underline; }
.scholar-file-row__name:focus-visible { outline: 2px solid var(--scholar-gold); outline-offset: 2px; border-radius: 2px; }
.scholar-file-row__meta {
  font-size: 12.5px;
  color: var(--scholar-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.scholar-file-row__dl {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  background: none; border: none;
  cursor: pointer;
  color: var(--scholar-muted);
  border-radius: var(--scholar-radius);
  transition: color 0.12s, background 0.12s;
  margin-left: auto;
}
.scholar-file-row__dl:hover { color: var(--scholar-gold-deep); background: rgba(191,170,124,0.12); }
.scholar-file-row__dl:focus-visible { outline: 2px solid var(--scholar-gold); outline-offset: 2px; }

.scholar-file-row__body { min-width: 0; overflow: hidden; }

/* ── Badges ── */
.scholar-badge {
  display: inline-flex; align-items: center;
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 3px;
  white-space: nowrap;
}
.badge-pdf      { background: #fff5f5; color: #c53030; }
.badge-word     { background: #ebf8ff; color: #2c5282; }
.badge-ppt      { background: #fffaf0; color: #c05621; }
.badge-video    { background: #faf5ff; color: #553c9a; }
.badge-audio    { background: #f0fff4; color: #276749; }
.badge-sheet    { background: #f0fff4; color: #276749; }
.badge-image    { background: #f0fdf4; color: #166534; }
.badge-folder   { background: #fdf8ef; color: #8f7a4f; }
.badge-other    { background: #f7fafc; color: #4a5568; }

/* ── Folder tiles (root view) ── */
.scholar-folder-grid {
  padding: 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
  align-content: start;
}
.scholar-folder-tile {
  background: var(--scholar-surface);
  border: 1px solid var(--scholar-border);
  border-radius: 5px;
  padding: 18px 16px;
  cursor: pointer;
  display: flex; flex-direction: column;
  align-items: flex-start; gap: 9px;
  text-align: left;
  border-left: 3px solid transparent;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
  font-family: 'Lato', sans-serif;
  background: none; border-color: var(--scholar-border);
}
.scholar-folder-tile:hover {
  border-left-color: var(--scholar-gold);
  box-shadow: 0 2px 10px rgba(191,170,124,0.14);
  transform: translateY(-1px);
  background: var(--scholar-surface);
}
.scholar-folder-tile:focus-visible { outline: 2px solid var(--scholar-gold); outline-offset: 2px; }
.scholar-folder-tile__icon svg { display: block; }
.scholar-folder-tile__name { font-size: 14px; font-weight: 700; color: var(--scholar-ink); line-height: 1.3; }
.scholar-folder-tile__count { font-size: 12px; color: var(--scholar-muted); }

/* ── Preview panel ── */
.scholar-preview {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 62%;
  background: var(--scholar-surface);
  border-left: 3px solid var(--scholar-gold);
  display: flex; flex-direction: column;
  transform: translateX(102%);
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 50;
  box-shadow: -6px 0 24px rgba(0,0,0,0.09);
}
.scholar-preview.open { transform: translateX(0); }
.scholar-preview__head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--scholar-border);
  display: flex; align-items: flex-start; gap: 12px;
  flex-shrink: 0;
}
.scholar-preview__info { flex: 1; min-width: 0; }
.scholar-preview__filename {
  font-size: 14.5px; font-weight: 700;
  color: var(--scholar-ink); line-height: 1.3;
  margin-bottom: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.scholar-preview__actions {
  display: flex; align-items: center; gap: 2px; flex-shrink: 0;
}
.scholar-preview__action,
.scholar-preview__close {
  background: none; border: none; cursor: pointer;
  color: var(--scholar-muted); padding: 6px;
  border-radius: var(--scholar-radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: color 0.12s, background 0.12s;
}
.scholar-preview__action:hover,
.scholar-preview__close:hover { color: var(--scholar-ink); background: #f3f4f6; }
.scholar-preview__action:focus-visible,
.scholar-preview__close:focus-visible { outline: 2px solid var(--scholar-gold); outline-offset: 2px; }
.scholar-preview__action:disabled { opacity: 0.3; cursor: default; pointer-events: none; }

/* Fullscreen state */
.scholar-preview:fullscreen {
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  border-left: none;
  border-top: 3px solid var(--scholar-gold);
  box-shadow: none;
  transform: none;
}
.scholar-preview:-webkit-full-screen {
  width: 100vw; height: 100vh;
  border-radius: 0; border-left: none;
  border-top: 3px solid var(--scholar-gold);
  box-shadow: none; transform: none;
}
.scholar-preview:fullscreen .scholar-preview__body,
.scholar-preview:-webkit-full-screen .scholar-preview__body {
  flex: 1;
}
.scholar-preview__body {
  flex: 1; overflow: auto;
  background: #f5f5f3;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.scholar-preview__overlay {
  display: none;
  position: absolute; inset: 0;
  z-index: 5;
  background: transparent;
  cursor: default;
}
.scholar-protected .scholar-preview__overlay { display: block; }
.scholar-preview__placeholder {
  text-align: center; padding: 48px 32px;
  color: var(--scholar-muted);
}
.scholar-preview__placeholder svg { margin: 0 auto 14px; opacity: 0.3; display: block; }
.scholar-preview__placeholder p { font-size: 14px; }
.scholar-preview__placeholder small { font-size: 12px; margin-top: 6px; display: block; }
.scholar-preview__foot {
  padding: 12px 18px;
  border-top: 1px solid var(--scholar-border);
  display: flex; gap: 10px; align-items: center;
  flex-shrink: 0;
}
.scholar-preview__iframe {
  width: 100%; height: 100%;
  border: none;
}
.scholar-preview__video {
  width: 100%; height: 100%;
  display: block; background: #000;
  object-fit: contain;
}
.scholar-preview__audio-wrap {
  width: 100%; padding: 32px 24px;
  display: flex; align-items: center; justify-content: center;
}
.scholar-preview__audio {
  width: 100%; max-width: 520px;
}
.scholar-preview__img {
  max-width: 100%; max-height: 100%;
  object-fit: contain; display: block;
  margin: auto;
}

/* ── PDF.js viewer ── */
.scholar-preview__pdfjs {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}
.scholar-preview__pdfjs-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: #2d2d2d;
  border-bottom: 1px solid #444;
  flex-shrink: 0;
}
.scholar-pdfjs-prev,
.scholar-pdfjs-next,
.scholar-pdfjs-zout,
.scholar-pdfjs-zin {
  background: none;
  border: 1px solid #555;
  color: #ddd;
  width: 28px; height: 28px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.12s, border-color 0.12s;
}
.scholar-pdfjs-prev:hover,
.scholar-pdfjs-next:hover,
.scholar-pdfjs-zout:hover,
.scholar-pdfjs-zin:hover  { background: #444; border-color: #777; }
.scholar-pdfjs-prev:disabled,
.scholar-pdfjs-next:disabled { opacity: 0.35; cursor: default; }
.scholar-pdfjs-prev:disabled:hover,
.scholar-pdfjs-next:disabled:hover { background: none; border-color: #555; }
.scholar-pdfjs-page {
  color: #bbb;
  font-size: 12px;
  min-width: 64px;
  text-align: center;
  flex-shrink: 0;
}
.scholar-pdfjs-zout { margin-left: 8px; }
.scholar-preview__pdfjs-pages {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px;
  background: #525659;
  gap: 12px;
}
.scholar-pdfjs-canvas {
  display: block;
  box-shadow: 0 2px 12px rgba(0,0,0,0.5);
  max-width: 100%;
}
.scholar-pdfjs-loading {
  color: #ccc;
  font-size: 13px;
  margin: 0;
  font-family: 'Lato', sans-serif;
}

/* ── Buttons ── */
.scholar-btn-gold {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--scholar-gold);
  color: #fff;
  font-family: 'Lato', sans-serif;
  font-size: 13px; font-weight: 700;
  padding: 8px 16px; border-radius: var(--scholar-radius);
  border: none; cursor: pointer; text-decoration: none;
  transition: background 0.15s;
}
.scholar-btn-gold:hover { background: var(--scholar-gold-deep); }
.scholar-btn-ghost {
  display: inline-flex; align-items: center; gap: 7px;
  background: none;
  color: var(--scholar-muted);
  font-family: 'Lato', sans-serif;
  font-size: 13px; font-weight: 700;
  padding: 8px 14px; border-radius: var(--scholar-radius);
  border: 1px solid var(--scholar-border); cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
}
.scholar-btn-ghost:hover { color: var(--scholar-ink); border-color: #9ca3af; }

/* ── Skeleton loading ── */
@keyframes scholar-shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}
.scholar-skeleton-row {
  display: grid;
  grid-template-columns: 28px 1fr 100px 76px 100px 36px;
  gap: 0 12px;
  align-items: center;
  padding: 0 24px; height: 52px;
  border-bottom: 1px solid var(--scholar-border);
  background: var(--scholar-surface);
}
.scholar-skel {
  border-radius: 3px;
  background: linear-gradient(90deg, #ede9e1 25%, #f6f4f0 50%, #ede9e1 75%);
  background-size: 600px 100%;
  animation: scholar-shimmer 1.5s infinite linear;
}
.scholar-skel-sq { width: 20px; height: 20px; }
.scholar-skel-lg { height: 12px; width: 72%; }
.scholar-skel-sm { height: 11px; width: 60%; }
.scholar-skel-xs { height: 11px; width: 80%; }

/* ── State messages (empty, error) ── */
.scholar-state {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 60px 40px; text-align: center;
  color: var(--scholar-muted); background: var(--scholar-content-bg);
}
.scholar-state svg { margin-bottom: 16px; opacity: 0.3; display: block; }
.scholar-state p { font-size: 15px; }
.scholar-state small { font-size: 13px; margin-top: 6px; display: block; }
.scholar-state--error { color: #c53030; }

/* ── Search results label ── */
.scholar-results-label {
  padding: 14px 24px 6px;
  font-size: 11.5px; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--scholar-muted);
}

/* ── Initial loading (before JS builds layout) ── */
.wp-scholar__loading {
  display: flex; align-items: center; justify-content: center;
  gap: 0.6rem; flex: 1;
  font-size: 0.93rem; color: rgba(255,255,255,0.5);
  background: var(--scholar-navy);
}
.scholar-spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.15);
  border-top-color: var(--scholar-gold);
  border-radius: 50%;
  animation: scholar-spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes scholar-spin { to { transform: rotate(360deg); } }

/* ── Version stamp ── */
.scholar-version {
  position: absolute;
  bottom: 6px;
  right: 10px;
  font-size: 10px;
  color: rgba(0,0,0,0.45);
  background: rgba(255,255,255,0.72);
  padding: 1px 6px;
  border-radius: 3px;
  pointer-events: none;
  z-index: 1;
  font-family: 'Lato', sans-serif;
  letter-spacing: 0.04em;
}

/* ── Recency badges ── */

/* ── Filter toggle button ── */
.scholar-filter-toggle {
  background: none;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: var(--scholar-radius);
  width: 36px; height: 36px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: rgba(255,255,255,0.65);
  position: relative;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.scholar-filter-toggle:hover { color: #fff; border-color: rgba(255,255,255,0.5); }
.scholar-filter-toggle.active { background: var(--scholar-gold); border-color: var(--scholar-gold); color: #fff; }
.scholar-filter-toggle:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.scholar-filter-toggle__count {
  position: absolute; top: -5px; right: -5px;
  background: var(--scholar-gold); color: #fff;
  font-size: 9px; font-weight: 700;
  min-width: 15px; height: 15px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
  font-family: 'Lato', sans-serif;
}

/* ── Refresh button ── */
.scholar-refresh-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: var(--scholar-radius);
  width: 36px; height: 36px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: rgba(255,255,255,0.65);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.scholar-refresh-btn:hover { color: #fff; border-color: rgba(255,255,255,0.5); }
.scholar-refresh-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.scholar-refresh-btn--spinning svg { animation: scholar-spin 0.7s linear infinite; }
@keyframes scholar-spin { to { transform: rotate(360deg); } }

/* ── SVG icons in toolbar buttons ── */
.scholar-search__btn svg,
.scholar-filter-toggle svg,
.scholar-refresh-btn svg,
.scholar-mobile-toggle svg,
.scholar-help-btn svg,
.scholar-breadcrumb__back svg,
.scholar-breadcrumb__fwd svg {
  display: block;
  flex-shrink: 0;
}

/* ── Filter panel ── */
.scholar-filter-panel {
  background: var(--scholar-surface);
  border-bottom: 2px solid var(--scholar-gold);
  flex-shrink: 0;
  z-index: 5;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.scholar-fp-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  padding: 4px 0;
}
.scholar-fp-section {
  padding: 12px 20px;
  border-right: 1px solid var(--scholar-border);
  min-width: 160px;
  flex: 1;
}
.scholar-fp-section:last-child { border-right: none; }
.scholar-fp-label {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--scholar-muted);
  margin-bottom: 8px;
}
.scholar-fp-radio,
.scholar-fp-check {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; color: var(--scholar-ink);
  cursor: pointer; padding: 3px 0;
  font-family: 'Lato', sans-serif;
}
.scholar-fp-radio input,
.scholar-fp-check input { cursor: pointer; accent-color: var(--scholar-gold); }
.scholar-fp-checks { display: flex; flex-direction: column; }
.scholar-fp-sort {
  width: 100%; padding: 6px 8px;
  border: 1px solid var(--scholar-border);
  border-radius: var(--scholar-radius);
  font-family: 'Lato', sans-serif; font-size: 13px;
  color: var(--scholar-ink); background: var(--scholar-surface);
  cursor: pointer;
}
.scholar-fp-sort:focus { outline: 2px solid var(--scholar-gold); outline-offset: -1px; }
.scholar-fp-keyword {
  width: 100%; padding: 6px 10px;
  border: 1px solid var(--scholar-border);
  border-radius: var(--scholar-radius);
  font-family: 'Lato', sans-serif; font-size: 13px;
  color: var(--scholar-ink); background: var(--scholar-surface);
  box-sizing: border-box;
}
.scholar-fp-keyword:focus { outline: 2px solid var(--scholar-gold); outline-offset: -1px; border-color: var(--scholar-gold); }
.scholar-fp-footer {
  width: 100%; padding: 8px 20px 10px;
  border-top: 1px solid var(--scholar-border);
  display: flex; align-items: center; gap: 8px;
}
.scholar-fp-reset {
  background: none; border: 1px solid var(--scholar-border);
  border-radius: var(--scholar-radius);
  padding: 5px 12px; cursor: pointer;
  font-family: 'Lato', sans-serif; font-size: 12px;
  color: var(--scholar-muted);
  transition: color 0.12s, border-color 0.12s;
}
.scholar-fp-reset:hover { color: var(--scholar-ink); border-color: #9ca3af; }

/* ── Active filter pills ── */
.scholar-pills-row {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px 20px;
  background: var(--scholar-gold-pale);
  border-bottom: 1px solid #e8e0d0;
  flex-shrink: 0;
}
.scholar-pill {
  display: inline-flex; align-items: center; gap: 5px;
  background: #fff; border: 1px solid #d4c9a8;
  border-radius: 12px; padding: 3px 10px 3px 12px;
  font-size: 12px; font-weight: 600;
  color: #6b5c3a; cursor: pointer;
  font-family: 'Lato', sans-serif;
  transition: background 0.1s, border-color 0.1s;
}
.scholar-pill:hover { background: #fdf3e0; border-color: var(--scholar-gold); color: var(--scholar-gold-deep); }
.scholar-pill span { font-size: 14px; line-height: 1; opacity: 0.6; }

/* ── PDF viewer redesign — thumbnail strip + footer controls ── */
.scholar-preview__pdfjs {
  display: flex;
  flex-direction: row;
  width: 100%;
  height: 100%;
}
.scholar-preview__pdfjs-strip {
  width: 72px;
  flex-shrink: 0;
  background: #3a3a3a;
  overflow-y: auto;
  display: flex; flex-direction: column;
  gap: 6px; padding: 8px 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.scholar-pdfjs-thumb {
  border-radius: 3px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.12s;
  background: #555;
  min-height: 40px;
}
.scholar-pdfjs-thumb:hover { border-color: rgba(191,170,124,0.5); }
.scholar-pdfjs-thumb--active { border-color: var(--scholar-gold); }
.scholar-preview__pdfjs-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.scholar-preview__pdfjs-pages {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px;
  background: #525659;
  gap: 12px;
}
.scholar-preview__pdfjs-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #2d2d2d;
  border-top: 1px solid #444;
  flex-shrink: 0;
}
.scholar-pdfjs-prev,
.scholar-pdfjs-next,
.scholar-pdfjs-zout,
.scholar-pdfjs-zin {
  background: none;
  border: 1px solid #555;
  color: #ddd;
  width: 28px; height: 28px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 16px; line-height: 1; padding: 0;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.12s, border-color 0.12s;
}
.scholar-pdfjs-prev:hover,
.scholar-pdfjs-next:hover,
.scholar-pdfjs-zout:hover,
.scholar-pdfjs-zin:hover  { background: #444; border-color: #777; }
.scholar-pdfjs-prev:disabled,
.scholar-pdfjs-next:disabled { opacity: 0.35; cursor: default; }
.scholar-pdfjs-prev:disabled:hover,
.scholar-pdfjs-next:disabled:hover { background: none; border-color: #555; }
.scholar-pdfjs-page {
  color: #bbb; font-size: 12px;
  min-width: 60px; text-align: center; flex-shrink: 0;
}
.scholar-pdfjs-zout { margin-left: 6px; }
.scholar-pdfjs-canvas {
  display: block;
  box-shadow: 0 2px 12px rgba(0,0,0,0.5);
  max-width: 100%;
}
.scholar-pdfjs-loading {
  color: #ccc; font-size: 13px; margin: 0;
  font-family: 'Lato', sans-serif;
}

/* ── Academic search panel ── */
.scholar-acad {
  padding: 28px 28px 32px;
  max-width: 820px;
}
.scholar-acad__intro {
  font-size: 13px;
  color: var(--scholar-muted);
  margin: 0 0 18px;
  line-height: 1.55;
}
.scholar-acad__search {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}
.scholar-acad__input {
  flex: 1;
  border: 1px solid var(--scholar-border);
  border-radius: var(--scholar-radius);
  padding: 9px 14px;
  font-family: 'Lato', sans-serif;
  font-size: 14px;
  color: var(--scholar-ink);
  background: var(--scholar-surface);
  outline: none;
  transition: border-color 0.15s;
}
.scholar-acad__input:focus {
  border-color: var(--scholar-gold);
  outline: 2px solid var(--scholar-gold);
  outline-offset: -1px;
}
.scholar-acad__input::placeholder { color: var(--scholar-muted); }
.scholar-acad__go {
  background: var(--scholar-navy);
  border: none;
  border-radius: var(--scholar-radius);
  padding: 9px 20px;
  color: var(--scholar-gold);
  font-family: 'Lato', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.03em;
  transition: background 0.15s;
  flex-shrink: 0;
}
.scholar-acad__go:hover { background: var(--scholar-navy-light); }
.scholar-acad__go:disabled { opacity: 0.5; cursor: default; }
.scholar-acad__go:focus-visible { outline: 2px solid var(--scholar-gold); outline-offset: 2px; }
.scholar-acad__loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 28px 0;
  font-size: 13px;
  color: var(--scholar-muted);
}
.scholar-acad__count {
  font-size: 11.5px;
  color: var(--scholar-muted);
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}
.scholar-acad__result {
  display: block;
  position: relative;
  padding: 16px 90px 14px 18px;
  background: var(--scholar-surface);
  border: 1px solid var(--scholar-border);
  border-radius: var(--scholar-radius);
  margin-bottom: 8px;
  text-decoration: none;
  color: var(--scholar-ink);
  transition: border-color 0.12s, box-shadow 0.12s, background 0.12s;
}
.scholar-acad__result:hover {
  border-color: var(--scholar-gold);
  box-shadow: 0 2px 10px rgba(191,170,124,0.14);
  background: #fffdf9;
}
.scholar-acad__result-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: rgba(191,170,124,0.65);
  white-space: nowrap;
}
.scholar-acad__result:hover .scholar-acad__result-badge { color: var(--scholar-gold-deep); }
.scholar-acad__result-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--scholar-navy);
  line-height: 1.45;
  margin-bottom: 5px;
}
.scholar-acad__result:hover .scholar-acad__result-title { color: var(--scholar-gold-deep); }
.scholar-acad__result-authors {
  font-size: 12px;
  color: var(--scholar-muted);
  font-style: italic;
  margin-bottom: 6px;
  line-height: 1.4;
}
.scholar-acad__result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.scholar-acad__result-meta span {
  font-size: 11px;
  color: var(--scholar-muted);
  background: var(--scholar-content-bg);
  border: 1px solid var(--scholar-border);
  border-radius: 10px;
  padding: 1px 8px;
}

/* ── Auto-expand widget when preview open ── */
.wp-scholar.scholar--preview-open {
  height: 85vh;
  min-height: var(--scholar-height);
}

/* ── Mobile ── */
@media (max-width: 768px) {
  .scholar-mobile-toggle { display: flex !important; }

  /* Search bar: compact default — show title, hide input */
  .scholar-refresh-btn { display: none !important; }
  .scholar-search__title { display: block; }
  .scholar-search__input { display: none; }

  /* Search active — title collapses, input expands */
  .scholar-search--active .scholar-search__title { display: none; }
  .scholar-search--active .scholar-search__input { display: block; flex: 1; }
  .scholar-search--active .scholar-search__close { display: flex; }
  .scholar-search--active .scholar-mobile-toggle { display: none !important; }
  .scholar-search--active .scholar-search__btn { display: none !important; }

  /* Drawer overlay */
  .scholar-drawer-overlay {
    display: none;
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 19;
  }
  .scholar-drawer-overlay.active { display: block; cursor: pointer; }

  /* Sidebar becomes full-height drawer */
  .scholar-sidebar {
    position: absolute; top: 0; left: 0; bottom: 0;
    z-index: 20; transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: 4px 0 20px rgba(0,0,0,0.2);
    width: 280px;
    display: flex; flex-direction: column;
  }
  .scholar-sidebar.open { transform: translateX(0); }

  /* Sidebar header (heading + close button) */
  .scholar-sidebar__header {
    display: flex; align-items: center;
    padding: 0 16px;
    min-height: 52px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
  }
  .scholar-sidebar__heading { flex: 1; padding: 0; border-bottom: none; margin-bottom: 0; font-size: 13px; color: rgba(255,255,255,0.7); }
  .scholar-sidebar__close { display: flex; }
  .scholar-sidebar__close {
    background: none; border: none; cursor: pointer;
    color: rgba(255,255,255,0.7);
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 4px;
    flex-shrink: 0;
    transition: color 0.12s, background 0.12s;
  }
  .scholar-sidebar__close:hover { color: #fff; background: rgba(255,255,255,0.1); }

  /* Root folder: rows not tiles */
  .scholar-folder-grid {
    display: flex; flex-direction: column; gap: 0; padding: 0;
  }
  .scholar-folder-tile {
    flex-direction: row; align-items: center; gap: 12px;
    padding: 14px 20px;
    border-left: none; border-bottom: 1px solid var(--scholar-border);
    border-radius: 0; transform: none !important;
  }
  .scholar-folder-tile:hover { border-left: none; }
  .scholar-folder-tile__name { flex: 1; font-size: 14px; }
  .scholar-folder-tile::after { content: '›'; color: var(--scholar-muted); font-size: 18px; margin-left: auto; }

  /* File list — block layout, absolute icon (works on all iOS/Android browsers) */
  .scholar-filelist__header { display: none; }
  .scholar-file-row {
    display: block;
    position: relative;
    padding: 10px 16px 8px 66px;
    min-height: 52px;
    box-sizing: border-box;
  }
  .scholar-file-row__icon {
    position: absolute;
    left: 16px;
    top: 10px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .scholar-file-row__body {
    display: block;
    min-width: 0;
  }
  .scholar-file-row__name {
    display: block;
    width: 100%;
    font-size: 14px;
    line-height: 1.4;
    white-space: normal;
    word-break: break-word;
    overflow: visible;
    text-overflow: clip;
    padding: 0;
    text-align: left;
  }
  .scholar-file-row__type {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
    padding-bottom: 6px;
  }
  .scholar-file-row__meta { display: none !important; }
  .scholar-file-row__actions { display: none !important; }
  .scholar-file-row__show-folder { display: none !important; }

  /* Preview full-screen overlay */
  .scholar-preview {
    position: fixed; inset: 0; width: 100%; z-index: 100;
    border-left: none; border-top: 3px solid var(--scholar-gold);
  }

  /* Filter panel stacks vertically */
  .scholar-fp-inner { flex-direction: column; }
  .scholar-fp-section { border-right: none; border-bottom: 1px solid var(--scholar-border); min-width: unset; }
  .scholar-fp-section:last-child { border-bottom: none; }

  /* PDF strip narrower on mobile */
  .scholar-preview__pdfjs-strip { width: 54px; padding: 6px 4px; }

  /* Auto-expand uses more height on mobile */
  .wp-scholar.scholar--preview-open { height: 92vh; }
}

/* ── File row thumbnails ── */
.scholar-file-row__thumb {
  width: 28px;
  height: 28px;
  object-fit: cover;
  border-radius: 3px;
  display: block;
  background: var(--scholar-border);
}

/* ── Filter panel — Apply button ── */
.scholar-fp-apply {
  margin-left: auto;
  background: var(--scholar-gold);
  border: none;
  border-radius: var(--scholar-radius);
  padding: 6px 14px;
  cursor: pointer;
  font-family: 'Lato', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: var(--scholar-navy);
  transition: background 0.12s;
}
.scholar-fp-apply:hover { background: var(--scholar-gold-deep); color: #fff; }
.scholar-fp-apply:focus-visible { outline: 2px solid var(--scholar-gold); outline-offset: 2px; }

.scholar-file-row__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
.scholar-file-row__show-folder {
  background: none;
  border: 1px solid var(--scholar-border);
  border-radius: 4px;
  color: var(--scholar-muted);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 7px;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.4;
}
.scholar-file-row__show-folder:hover {
  background: var(--scholar-content-bg);
  border-color: var(--scholar-navy);
  color: var(--scholar-navy);
}
.scholar-file-row__show-folder:focus-visible {
  outline: 2px solid var(--scholar-gold);
  outline-offset: 2px;
}

/* ══════════════════════════════════════════════════════════════════════════
   RESEARCH DATABASES — source tabs, research panel, citation cards
   Completely separate from the library/file-browser system above.
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Source tabs (Library | Research Databases) ── */
.scholar-source-tabs {
  display: flex;
  background: var(--scholar-navy);
  padding: 10px 16px 0;
  gap: 4px;
  flex-shrink: 0;
}
.scholar-source-tab {
  flex: 1;
  padding: 10px 18px 11px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  color: rgba(255,255,255,0.45);
  font-family: 'Lato', sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.scholar-source-tab:hover {
  background: rgba(255,255,255,0.13);
  color: rgba(255,255,255,0.85);
}
.scholar-source-tab--active {
  background: var(--scholar-content-bg);
  color: var(--scholar-navy);
  border-color: rgba(255,255,255,0.15);
  font-weight: 700;
}
.scholar-source-tab:focus-visible { outline: 2px solid var(--scholar-gold); outline-offset: -2px; }

/* ── Research mode — hide library-specific chrome ── */
.scholar--research-mode .scholar-sidebar        { display: none; }
.scholar--research-mode .scholar-filter-panel   { display: none !important; }
.scholar--research-mode .scholar-pills-row      { display: none !important; }
/* Hide toolbar buttons that don't apply to research */
.scholar--research-mode .scholar-filter-toggle  { display: none; }
.scholar--research-mode .scholar-refresh-btn    { display: none; }
.scholar--research-mode .scholar-mobile-toggle  { display: none; }

/* ── Research panel container ── */
.scholar-research {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 32px;
  scrollbar-width: thin;
  scrollbar-color: #e5e7eb transparent;
  background: var(--scholar-content-bg);
}

/* ── Search row ── */
.scholar-research__search-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.scholar-research__input {
  flex: 1;
  border: 1px solid var(--scholar-border);
  border-radius: var(--scholar-radius);
  padding: 9px 14px;
  font-family: 'Lato', sans-serif;
  font-size: 14px;
  color: var(--scholar-ink);
  background: var(--scholar-surface);
  outline: none;
  transition: border-color 0.15s;
  min-width: 0;
}
.scholar-research__input:focus {
  border-color: var(--scholar-gold);
  outline: 2px solid var(--scholar-gold);
  outline-offset: -1px;
}
.scholar-research__input::placeholder { color: var(--scholar-muted); }
.scholar-research__go {
  background: var(--scholar-navy);
  border: none;
  border-radius: var(--scholar-radius);
  padding: 9px 20px;
  color: var(--scholar-gold);
  font-family: 'Lato', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
  flex-shrink: 0;
}
.scholar-research__go:hover { background: var(--scholar-navy-light); }
.scholar-research__go:disabled { opacity: 0.5; cursor: default; }
.scholar-research__go:focus-visible { outline: 2px solid var(--scholar-gold); outline-offset: 2px; }

/* ── Filter bar (source pills + OA toggle) ── */
.scholar-research__filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
}

/* ── Source filter pills ── */
.scholar-res-src {
  background: none;
  border: 1px solid var(--scholar-border);
  border-radius: 12px;
  padding: 4px 12px;
  font-family: 'Lato', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--scholar-muted);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.scholar-res-src:hover { border-color: var(--scholar-navy); color: var(--scholar-ink); }
.scholar-res-src.active {
  background: var(--scholar-navy);
  border-color: var(--scholar-navy);
  color: var(--scholar-gold);
}
.scholar-res-src:focus-visible { outline: 2px solid var(--scholar-gold); outline-offset: 2px; }

/* ── OA-only checkbox ── */
.scholar-res-oa-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  font-family: 'Lato', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--scholar-muted);
  cursor: pointer;
  padding: 4px 0;
  white-space: nowrap;
}
.scholar-res-oa-label:hover { color: var(--scholar-ink); }
.scholar-res-oa-chk { cursor: pointer; accent-color: var(--scholar-gold); }

/* ── Welcome state with search chips ── */
.scholar-res-welcome {
  padding: 28px 4px 16px;
  text-align: center;
}
.scholar-res-welcome__text {
  font-size: 14px;
  color: var(--scholar-muted);
  margin: 0 0 18px;
  line-height: 1.5;
}
.scholar-res-welcome__hint {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #a0a0a0;
  margin: 0 0 12px;
}
.scholar-res-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 20px;
}
.scholar-res-chip {
  background: var(--scholar-surface);
  border: 1px solid var(--scholar-border);
  border-radius: 20px;
  padding: 6px 16px;
  font-family: 'Lato', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--scholar-ink);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.scholar-res-chip:hover {
  background: var(--scholar-gold-pale);
  border-color: var(--scholar-gold);
  color: var(--scholar-gold-deep);
}
.scholar-res-chip:focus-visible { outline: 2px solid var(--scholar-gold); outline-offset: 2px; }
.scholar-res-welcome__oa {
  font-size: 12px;
  color: #a0a0a0;
  margin: 0;
  line-height: 1.5;
}
.scholar-res-welcome__oa strong { color: var(--scholar-muted); }

/* ── Results count label ── */
.scholar-res-count {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--scholar-muted);
  margin-bottom: 12px;
}

/* ── Citation cards ── */
.scholar-cit-card {
  background: var(--scholar-surface);
  border: 1px solid var(--scholar-border);
  border-radius: 4px;
  padding: 14px 16px 12px;
  margin-bottom: 10px;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.scholar-cit-card:hover {
  border-color: rgba(191,170,124,0.55);
  box-shadow: 0 2px 10px rgba(191,170,124,0.1);
}
.scholar-cit-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
  flex-wrap: wrap;
}
.scholar-cit-card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  flex-shrink: 0;
}
.scholar-cit-card__topright {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-left: auto;
}
.scholar-cit-card__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--scholar-navy);
  line-height: 1.45;
  margin-bottom: 5px;
}
.scholar-cit-card__authors {
  font-size: 12px;
  color: var(--scholar-muted);
  font-style: italic;
  margin-bottom: 4px;
  line-height: 1.4;
}
.scholar-cit-card__journal {
  font-size: 12px;
  color: var(--scholar-muted);
  margin-bottom: 8px;
  line-height: 1.4;
}
.scholar-cit-card__footer {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

/* ── Quick summary (tldr from Semantic Scholar) ── */
.scholar-cit-tldr {
  font-size: 12.5px;
  color: var(--scholar-ink);
  line-height: 1.55;
  margin: 4px 0 6px;
  padding: 7px 10px;
  background: #f0f9ff;
  border-left: 3px solid #90cdf4;
  border-radius: 3px;
}
.scholar-cit-tldr strong {
  font-weight: 700;
  color: var(--scholar-muted);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-right: 4px;
}

/* ── Abstract toggle ── */
.scholar-cit-abst-btn {
  background: none;
  border: none;
  padding: 0;
  font-family: 'Lato', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--scholar-muted);
  cursor: pointer;
  transition: color 0.12s;
  text-align: left;
}
.scholar-cit-abst-btn:hover { color: var(--scholar-ink); }
.scholar-cit-abst {
  font-size: 12.5px;
  color: var(--scholar-ink);
  line-height: 1.65;
  padding: 10px 12px;
  background: var(--scholar-gold-pale);
  border-radius: 3px;
  border-left: 3px solid var(--scholar-gold);
  margin-top: 2px;
}

/* ── Action row ── */
.scholar-cit-action-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── Cite button + dropdown ── */
.scholar-cit-cite-wrap {
  position: relative;
}
.scholar-cit-cite-btn {
  background: none;
  border: 1px solid var(--scholar-border);
  border-radius: var(--scholar-radius);
  padding: 5px 12px;
  font-family: 'Lato', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--scholar-ink);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.scholar-cit-cite-btn:hover { border-color: var(--scholar-navy); background: var(--scholar-content-bg); }
.scholar-cit-cite-btn:focus-visible { outline: 2px solid var(--scholar-gold); outline-offset: 2px; }
.scholar-cit-cite-menu {
  position: absolute;
  left: 0; top: calc(100% + 4px);
  background: var(--scholar-surface);
  border: 1px solid var(--scholar-border);
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  z-index: 20;
  min-width: 170px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.scholar-cit-cite-menu[hidden] { display: none !important; }
.scholar-cit-cite-menu button {
  background: none;
  border: none;
  border-bottom: 1px solid var(--scholar-border);
  padding: 9px 14px;
  font-family: 'Lato', sans-serif;
  font-size: 12px;
  color: var(--scholar-ink);
  cursor: pointer;
  text-align: left;
  transition: background 0.1s;
  white-space: nowrap;
}
.scholar-cit-cite-menu button:last-child { border-bottom: none; }
.scholar-cit-cite-menu button:hover { background: var(--scholar-gold-pale); }

/* ── View paper link ── */
.scholar-cit-view-link {
  font-family: 'Lato', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--scholar-gold-deep);
  text-decoration: none;
  transition: color 0.12s;
}
.scholar-cit-view-link:hover { color: var(--scholar-navy); text-decoration: underline; }

/* ── Open PDF button ── */
.scholar-cit-pdf-btn {
  background: var(--scholar-navy);
  border: none;
  border-radius: var(--scholar-radius);
  padding: 5px 12px;
  font-family: 'Lato', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--scholar-gold);
  cursor: pointer;
  transition: background 0.12s;
}
.scholar-cit-pdf-btn:hover { background: var(--scholar-navy-light); }
.scholar-cit-pdf-btn:focus-visible { outline: 2px solid var(--scholar-gold); outline-offset: 2px; }

/* ── Year / citation count / OA inline spans ── */
.scholar-cit-year {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--scholar-muted);
}
.scholar-cit-cites {
  font-size: 11.5px;
  color: var(--scholar-muted);
}
.scholar-cit-oa {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: #f0fff4;
  color: #276749;
  border: 1px solid #c6f6d5;
  border-radius: 10px;
  padding: 1px 7px;
  white-space: nowrap;
}
.scholar-cit-paywalled {
  margin: 6px 0 0;
  font-size: 11px;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 4px;
  padding: 3px 8px;
  display: inline-block;
}

/* ── Source badges (on citation cards) ── */
.scholar-src-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 2px 7px;
  border-radius: 3px;
  white-space: nowrap;
}
.scholar-src-badge--pubmed          { background: #fff5f5; color: #c53030; border: 1px solid #fed7d7; }
.scholar-src-badge--semantic_scholar { background: #e6fffa; color: #2c7a7b; border: 1px solid #b2f5ea; }
.scholar-src-badge--openalex        { background: #ebf8ff; color: #2c5282; border: 1px solid #bee3f8; }

/* ── Mobile — research panel ── */
@media (max-width: 768px) {
  .scholar-source-tab { font-size: 12px; padding: 9px 10px; }

  .scholar-research { padding: 14px 16px 24px; }

  .scholar-research__search-row { flex-wrap: wrap; }
  .scholar-research__input { min-width: 0; }
  .scholar-research__go { width: 100%; justify-content: center; }

  .scholar-res-oa-label { margin-left: 0; }

  .scholar-cit-card { padding: 12px 12px 10px; }
  .scholar-cit-card__top { gap: 6px; }
  .scholar-cit-card__topright { margin-left: 0; width: 100%; justify-content: flex-start; }

  .scholar-cit-cite-menu { min-width: 150px; }
}

/* ==========================================================================
   Help panel
   ========================================================================== */

/* Help button in toolbar */
.scholar-help-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  background: transparent;
  color: rgba(255,255,255,0.75);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.scholar-help-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }
.scholar--help-mode .scholar-help-btn { background: var(--scholar-gold); color: var(--scholar-navy); border-color: var(--scholar-gold); }
.scholar--help-mode .scholar-help-btn svg { filter: brightness(0); }

/* In help mode: hide sidebar, filter toggle, refresh, mobile toggle */
.scholar--help-mode .scholar-sidebar      { display: none !important; }
.scholar--help-mode .scholar-filter-toggle,
.scholar--help-mode .scholar-refresh-btn,
.scholar--help-mode .scholar-mobile-toggle { display: none !important; }
.scholar--help-mode .scholar-search__input { pointer-events: none; opacity: 0.4; }
.scholar--help-mode .scholar-search__btn   { display: none !important; }

/* Help panel wrapper */
.scholar-help-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
}

/* Sticky back bar */
.scholar-help-back-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--scholar-content-bg, #f8f8f6);
  border-bottom: 1px solid var(--scholar-border, #e5e7eb);
  padding: 10px 20px;
}
.scholar-help-back-btn {
  background: none;
  border: none;
  color: var(--scholar-gold-deep, #8f7a4f);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s;
}
.scholar-help-back-btn:hover { color: var(--scholar-navy, #1e2a3a); }

/* Scrollable content area */
.scholar-help-content {
  padding: 24px 28px 40px;
  max-width: 720px;
}

.scholar-help-h1 {
  font-size: 20px;
  font-weight: 800;
  color: var(--scholar-navy, #1e2a3a);
  margin: 0 0 20px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--scholar-gold, #BFAA7C);
}

/* Table of contents */
.scholar-help-toc {
  background: #f9f7f4;
  border: 1px solid rgba(191,170,124,0.3);
  border-left: 3px solid var(--scholar-gold, #BFAA7C);
  border-radius: 0 8px 8px 0;
  padding: 14px 18px;
  margin-bottom: 28px;
}
.scholar-help-toc__title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--scholar-gold-deep, #8f7a4f);
  margin-bottom: 8px;
}
.scholar-help-toc ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.scholar-help-toc__link {
  font-size: 13px;
  color: var(--scholar-navy, #1e2a3a);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s;
}
.scholar-help-toc__link:hover { color: var(--scholar-gold-deep, #8f7a4f); text-decoration: underline; }

/* Sections */
.scholar-help-section {
  margin-bottom: 32px;
  scroll-margin-top: 52px;
}
.scholar-help-h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--scholar-navy, #1e2a3a);
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(191,170,124,0.25);
}
.scholar-help-h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--scholar-gold-deep, #8f7a4f);
  margin: 18px 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.scholar-help-section p {
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--scholar-ink, #2b2b2b);
  margin: 0 0 10px;
}
.scholar-help-section p:last-child { margin-bottom: 0; }
.scholar-help-ul {
  margin: 0 0 10px 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.scholar-help-ul li {
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--scholar-ink, #2b2b2b);
}
.scholar-help-section kbd {
  display: inline-block;
  padding: 1px 5px;
  font-size: 11px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  font-family: monospace;
}

/* Inline example badges in help text */
.scholar-help-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 3px;
  vertical-align: middle;
}
.scholar-help-badge--oa     { background: #f0fff4; color: #276749; border: 1px solid #c6f6d5; }
.scholar-help-badge--locked { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* Mobile */
@media (max-width: 600px) {
  .scholar-help-content { padding: 16px 16px 32px; }
  .scholar-help-h1 { font-size: 17px; }
  .scholar-help-h2 { font-size: 14px; }
}
