/* ============================================
   AppCluster Website — Design System & Styles
   ============================================ */

:root {
  --bg: #0f1117;
  --surface: #181a20;
  --surface-2: #1e2028;
  --border: #2a2d38;
  --text: #e2e4e9;
  --text-muted: #8b8f9a;
  --accent: #6c5ce7;
  --accent-hover: #5a4bd1;
  --accent-light: #a29bfe;
  --success: #00b894;
  --danger: #e17055;
  --warning: #fdcb6e;
  --secondary: #636e72;
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  --max-width: 960px;
  --header-height: 56px;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-height) + 24px); }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-light); text-decoration: none; }
a:hover { color: var(--accent); text-decoration: underline; }
img { max-width: 100%; }

/* ---- Header / Navbar ---- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  z-index: 1000;
}
.site-header .logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.site-header .logo span { color: var(--accent-light); }
.site-header nav { margin-left: auto; display: flex; gap: 4px; }
.site-header nav a {
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  transition: color 0.15s, background 0.15s;
}
.site-header nav a:hover,
.site-header nav a.active {
  color: var(--text);
  background: var(--surface-2);
  text-decoration: none;
}
.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 24px;
  cursor: pointer;
  margin-left: auto;
  padding: 4px;
}

/* ---- Main Content ---- */
.main { margin-top: var(--header-height); }
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }
.section { padding: 48px 0; }
.section + .section { border-top: 1px solid var(--border); }

/* ---- Hero ---- */
.hero {
  text-align: center;
  padding: 80px 0 56px;
}
.hero h1 {
  font-size: 48px;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 16px;
}
.hero h1 .highlight { color: var(--accent-light); }
.hero .subtitle {
  font-size: 18px;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 32px;
  line-height: 1.6;
}
.hero .cta-group { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  text-decoration: none;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); color: var(--text); }
.btn-sm { padding: 6px 14px; font-size: 13px; }

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color 0.15s;
}
.card:hover { border-color: var(--accent); }
.card h3 { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.card p { font-size: 14px; color: var(--text-muted); line-height: 1.6; }
.card-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  margin-bottom: 16px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

/* ---- Feature Card Icons ---- */
.icon-purple { background: rgba(108, 92, 231, 0.15); color: var(--accent-light); }
.icon-green { background: rgba(0, 184, 148, 0.15); color: var(--success); }
.icon-blue { background: rgba(116, 185, 255, 0.15); color: #74b9ff; }
.icon-orange { background: rgba(225, 112, 85, 0.15); color: var(--danger); }
.icon-yellow { background: rgba(253, 203, 110, 0.15); color: var(--warning); }
.icon-gray { background: rgba(99, 110, 114, 0.15); color: var(--secondary); }

/* ---- Section Headings ---- */
.section-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}
.section-subtitle {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 40px;
}

/* ---- Code Blocks ---- */
.code-block {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
}
.code-block .copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
.code-block:hover .copy-btn { opacity: 1; }
.code-block .copy-btn:hover { color: var(--text); border-color: var(--accent); }
.code-block code { background: none; padding: 0; font-size: inherit; }
.code-comment { color: var(--text-muted); }

/* ---- Badges ---- */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.badge-accent { background: rgba(108, 92, 231, 0.15); color: var(--accent-light); }
.badge-success { background: rgba(0, 184, 148, 0.15); color: var(--success); }
.badge-danger { background: rgba(225, 112, 85, 0.15); color: var(--danger); }
.badge-warning { background: rgba(253, 203, 110, 0.15); color: var(--warning); }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th, td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
tr:hover td { background: var(--surface-2); }

/* ---- Architecture Diagram ---- */
.arch-diagram {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre;
  overflow-x: auto;
  color: var(--accent-light);
}

/* ---- Docs Layout ---- */
.docs-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 48px;
  align-items: start;
}
.docs-toc {
  position: sticky;
  top: calc(var(--header-height) + 24px);
  max-height: calc(100vh - var(--header-height) - 48px);
  overflow-y: auto;
}
.docs-toc ul { list-style: none; }
.docs-toc li { margin-bottom: 2px; }
.docs-toc a {
  display: block;
  padding: 4px 12px;
  font-size: 13px;
  color: var(--text-muted);
  border-left: 2px solid transparent;
  border-radius: 0 4px 4px 0;
}
.docs-toc a:hover { color: var(--text); text-decoration: none; }
.docs-toc a.active {
  color: var(--accent-light);
  border-left-color: var(--accent);
  background: rgba(108, 92, 231, 0.05);
}
.docs-content h2 {
  font-size: 24px;
  font-weight: 700;
  margin: 48px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.docs-content h2:first-child { margin-top: 0; }
.docs-content h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 32px 0 12px;
  color: var(--accent-light);
}
.docs-content p { margin-bottom: 16px; font-size: 15px; }
.docs-content ul, .docs-content ol {
  margin-bottom: 16px;
  padding-left: 24px;
}
.docs-content li { margin-bottom: 6px; font-size: 15px; }
.docs-content .code-block { margin-bottom: 20px; }

/* ---- Tabs ---- */
.tabs { display: flex; gap: 0; margin-bottom: 0; }
.tab-btn {
  padding: 10px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius) var(--radius) 0 0;
  transition: color 0.15s, background 0.15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { background: var(--bg); color: var(--accent-light); border-bottom-color: var(--bg); }
.tab-panel {
  display: none;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0 var(--radius) var(--radius) var(--radius);
  padding: 24px;
}
.tab-panel.active { display: block; }

/* ---- Plugin Cards ---- */
.plugin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color 0.15s;
}
.plugin-card:hover { border-color: var(--accent); }
.plugin-card .plugin-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.plugin-card .plugin-name { font-size: 16px; font-weight: 600; }
.plugin-card .plugin-desc { font-size: 14px; color: var(--text-muted); margin-bottom: 16px; line-height: 1.6; }
.plugin-card .plugin-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}
.plugin-card .plugin-meta code {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 4px;
  word-break: break-all;
}

/* ---- Module categories on the plugins page ---- */
/* Each category gets a tinted heading + small descriptor before its card grid.
   Spacing is tight enough that categories with one or two modules don't feel
   awkwardly empty, but loose enough that the user scans by category, not by row. */
.module-category {
  margin-bottom: 40px;
}
.module-category-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.module-category-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 16px 0;
}

/* ---- Changelog ---- */
.changelog-entry {
  border-left: 2px solid var(--border);
  padding: 0 0 40px 24px;
  position: relative;
  margin-left: 12px;
}
.changelog-entry::before {
  content: '';
  position: absolute;
  left: -7px;
  top: 4px;
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid var(--bg);
}
.changelog-entry:last-child { padding-bottom: 0; }
.changelog-entry .version-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.changelog-entry .version-tag {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-light);
}
.changelog-entry .version-date {
  font-size: 13px;
  color: var(--text-muted);
}
.changelog-entry .change-list { list-style: none; padding: 0; }
.changelog-entry .change-list li {
  font-size: 14px;
  padding: 4px 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

/* ---- Search / Filter ---- */
.search-input {
  width: 100%;
  max-width: 400px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.15s;
}
.search-input::placeholder { color: var(--secondary); }
.search-input:focus { border-color: var(--accent); }

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
.site-footer a { color: var(--accent-light); }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .site-header { padding: 0 16px; }
  .site-header nav {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 8px;
  }
  .site-header nav.open { display: flex; }
  .hamburger { display: block; }

  .hero { padding: 64px 0 48px; }
  .hero h1 { font-size: 32px; }
  .hero .subtitle { font-size: 16px; }

  .container { padding: 0 16px; }
  .section { padding: 40px 0; }

  .card-grid { grid-template-columns: 1fr; }

  .docs-layout {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .docs-toc {
    position: static;
    max-height: none;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
    margin-bottom: 32px;
  }
}

/* ---- Utility ---- */
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent-light); }
.mt-24 { margin-top: 24px; }
.mt-40 { margin-top: 40px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-40 { margin-bottom: 40px; }
.hidden { display: none; }
