@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&family=Roboto+Mono:wght@400;500&display=swap');

:root {
  --md-sys-color-primary: #8ab4f8;
  --md-sys-color-on-primary: #003a75;
  --md-sys-color-primary-container: #004a9f;
  --md-sys-color-on-primary-container: #d3e3fd;
  --md-sys-color-secondary: #bec6dc;
  --md-sys-color-on-secondary: #283041;
  --md-sys-color-surface: #111318;
  --md-sys-color-surface-dim: #111318;
  --md-sys-color-surface-container: #1d2024;
  --md-sys-color-surface-container-low: #1a1c20;
  --md-sys-color-surface-container-high: #282a2f;
  --md-sys-color-surface-container-highest: #33353a;
  --md-sys-color-on-surface: #e2e2e6;
  --md-sys-color-on-surface-variant: #c4c6d0;
  --md-sys-color-outline: #8e9099;
  --md-sys-color-outline-variant: #44464f;
  --md-sys-color-error: #ffb4ab;
  --md-sys-color-success: #81c995;
  --md-sys-color-warning: #fdd663;
  --md-elevation-1: 0 1px 2px rgba(0,0,0,0.3), 0 1px 3px 1px rgba(0,0,0,0.15);
  --md-elevation-2: 0 1px 2px rgba(0,0,0,0.3), 0 2px 6px 2px rgba(0,0,0,0.15);
  --md-elevation-3: 0 4px 8px 3px rgba(0,0,0,0.15), 0 1px 3px rgba(0,0,0,0.3);
  --md-shape-corner-m: 12px;
  --md-shape-corner-l: 16px;
  --md-shape-corner-xl: 28px;
}

[data-theme="light"] {
  --md-sys-color-primary: #1b6ef3;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #d3e3fd;
  --md-sys-color-on-primary-container: #001d36;
  --md-sys-color-secondary: #535f70;
  --md-sys-color-on-secondary: #ffffff;
  --md-sys-color-surface: #f9f9ff;
  --md-sys-color-surface-dim: #d9d9e0;
  --md-sys-color-surface-container: #ededf4;
  --md-sys-color-surface-container-low: #f3f3fa;
  --md-sys-color-surface-container-high: #e7e8ee;
  --md-sys-color-surface-container-highest: #e1e2e8;
  --md-sys-color-on-surface: #1a1b20;
  --md-sys-color-on-surface-variant: #44464f;
  --md-sys-color-outline: #74777f;
  --md-sys-color-outline-variant: #c4c6d0;
  --md-sys-color-error: #ba1a1a;
  --md-sys-color-success: #1e8e3e;
  --md-sys-color-warning: #e37400;
  --md-elevation-1: 0 1px 2px rgba(0,0,0,0.15), 0 1px 3px 1px rgba(0,0,0,0.08);
  --md-elevation-2: 0 1px 2px rgba(0,0,0,0.15), 0 2px 6px 2px rgba(0,0,0,0.08);
  --md-elevation-3: 0 4px 8px 3px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.15);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Roboto', system-ui, sans-serif;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--md-sys-color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Top App Bar ---- */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--md-sys-color-surface-container);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(12px);
}

.top-bar-title {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-bar-title a { color: inherit; text-decoration: none; }

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 20px;
  border: none;
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: background 0.2s;
}

.icon-btn:hover { background: var(--md-sys-color-surface-container-highest); }

/* ---- Layout: sidebar + main ---- */
.layout {
  display: flex;
  min-height: calc(100vh - 64px);
}

/* ---- Sidebar ---- */
.sidebar {
  width: 280px;
  flex-shrink: 0;
  background: var(--md-sys-color-surface-container-low);
  border-right: 1px solid var(--md-sys-color-outline-variant);
  padding: 16px 12px;
  overflow-y: auto;
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
}

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

.sidebar-heading {
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--md-sys-color-on-surface-variant);
  padding: 8px 12px 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 100px;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.875rem;
  text-decoration: none;
  transition: all 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}

.sidebar-link .material-symbols-rounded { font-size: 20px; }

.sidebar-link:hover {
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
  text-decoration: none;
}

.sidebar-link.active {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  font-weight: 500;
}

.sidebar-count {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--md-sys-color-outline);
}

.sidebar-link.active .sidebar-count { color: var(--md-sys-color-on-primary-container); }

.sidebar-plugin-link {
  font-family: 'Roboto Mono', monospace;
  font-size: 0.8125rem;
  padding: 6px 12px;
}

.sidebar-toggle { display: none; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 90;
}

/* ---- Main Content ---- */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 0 32px;
}

/* ---- Container (for non-sidebar pages) ---- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- Content Toolbar ---- */
.content-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.toolbar-info {
  font-size: 0.875rem;
  color: var(--md-sys-color-on-surface-variant);
  font-weight: 500;
}

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

/* ---- Hero ---- */
.hero {
  padding: 40px 0 32px;
  text-align: center;
}

.hero h1 {
  font-size: 2.25rem;
  font-weight: 400;
  color: var(--md-sys-color-on-surface);
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}

.hero .subtitle {
  font-size: 1rem;
  color: var(--md-sys-color-on-surface-variant);
  max-width: 580px;
  margin: 0 auto 20px;
  line-height: 1.7;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-top: 20px;
}

.stat { text-align: center; }

.stat-number {
  font-size: 1.75rem;
  font-weight: 500;
  color: var(--md-sys-color-primary);
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--md-sys-color-on-surface-variant);
}

/* ---- Filter Chips ---- */
.chip {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--md-sys-color-outline);
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  font-family: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.chip:hover { background: var(--md-sys-color-surface-container-high); }

.chip.active {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  border-color: transparent;
}

/* ---- Plugin Cards Grid ---- */
.plugin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  padding-bottom: 48px;
}

.plugin-card {
  background: var(--md-sys-color-surface-container);
  border-radius: var(--md-shape-corner-l);
  padding: 20px 24px;
  border: 1px solid var(--md-sys-color-outline-variant);
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.plugin-card:hover {
  box-shadow: var(--md-elevation-2);
  border-color: var(--md-sys-color-outline);
  text-decoration: none;
  transform: translateY(-2px);
}

.plugin-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 12px;
}

.plugin-card h3 {
  font-size: 1rem;
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
  font-family: 'Roboto Mono', monospace;
}

.category-badge {
  font-size: 0.6875rem;
  padding: 3px 10px;
  border-radius: 100px;
  background: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface-variant);
  white-space: nowrap;
  flex-shrink: 0;
}

.category-badge.code-quality { background: #1b3a2a; color: #81c995; }
.category-badge.security { background: #3a1b1b; color: #ffb4ab; }
.category-badge.infrastructure { background: #1b2a3a; color: #8ab4f8; }
.category-badge.development { background: #2a1b3a; color: #c4a8ff; }
.category-badge.documentation { background: #3a2a1b; color: #fdd663; }

[data-theme="light"] .category-badge.code-quality { background: #d4edda; color: #155724; }
[data-theme="light"] .category-badge.security { background: #f8d7da; color: #721c24; }
[data-theme="light"] .category-badge.infrastructure { background: #cce5ff; color: #004085; }
[data-theme="light"] .category-badge.development { background: #e2d5f1; color: #4a1d96; }
[data-theme="light"] .category-badge.documentation { background: #fff3cd; color: #856404; }

.plugin-card p {
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.8125rem;
  flex: 1;
  margin-bottom: 14px;
  line-height: 1.5;
}

.plugin-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.plugin-card-date {
  font-size: 0.75rem;
  color: var(--md-sys-color-outline);
}

.plugin-card-link {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--md-sys-color-primary);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ---- Detail Page ---- */
.detail-page {
  padding: 48px 24px 64px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.875rem;
  margin-bottom: 28px;
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--md-sys-color-on-surface);
  text-decoration: none;
}

.detail-header { margin-bottom: 36px; }

.detail-header h1 {
  font-size: 2rem;
  font-weight: 400;
  font-family: 'Roboto Mono', monospace;
  margin-bottom: 14px;
}

.detail-header .description {
  font-size: 1.125rem;
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 18px;
  line-height: 1.6;
}

.detail-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---- Sections ---- */
.section { margin-bottom: 36px; }

.section h2 {
  font-size: 1.375rem;
  font-weight: 500;
  margin-bottom: 16px;
  color: var(--md-sys-color-on-surface);
}

.section h3 {
  font-size: 1rem;
  font-weight: 500;
  margin: 16px 0 8px;
  color: var(--md-sys-color-on-surface);
}

.section p, .section li {
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 8px;
}

.section ul { padding-left: 24px; }

/* ---- Code Blocks ---- */
.code-block {
  position: relative;
  background: var(--md-sys-color-surface-container-highest);
  border-radius: var(--md-shape-corner-m);
  padding: 16px 20px;
  margin: 12px 0 16px;
  overflow-x: auto;
  border: 1px solid var(--md-sys-color-outline-variant);
}

.code-block code {
  font-family: 'Roboto Mono', monospace;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--md-sys-color-on-surface);
}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 6px 12px;
  border-radius: 8px;
  border: none;
  background: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.75rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, background 0.2s;
  font-family: inherit;
}

.code-block:hover .copy-btn { opacity: 1; }
.copy-btn:hover { background: var(--md-sys-color-primary-container); }

/* ---- Install Card ---- */
.install-card {
  background: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-shape-corner-l);
  padding: 32px;
  margin-bottom: 32px;
}

.install-card h2 { margin-bottom: 8px; }

.install-card .step {
  display: flex;
  gap: 16px;
  margin: 20px 0;
}

.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.step-content { flex: 1; }
.step-content h3 { margin-top: 4px; }

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid var(--md-sys-color-outline-variant);
  padding: 32px 0;
  text-align: center;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.875rem;
}

.site-footer a { color: var(--md-sys-color-primary); }

.footer-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 12px;
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    left: -300px;
    top: 64px;
    z-index: 95;
    transition: left 0.25s ease;
    height: calc(100vh - 64px);
  }
  .sidebar.open { left: 0; }
  .sidebar-overlay.open { display: block; }
  .sidebar-toggle { display: flex; }
  .main-content { padding: 0 20px; }
}

@media (max-width: 768px) {
  .hero h1 { font-size: 1.75rem; }
  .plugin-grid { grid-template-columns: 1fr; }
  .hero-stats { gap: 24px; }
  .top-bar { padding: 0 16px; }
  .install-card { padding: 20px; }
  .main-content { padding: 0 16px; }
  .container { padding: 0 16px; }
  .toolbar-chips { display: none; }
}

@media (max-width: 480px) {
  .hero-stats { flex-direction: column; gap: 16px; }
  .detail-meta { flex-direction: column; }
}
