/* === 20MW Gas Turbine Review - Dark Tech Theme === */
:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: #1a2332;
  --bg-sidebar: #0d1321;
  --border-color: #1e3a5f;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-blue: #3b82f6;
  --accent-cyan: #06b6d4;
  --accent-teal: #14b8a6;
  --accent-glow: rgba(59, 130, 246, 0.15);
  --sidebar-width: 260px;
  --header-height: 56px;
}

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

body {
  font-family: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
}

/* === Header === */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-height);
  background: linear-gradient(135deg, var(--bg-secondary), #0f1a2e);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 24px;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
}

.header-logo .icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700;
}

.header-logo h1 {
  font-size: 16px;
  font-weight: 600;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

.search-box {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px 14px;
  color: var(--text-primary);
  font-size: 13px;
  width: 220px;
  outline: none;
  transition: border-color 0.2s;
}
.search-box:focus { border-color: var(--accent-blue); }
.search-box::placeholder { color: var(--text-muted); }

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

.sidebar-section {
  margin-bottom: 8px;
}

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

.sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}

.sidebar a:hover {
  color: var(--text-primary);
  background: var(--accent-glow);
  border-left-color: var(--accent-blue);
}

.sidebar a.active {
  color: var(--accent-cyan);
  background: var(--accent-glow);
  border-left-color: var(--accent-cyan);
}

.sidebar a .nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.sidebar a .badge {
  margin-left: auto;
  background: var(--bg-primary);
  color: var(--text-muted);
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 10px;
}

/* === Main Content === */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  padding: 32px 40px;
  min-height: calc(100vh - var(--header-height));
}

/* === Markdown Content Styling === */
.md-content { max-width: 900px; }

.md-content h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 16px 0;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-color);
}

.md-content h2 {
  font-size: 22px;
  font-weight: 600;
  color: var(--accent-cyan);
  margin: 32px 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(6, 182, 212, 0.2);
}

.md-content h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 24px 0 8px 0;
}

.md-content h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 20px 0 8px 0;
}

.md-content p {
  margin: 0 0 14px 0;
  color: var(--text-secondary);
  line-height: 1.8;
}

.md-content ul, .md-content ol {
  margin: 0 0 14px 24px;
  color: var(--text-secondary);
}

.md-content li { margin-bottom: 4px; }

.md-content blockquote {
  border-left: 3px solid var(--accent-blue);
  padding: 8px 16px;
  margin: 14px 0;
  background: var(--accent-glow);
  border-radius: 0 6px 6px 0;
  color: var(--text-secondary);
}

.md-content code {
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent-cyan);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: 'Fira Code', 'Consolas', monospace;
}

.md-content pre {
  background: #0d1117;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  margin: 14px 0;
  overflow-x: auto;
}

.md-content pre code {
  background: none;
  padding: 0;
  font-size: 13px;
  line-height: 1.6;
}

.md-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 14px;
}

.md-content th {
  background: var(--bg-card);
  color: var(--accent-cyan);
  padding: 10px 14px;
  text-align: left;
  border: 1px solid var(--border-color);
  font-weight: 600;
}

.md-content td {
  padding: 8px 14px;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.md-content tr:nth-child(even) td {
  background: rgba(26, 35, 50, 0.5);
}

.md-content img {
  max-width: 100%;
  border-radius: 8px;
  margin: 14px 0;
}

.md-content a {
  color: var(--accent-blue);
  text-decoration: none;
  border-bottom: 1px solid rgba(59, 130, 246, 0.3);
}
.md-content a:hover {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
}

.md-content hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 24px 0;
}

/* === Cards === */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  transition: all 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
}

.card:hover {
  border-color: var(--accent-blue);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.1);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.card-meta {
  margin-top: 12px;
  font-size: 12px;
  color: var(--accent-cyan);
}

/* === PDF Download Button === */
.pdf-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--accent-blue), #2563eb);
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  margin: 20px 0;
  transition: all 0.2s;
}

.pdf-download:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
  color: #fff;
}

.pdf-unavailable {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-primary);
  color: var(--text-muted);
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  border: 1px dashed var(--border-color);
  margin: 20px 0;
}

/* === Section Headers === */
.section-header {
  margin-bottom: 24px;
}

.section-header h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.section-header p {
  color: var(--text-muted);
  font-size: 14px;
}

/* === Model Badge === */
.model-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  margin-right: 6px;
}

.model-badge.agt { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.model-badge.cgt { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.model-badge.g { background: rgba(168, 85, 247, 0.15); color: #c084fc; }
.model-badge.l { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.model-badge.lm { background: rgba(6, 182, 212, 0.15); color: #22d3ee; }
.model-badge.m { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.model-badge.sgt { background: rgba(20, 184, 166, 0.15); color: #2dd4bf; }
.model-badge.titan { background: rgba(244, 114, 182, 0.15); color: #f472b6; }

/* === Timeline (Retrospective) === */
.timeline {
  position: relative;
  padding-left: 32px;
  margin: 20px 0;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--border-color);
}

.timeline-item {
  position: relative;
  margin-bottom: 24px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -26px; top: 6px;
  width: 12px; height: 12px;
  background: var(--accent-blue);
  border-radius: 50%;
  border: 2px solid var(--bg-primary);
}

.timeline-item h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.timeline-item p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* === Tags === */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  background: var(--bg-primary);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  margin: 2px;
}

/* === Loading Spinner === */
.loading {
  display: flex;
  justify-content: center;
  padding: 40px;
}

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

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

/* === Back to top === */
.back-to-top {
  position: fixed;
  bottom: 24px; right: 24px;
  width: 40px; height: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s;
  z-index: 80;
}
.back-to-top.visible { opacity: 1; }
.back-to-top:hover { color: var(--accent-cyan); border-color: var(--accent-cyan); }

/* === Responsive === */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
    z-index: 200;
    width: 260px;
  }
  .sidebar.open { transform: translateX(0); }
  .main-content {
    margin-left: 0;
    padding: 20px 16px;
  }
  .header { padding: 0 12px; }
  .search-box { width: 140px; }
  .mobile-toggle { display: block !important; }
  .card-grid { grid-template-columns: 1fr; }
}

.mobile-toggle {
  display: none !important;
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
}

/* === Stat boxes === */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin: 20px 0;
}

.stat-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent-cyan);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* === Paper list === */
.paper-list { list-style: none; margin: 0; padding: 0; }

.paper-list li {
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin-bottom: 8px;
  transition: all 0.15s;
}

.paper-list li:hover {
  border-color: var(--accent-blue);
  background: var(--accent-glow);
}

.paper-list a {
  color: var(--text-primary);
  text-decoration: none;
  font-size: 14px;
  display: block;
}

.paper-list .paper-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 190;
}
.sidebar-overlay.show { display: block; }
