/* Gaggle Scholar - Google Scholar style */

:root {
  --bg: #fff;
  --text: #222;
  --text-muted: #545454;
  --link: #1a0dab;
  --link-visited: #681da8;
  --border: #dadce0;
  --primary: #1a73e8;
  --primary-hover: #1765cc;
  --font-sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-link, .results-logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.logo-img {
  height: 36px;
  width: auto;
  display: block;
}

.logo-img.small {
  height: 32px;
}

/* Results page: logo above search */
.results-search-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1rem;
}

.results-search-header .results-logo {
  margin-bottom: 0.75rem;
}

.results-logo-img {
  height: 200px;
  width: auto;
  display: block;
}

.results-search-header .search-form.inline-form {
  width: 100%;
  max-width: 584px;
  margin: 0;
}

.nav a {
  margin-left: 1.25rem;
  color: var(--link);
  text-decoration: none;
}

.nav a:hover {
  text-decoration: underline;
}

/* Main */
.main {
  flex: 1;
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
  width: 100%;
}
.main:has(.home-layout) { max-width: 1100px; }

/* Home */
.home-layout {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  width: 100%;
}
@media (max-width: 900px) {
  .home-layout { flex-wrap: wrap; }
  .hot-shit-sidebar { width: 100%; height: 500px; }
}
.home-layout .home {
  flex: 1;
  min-width: 0;
}
.home {
  text-align: center;
  padding: 4rem 1rem 2rem;
}

.home-logo-img {
  height: 200px;
  width: auto;
  margin-bottom: 1.5rem;
}

.search-form {
  margin-bottom: 1rem;
}

.search-input {
  width: 100%;
  max-width: 584px;
  margin: 0 auto 1rem;
  display: block;
  padding: 12px 16px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 24px;
  outline: none;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.search-form.inline-form {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  width: 100%;
}

.search-form.inline-form .search-input.inline-input {
  flex: 1;
  min-width: 200px;
  margin: 0;
}

.btn {
  padding: 10px 20px;
  font-size: 14px;
  border-radius: 4px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  font-family: inherit;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: #f8f9fa;
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: #e8eaed;
}

.search-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-inline {
  padding: 8px 16px;
}

.home-hint {
  color: var(--text-muted);
  font-size: 13px;
}

/* Results */
.results-page .results-stats {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 1rem;
}

.results-list {
  list-style: decimal;
  padding-left: 2.5em;
  margin: 0;
}

.result-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.result-download {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0;
  transition: background-color 0.2s;
}

.result-download-img {
  width: 24px;
  height: 24px;
  display: block;
  object-fit: contain;
}

.result-download:hover {
  background-color: #f0f0f0;
}

.result-content {
  flex: 1;
  min-width: 0;
}

.result-source {
  flex-shrink: 0;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-muted);
  background: var(--border);
}

.result-source-webofnothing {
  background: #e3f2fd;
  color: #1565c0;
}

.result-source-openjunk {
  background: #fff3e0;
  color: #e65100;
}

.result-source-other {
  background: #f5f5f5;
  color: var(--text-muted);
}

.result-item::before {
  display: none;
}

.result-title {
  font-size: 18px;
  font-weight: normal;
  margin: 0 0 0.25rem;
  line-height: 1.3;
}

.result-title a {
  color: var(--link);
  text-decoration: none;
}

.result-title a:hover {
  text-decoration: underline;
}

.result-title a:visited {
  color: var(--link-visited);
}

.result-meta {
  margin: 0 0 0.25rem;
  color: var(--text-muted);
  font-size: 13px;
}

.cited-by {
  color: var(--text-muted);
}

.result-snippet {
  margin: 0.25rem 0 0.5rem;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}

.result-actions {
  margin: 0.5rem 0 0;
  font-size: 13px;
}

.result-actions a {
  color: var(--link);
  text-decoration: none;
  margin-right: 1rem;
}

.result-actions a:hover {
  text-decoration: underline;
}

.btn-add-library, .btn-remove {
  background: none;
  border: none;
  color: var(--link);
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  margin-right: 0.5rem;
}

.btn-add-library:hover, .btn-remove:hover {
  text-decoration: underline;
}

.btn-add-library:disabled {
  color: var(--text-muted);
  cursor: default;
}

.pagination {
  margin-top: 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.pagination a {
  color: var(--link);
  text-decoration: none;
}

.pagination a:hover {
  text-decoration: underline;
}

.pagination-pages {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pagination-page {
  min-width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  border-radius: 4px;
}

.pagination-page:not(.pagination-current) {
  color: var(--link);
  text-decoration: none;
}

.pagination-page:not(.pagination-current):hover {
  background: #f0f0f0;
  text-decoration: none;
}

.pagination-current {
  background: var(--primary);
  color: #fff;
  font-weight: 500;
}

.page-info {
  color: var(--text-muted);
  font-size: 13px;
}

.no-query, .empty-library {
  color: var(--text-muted);
}

/* Auth */
.auth-page {
  max-width: 360px;
  margin: 0 auto;
  padding: 2rem 0;
}
.auth-page h1 {
  font-size: 24px;
  margin-bottom: 1rem;
}
.auth-error {
  color: #c5221f;
  margin-bottom: 1rem;
}
.auth-form label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 13px;
  color: var(--text-muted);
}
.auth-hint { display: block; font-size: 12px; color: var(--text-muted); margin-top: 0.25rem; }
.auth-form input[type="text"],
.auth-form input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 1rem;
}
.auth-form p { margin: 0 0 0.5rem; }
.auth-form button { margin-top: 0.5rem; }
.auth-switch {
  margin-top: 1.5rem;
  color: var(--text-muted);
  font-size: 13px;
}
.auth-switch a { color: var(--link); }
.auth-success-msg { margin-bottom: 1rem; }
.auth-credentials {
  background: var(--bg-subtle, #f5f5f5);
  padding: 1rem 1.25rem;
  border-radius: 6px;
  margin-bottom: 1rem;
}
.auth-credentials p { margin: 0.5rem 0; }
.username-display {
  font-family: monospace;
  font-size: 15px;
  padding: 2px 8px;
  background: #fff;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* Profile */
.profile-form { margin: 1.5rem 0; }
.profile-form label { display: block; margin-bottom: 0.25rem; font-size: 13px; color: var(--text-muted); }
.profile-form input[type="text"] { width: 100%; max-width: 400px; padding: 10px 12px; font-size: 14px; border: 1px solid var(--border); border-radius: 4px; }
.profile-form button { margin-top: 0.5rem; }
.profile-links { margin-top: 1.5rem; }

.collection-count, .click-count { color: var(--text-muted); }

/* Leaderboard */
.leaderboard {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8f9fa;
}
.leaderboard-sidebar {
  flex-shrink: 0;
  width: 200px;
  margin: 0;
}
.hot-shit-sidebar {
  flex-shrink: 0;
  width: 360px;
  margin: 0 0 0 3rem;
}
.leaderboards-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: min(70vh, 600px);
  min-height: 280px;
}
.leaderboard-box {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8f9fa;
}
.leaderboard-box h2 { font-size: 16px; margin: 0 0 0.25rem; }
.leaderboard-box .leaderboard-hint { font-size: 12px; color: var(--text-muted); margin: 0 0 0.5rem; flex-shrink: 0; }
.leaderboard-list-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.leaderboard-list a {
  color: var(--link);
  text-decoration: none;
}
.leaderboard-list a:hover { text-decoration: underline; }
.leaderboard-list-titles li { display: flex; align-items: flex-start; gap: 0.5rem; }
.leaderboard-list-titles li a {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.leaderboard h2 { font-size: 16px; margin: 0 0 0.25rem; }
.leaderboard-hint { font-size: 12px; color: var(--text-muted); margin: 0 0 0.75rem; }
.leaderboard-list { margin: 0; padding-left: 2em; }
.leaderboard-list li { margin: 0.25rem 0; }
.leaderboard-list .rank { display: inline-block; width: 1.5em; font-weight: 600; }
.leaderboard-empty { margin: 0; color: var(--text-muted); font-size: 13px; }
.shit-index-display { margin-bottom: 1rem; color: var(--text-muted); font-size: 14px; }

/* Admin */
.admin-page { padding: 1rem 0; }
.admin-back { margin-bottom: 1rem; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { padding: 0.5rem 0.75rem; border: 1px solid var(--border); text-align: left; }
.admin-table th { background: #f5f5f5; font-weight: 600; }
.admin-table tr:nth-child(even) { background: #fafafa; }
.btn-admin-action { padding: 4px 10px; font-size: 12px; margin-right: 0.5rem; border: 1px solid var(--border); border-radius: 4px; background: #fff; cursor: pointer; }
.btn-admin-action:hover { background: #f0f0f0; }
.btn-admin-action.btn-danger { border-color: #c5221f; color: #c5221f; }
.btn-admin-action.btn-danger:hover { background: #ffebee; }

/* Article */
.article-page {
  padding: 0.5rem 0;
}

.article-title {
  font-size: 22px;
  font-weight: normal;
  line-height: 1.4;
  margin: 0 0 0.5rem;
}

.article-meta {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 1.5rem;
}

.article-abstract h2, .article-biblio h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 1rem 0 0.5rem;
}

.article-abstract p, .article-biblio p {
  margin: 0;
  line-height: 1.6;
}

.article-actions {
  margin-top: 1.5rem;
}

.article-actions .btn {
  margin-right: 0.75rem;
}

.not-found {
  color: var(--text-muted);
}

/* Library */
.library-page h1 {
  font-size: 20px;
  font-weight: normal;
  margin: 0 0 1rem;
}

/* Footer */
.footer {
  padding: 1rem;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.footer a {
  color: var(--link);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

.footer-links {
  margin-top: 0.5rem;
}

.footer-links-label {
  color: var(--text-muted);
}

.sep {
  margin: 0 0.5rem;
}
