/* Video Generation Survey - HuggingFace-inspired style */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --sidebar-width: 260px;
  --primary: #ff9d00;
  --primary-light: #fff3e0;
  --bg: #f9fafb;
  --card-bg: #ffffff;
  --border: #e5e7eb;
  --text: #1f2937;
  --text-muted: #6b7280;
  --text-light: #9ca3af;
  --tag-bg: #f3f4f6;
  --tag-text: #374151;
  --sidebar-bg: #ffffff;
  --hover: #f9fafb;
  --accent: #3b82f6;
  --accent-light: #eff6ff;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
  --radius: 8px;
  --radius-sm: 6px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* ===== TOP BAR ===== */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
  flex-shrink: 0;
}

.topbar-brand span.logo-icon {
  font-size: 20px;
}

.search-wrap {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 14px;
}

#searchInput {
  width: 100%;
  padding: 7px 12px 7px 34px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

#searchInput:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
  background: #fff;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin-left: auto;
}

.sort-select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: white;
  color: var(--text);
  cursor: pointer;
  outline: none;
}

.sort-select:focus {
  border-color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  background: var(--hover);
  border-color: #d1d5db;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: #2563eb;
  border-color: #2563eb;
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: default;
  transform: none;
}

.last-updated {
  font-size: 11px;
  color: var(--text-light);
  white-space: nowrap;
}

/* ===== LAYOUT ===== */
.layout {
  display: flex;
  padding-top: 56px;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed;
  top: 56px;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 16px 0;
  z-index: 50;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #e5e7eb; border-radius: 2px; }

.sidebar-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 6px 16px 8px;
}

.category-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 16px;
  background: none;
  border: none;
  border-radius: 0;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  text-align: left;
  transition: background 0.12s;
  position: relative;
}

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

.category-btn.active {
  background: var(--accent);
  color: #ffffff;
  border-radius: 20px;
  margin: 2px 8px;
  padding: 8px 12px;
  width: calc(100% - 16px);
}

.category-btn.active .cat-count {
  background: rgba(255,255,255,0.25);
  color: #ffffff;
}

.category-btn .cat-count {
  margin-left: auto;
  font-size: 11px;
  background: var(--tag-bg);
  color: var(--text-muted);
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 400;
}

.category-btn.active .cat-count {
  background: rgba(59,130,246,0.15);
  color: var(--accent);
}

.subsection-list {
  display: none;
  padding: 4px 0 8px;
  border-bottom: 1px solid var(--border);
}

.subsection-list.open { display: block; }

.subsection-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  padding: 6px 16px 6px 36px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  text-align: left;
  transition: color 0.12s, background 0.12s;
  border-radius: var(--radius-sm);
}

.subsection-btn:hover {
  color: var(--text);
  background: var(--hover);
}

.subsection-btn.active {
  background: var(--accent);
  color: #ffffff;
  font-weight: 500;
  border-radius: 20px;
  margin: 1px 8px;
  padding: 5px 12px 5px 20px;
  width: calc(100% - 16px);
}

.subsection-btn.active .sub-count {
  color: rgba(255,255,255,0.8);
}

.subsection-btn .sub-count {
  font-size: 11px;
  color: var(--text-light);
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

/* ===== MAIN CONTENT ===== */
.main {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 24px 28px;
  min-width: 0;
}

.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 10px;
}

.results-count {
  font-size: 14px;
  color: var(--text-muted);
}

.results-count strong {
  color: var(--text);
  font-weight: 600;
}

/* ===== PAPER CARDS ===== */
.paper-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.paper-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s, border-color 0.15s;
}

.paper-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #d1d5db;
}

.paper-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.paper-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  min-width: 200px;
  line-height: 1.4;
}

.paper-date {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  padding-top: 2px;
  flex-shrink: 0;
}

.paper-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  background: var(--tag-bg);
  color: var(--tag-text);
}

.tag-vg  { background: #fff7ed; color: #c2410c; }
.tag-eid { background: #faf5ff; color: #7c3aed; }
.tag-mmg { background: #ecfdf5; color: #059669; }
.tag-vh  { background: #fff1f2; color: #e11d48; }
.tag-sub { background: #f0fdf4; color: #16a34a; }

.paper-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 11px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  transition: background 0.12s, border-color 0.12s;
}

.link-btn:hover { background: var(--hover); border-color: #d1d5db; }
.link-btn.pdf   { border-color: #fca5a5; color: #dc2626; }
.link-btn.pdf:hover  { background: #fef2f2; }
.link-btn.page  { border-color: #86efac; color: #16a34a; }
.link-btn.page:hover { background: #f0fdf4; }

.star-badge {
  height: 20px;
  vertical-align: middle;
}



/* ===== STATES ===== */
.state-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-muted);
  gap: 12px;
  text-align: center;
}

.state-box .state-icon { font-size: 40px; opacity: 0.5; }
.state-box p { font-size: 15px; font-weight: 500; color: var(--text-muted); }
.state-box small { font-size: 13px; color: var(--text-light); }

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1f2937;
  color: white;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  z-index: 999;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  max-width: 320px;
  pointer-events: none;
}

.toast.show { opacity: 1; transform: translateY(0); }

.sync-progress {
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
  z-index: 200;
  display: none;
}

.sync-progress-bar {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
  width: 0%;
}

@media (max-width: 768px) {
  :root { --sidebar-width: 220px; }
  .main { padding: 16px; }
}
