/* arXiv-inspired CSS theme */

:root {
  --arxiv-blue: rgb(0, 0, 238); /* arXiv-like default link blue */
  --arxiv-link-hover: #005e9d;
  --bg: #ffffff;
  --bg-light: #f9f9f9;
  --fg: #333333;
  --fg-muted: #555555;
  --border: #dddddd;
  --border-light: #eeeeee;

  /* Typography */
  --font-serif: 'Times New Roman', Georgia, 'Noto Serif', serif;
  --font-sans: 'Lucida Grande', helvetica, arial, verdana, sans-serif;
  --font-mono: 'Courier New', Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

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

main {
  flex: 1;
}

.container {
  max-width: none;
  width: 100%;
  padding: 0 2rem;
  margin: 0 auto;
}

@media (min-width: 1200px) {
  .container {
    max-width: 1200px;
  }
}

@media (min-width: 1600px) {
  .container {
    max-width: 1400px;
  }
}

/* Header (arXiv-style: red band with white text) */
.site-header {
  background: #b31b1b;
  border-bottom: 2px solid #8b1515;
  padding: 12px 0;
  color: #fff;
}

.site-header .container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}


.site-header .brand {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 18px;
}

.site-header .brand:hover { color: #f0f0f0; text-decoration: none; }

/* Header search */
.header-search {
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 400px;
  margin: 0 2rem;
}

.header-search input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px 0 0 4px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 16px;
  outline: none;
}

.header-search input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.header-search input:focus {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
}

.header-search button {
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-left: none;
  border-radius: 0 4px 4px 0;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  transition: background-color 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.header-search button:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Ensure header search input and button are equal height */
.header-search input,
.header-search button {
  height: 40px;
}

/* Donate button */
.donate-btn {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  text-decoration: none;
  padding: 8px 16px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.donate-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  color: #fff;
  text-decoration: none;
}

/* Header breadcrumbs */
.header-breadcrumbs {
  padding: 0.5rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
}

.header-breadcrumbs a {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
}

.header-breadcrumbs a:hover {
  color: #fff;
  text-decoration: underline;
}

.header-breadcrumbs .sep {
  margin: 0 0.5rem;
  color: rgba(255, 255, 255, 0.6);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-light);
  padding: 32px 0;
  margin-top: 48px;
  font-size: 14px;
  color: var(--fg-muted);
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
}

.footer-section h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  margin: 0 0 12px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-links a {
  font-size: 13px;
  color: var(--arxiv-blue);
  text-decoration: none;
  padding: 2px 0;
}

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

.footer-description {
  margin: 0;
  line-height: 1.5;
  font-size: 13px;
}

.footer-meta {
  font-size: 12px;
  color: var(--fg-muted);
  margin: 0;
  line-height: 1.4;
}

.site-footer a {
  color: var(--arxiv-blue);
  text-decoration: none;
}

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

/* Page Layout */
.page-header {
  margin-top: 2rem;
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-light);
}

.page-description {
  color: var(--fg-muted);
  font-size: 16px;
  line-height: 1.6;
  margin: 16px 0 0 0;
  max-width: 600px;
}

/* Typography */
h1 {
  color: var(--fg);
  font-size: 32px;
  font-weight: 700;
  margin: 0 0 16px 0;
  line-height: 1.2;
  font-family: var(--font-sans); /* arXiv uses sans across UI/headings */
}

h2 {
  color: var(--fg);
  font-size: 20px;
  font-weight: 700;
  margin: 24px 0 12px;
  font-family: var(--font-sans);
}

h3 {
  color: var(--fg);
  font-size: 18px;
  font-weight: 600;
  margin: 16px 0 8px;
  font-family: var(--font-sans);
}

h3 a {
  color: var(--arxiv-blue);
  text-decoration: none;
}

h3 a:hover {
  text-decoration: underline;
}

/* Links */
a { color: var(--arxiv-blue); }
a:hover { color: var(--arxiv-link-hover); }

/* Paper list (index page) */
.item-list {
  list-style: none;
  padding: 0;
  margin: 2rem 0;
}

/* Slightly larger title link on index list */
.list-title-link {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.35;
}

.paper-item {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border-light);
  transition: background-color 0.2s ease;
}

.paper-item:hover {
  background-color: rgba(0, 85, 170, 0.02);
  margin: 0 -1rem;
  padding: 1.5rem 1rem;
  border-radius: 6px;
}

.paper-item:last-child {
  border-bottom: none;
}

.paper-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.paper-header h3 {
  margin: 0;
  flex: 1;
}

.paper-id {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-muted);
  margin-left: 16px;
  white-space: nowrap;
}

.paper-meta {
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--fg-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}

.authors {
  font-weight: 500;
  color: var(--fg);
}

.subjects {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.date {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-muted);
}

.paper-abstract {
  margin-bottom: 16px;
  line-height: 1.7;
  color: var(--fg);
  font-size: 15px;
  padding-left: 4px;
  border-left: 3px solid var(--border-light);
  padding-left: 16px;
}

/* Metadata */
.meta {
  color: var(--fg-muted);
  font-size: 14px;
  margin: 8px 0;
}

/* Descriptor labels (Title:, Authors:, etc.) */
.descriptor { font-weight: 700; color: var(--fg); }

/* Paper detail page */
.paper {
  margin: 2rem 0;
  padding: 0 1rem;
}

/* Two-column layout for paper pages */
.paper-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
  margin-top: 2rem;
}

.paper-main {
  min-width: 0; /* Prevent grid overflow */
}

.paper-sidebar {
  background: var(--bg-light);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 1.5rem;
  height: fit-content;
  position: sticky;
  top: 2rem;
}

@media (max-width: 768px) {
  .paper-layout {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .paper-sidebar {
    position: static;
    order: -1;
  }
}

.paper h1 {
  font-size: 26px;
  margin-bottom: 8px;
}

.subheader {
  text-align: left;
}

/* Subheader classification line */
.subheader h1 {
  font-size: 14px;
  color: var(--fg-muted);
  font-weight: 600;
  margin: 0 0 8px 0;
  text-transform: none;
}

.paper .meta {
  margin: 12px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

/* Actions/Buttons */
.actions {
  margin: 16px 0 24px;
}

.btn {
  display: inline-block;
  margin-right: 8px;
  margin-bottom: 8px;
  padding: 8px 16px;
  background: var(--arxiv-blue);
  color: white;
  text-decoration: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn:hover {
  background: var(--arxiv-link-hover);
  color: white;
  text-decoration: none;
}

/* Sidebar action buttons */
.sidebar-section {
  margin-bottom: 2rem;
}

.sidebar-section:last-child {
  margin-bottom: 0;
}

.sidebar-section h3 {
  margin: 0 0 1rem 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--fg);
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 0.5rem;
}

.sidebar-actions {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-actions li {
  margin-bottom: 0.5rem;
}

.sidebar-actions li:last-child {
  margin-bottom: 0;
}

.sidebar-btn {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg);
  color: var(--arxiv-blue);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  transition: all 0.2s ease;
}

.sidebar-btn:hover {
  background: var(--arxiv-blue);
  color: white;
  text-decoration: none;
  border-color: var(--arxiv-blue);
}

.sidebar-btn.primary {
  background: var(--arxiv-blue);
  color: white;
  border-color: var(--arxiv-blue);
}

.sidebar-btn.primary:hover {
  background: var(--arxiv-link-hover);
  border-color: var(--arxiv-link-hover);
}

/* Subject badges */
.subject-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  background: #e3f2fd;
  color: #1565c0;
  border: 1px solid #bbdefb;
  transition: all 0.2s ease;
}

.subject-badge:hover {
  background: #bbdefb;
  transform: translateY(-1px);
}

.subject-badge:nth-child(2n) {
  background: #f3e5f5;
  color: #7b1fa2;
  border: 1px solid #e1bee7;
}

.subject-badge:nth-child(2n):hover {
  background: #e1bee7;
}

.subject-badge:nth-child(3n) {
  background: #fff3e0;
  color: #ef6c00;
  border: 1px solid #ffcc02;
}

.subject-badge:nth-child(3n):hover {
  background: #ffcc02;
}

/* Badge */
.badge {
  margin-left: 8px;
  background: #f0f0f0;
  color: #666;
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 12px;
  border: 1px solid var(--border);
  font-weight: normal;
}

/* Banner/Notice */
.banner {
  background: #fff3cd;
  border: 1px solid #ffc107;
  padding: 10px 12px;
  border-radius: 4px;
  margin: 12px 0 20px;
  color: #856404;
  font-size: 14px;
}

/* Abstract */
/* Abstract (arXiv-like) */
.abstract { 
  line-height: 1.55; 
  font-size: 1.05em; 
  margin: 0 0 1.5em 0; 
  border: none; 
  background: transparent; 
  padding: 0; 
}

/* arXiv-style abstract blockquote */
.abstract-blockquote {
  background: var(--bg-light);
  border-left: 4px solid var(--arxiv-blue);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  border-radius: 0 6px 6px 0;
  font-style: italic;
  line-height: 1.6;
}

.abstract-blockquote .descriptor {
  font-weight: 700;
  color: var(--fg);
  font-style: normal;
  margin-right: 0.5rem;
}

/* Metadata table (dl) */
.meta-table dl {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 8px 16px;
  align-items: start;
  margin: 8px 0 0;
}

.meta-table dt {
  font-weight: 600;
  color: var(--fg);
  text-align: right;
}

.meta-table dd {
  margin: 0;
  color: var(--fg);
}

@media (max-width: 640px) {
  .meta-table dl {
    grid-template-columns: 1fr;
  }
  .meta-table dt { text-align: left; }
}

/* Source link */
.source {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
  font-size: 14px;
}

/* Header breadcrumbs (arXiv-like) */
.header-breadcrumbs { color: #fff; margin-top: 8px; font-size: 14px; }
.header-breadcrumbs a { color: #fff; text-decoration: none; }
.header-breadcrumbs a:hover { color: #f0f0f0; text-decoration: underline; }
.header-breadcrumbs .sep { opacity: 0.8; margin: 0 6px; }

/* Listing (arXiv-like dl) */
#articles { margin: 24px 0; padding: 0; }
#articles dt { margin-top: .6em; }
#articles dd { margin: 0 0 1.2em 0; }
.list-title, .list-authors, .list-subjects { line-height: 150%; }
.list-title { margin: .3em 0; }
.list-authors { margin: .3em 0; }
.list-subjects { margin: .3em 0; }
.primary-subject { font-weight: 600; }

/* Dateline and descriptors */
.dateline { margin: .5em 0; font-style: italic; font-size: small; color: var(--fg); }
.descriptor { margin-right: 6px; }

/* Tighter dt styling */
#articles dt a[name] { margin-right: 6px; }

/* Search */
.search-block {
  margin: 32px 0;
  padding: 24px;
  background: var(--bg-light);
  border: 1px solid var(--border-light);
  border-radius: 8px;
}

.search-input-group {
  display: flex;
  margin-bottom: 20px;
  gap: 12px;
}

#search-input {
  flex: 1;
  padding: 12px 16px;
  border-radius: 6px;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  font-size: 16px;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

#search-input:focus {
  outline: none;
  border-color: var(--arxiv-blue);
  box-shadow: 0 0 0 3px rgba(0, 85, 170, 0.1);
}

.search-btn {
  padding: 12px 24px;
  background: var(--arxiv-blue);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: background-color 0.2s ease;
  min-width: 100px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

.search-filters {
  display: flex;
  gap: 24px;
  margin-bottom: 0;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.search-filters select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--fg);
  font-size: 14px;
  font-family: inherit;
  min-width: 140px;
}

#search-results {
  margin-top: 12px;
}

/* Ensure homepage search input/button heights match header search */
#search-input,
.search-btn {
  height: 40px;
}

#search-results .res {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

#search-results .res:last-child {
  border-bottom: none;
}

#search-results a {
  color: var(--arxiv-blue);
  text-decoration: none;
}

#search-results a:hover {
  text-decoration: underline;
}

/* Code blocks */
code,
pre {
  background: var(--bg-light);
  color: var(--fg);
  border-radius: 3px;
  border: 1px solid var(--border);
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 14px;
}

pre {
  padding: 12px;
  overflow-x: auto;
}

/* Donation Page */
.donation-content {
  max-width: 1000px;
  margin: 0 auto;
}

/* Breadcrumb */
.breadcrumb { font-size: 13px; color: var(--fg-muted); margin: 8px 0 16px; }
.breadcrumb a { color: var(--arxiv-blue); text-decoration: none; }
.breadcrumb a:hover { color: var(--arxiv-link-hover); text-decoration: underline; }

/* Paper list numbering */
.paper-number { font-family: var(--font-mono); color: var(--fg-muted); margin-right: 8px; }

.donation-info {
  background: var(--bg-light);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 32px;
}

.donation-info h2 {
  margin-top: 0;
  color: var(--arxiv-blue);
}

.donation-info ul {
  list-style: none;
  padding: 0;
}

.donation-info li {
  padding: 8px 0;
  font-size: 16px;
}

.crypto-donations {
  margin-bottom: 32px;
}

.crypto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  margin-top: 24px;
}

.crypto-item {
  background: var(--bg-light);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 20px;
  transition: all 0.2s ease;
}

.crypto-item:hover {
  border-color: var(--arxiv-blue);
  box-shadow: 0 2px 8px rgba(0, 85, 170, 0.1);
}

.crypto-header {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
}

.crypto-icon {
  width: 32px;
  height: 32px;
  margin-right: 12px;
  border-radius: 4px;
}

.crypto-header h3 {
  margin: 0;
  font-size: 18px;
  color: var(--fg);
}

.wallet-address {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.wallet-address:hover {
  border-color: var(--arxiv-blue);
  background: rgba(0, 85, 170, 0.02);
}

.wallet-address code {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  word-break: break-all;
  display: block;
  color: var(--fg);
}

.copy-hint {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 11px;
  color: var(--fg-muted);
  background: var(--bg-light);
  padding: 2px 6px;
  border-radius: 3px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.wallet-address:hover .copy-hint {
  opacity: 1;
}

.qr-code {
  text-align: center;
}

.qr-placeholder {
  background: var(--border-light);
  border: 2px dashed var(--border);
  border-radius: 6px;
  padding: 40px 20px;
  color: var(--fg-muted);
  font-size: 14px;
}

.donation-instructions {
  background: #f8f9fa;
  border-left: 4px solid var(--arxiv-blue);
  padding: 20px;
  margin-bottom: 32px;
}

.donation-instructions h2 {
  margin-top: 0;
  color: var(--arxiv-blue);
}

.donation-instructions ol {
  margin: 16px 0;
  padding-left: 20px;
}

.donation-instructions li {
  margin-bottom: 8px;
  font-size: 16px;
}

.donation-note {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 6px;
  padding: 20px;
}

.donation-note h2 {
  margin-top: 0;
  color: #856404;
}

.donation-note ul {
  margin: 16px 0;
  padding-left: 20px;
}

.donation-note li {
  margin-bottom: 8px;
  font-size: 15px;
  color: #856404;
}

/* Support Section */
.support-section {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 32px;
  margin: 48px 0;
  text-align: center;
}

.support-section h2 {
  color: var(--arxiv-blue);
  margin-top: 0;
  margin-bottom: 16px;
}

.support-section p {
  color: var(--fg-muted);
  font-size: 16px;
  margin-bottom: 24px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.donation-btn {
  display: inline-block;
  background: var(--arxiv-blue);
  color: white;
  text-decoration: none;
  padding: 16px 32px;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 600;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 85, 170, 0.2);
}

.donation-btn:hover {
  background: var(--link-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 85, 170, 0.3);
  color: white;
  text-decoration: none;
}

/* Responsive */
@media (max-width: 768px) {
  body {
    font-size: 15px;
  }

  .container {
    padding: 0 1rem;
  }
  
  .page-header {
    margin-top: 1rem;
    margin-bottom: 2rem;
  }

  h1 {
    font-size: 28px;
  }

  h2 {
    font-size: 18px;
  }

  .site-header .brand {
    font-size: 16px;
  }

  .header-main {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }

  .header-search {
    max-width: none;
    margin: 0;
    order: 2;
  }

  .donate-btn {
    order: 3;
    text-align: center;
  }

  .site-header .brand {
    order: 1;
    text-align: center;
  }

  .header-breadcrumbs {
    font-size: 12px;
    padding: 0.25rem 0;
  }

  .search-block {
    padding: 16px;
  }

  .search-filters {
    flex-direction: column;
    gap: 16px;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .paper-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .paper-item:hover {
    margin: 0 -1rem;
    padding: 1.5rem 1rem;
  }

  .crypto-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .crypto-item {
    padding: 16px;
  }

  .support-section {
    padding: 24px 16px;
    margin: 32px 0;
  }

  .donation-btn {
    padding: 14px 24px;
    font-size: 16px;
  }
}
