/* ============================================================
   Community Repos page — style.css
   ============================================================ */

:root {
  --bg:         #0d0d0d;
  --surface:    #1a1a1a;
  --surface2:   #222222;
  --surface3:   #2a2a2a;
  --border:     #333333;
  --border2:    #444444;
  --accent:     #4e8a2e;
  --accent-h:   #5da033;
  --accent-dim: rgba(78,138,46,0.18);
  --text:       #e8e8e8;
  --text-dim:   #888888;
  --text-muted: #555555;
  --radius:     8px;
  --shadow:     0 2px 12px rgba(0,0,0,0.5);
}

/* ============================================================
   LIGHT MODE OVERRIDES
   ============================================================ */
[data-theme="light"] {
  --bg:         #f5f5f4;
  --surface:    #ececea;
  --surface2:   #ffffff;
  --surface3:   #f0f0ee;
  --border:     #cccccc;
  --border2:    #bbbbbb;
  --accent:     #3d7020;
  --accent-h:   #2e5818;
  --accent-dim: rgba(78,138,46,0.18);
  --text:       #222222;
  --text-dim:   #666666;
  --text-muted: #888888;
  --shadow:     0 2px 12px rgba(0,0,0,.10);
}

[data-theme="light"] code { color: #2e6010; }

[data-theme="light"] .nav-search-btn { border-color: #bbbbbb; color: #444444; }
[data-theme="light"] .nav-search-btn:hover { background: #e8e8e6; border-color: #999; }
[data-theme="light"] .nav-search-shortcut { background: #e0e0de; border-color: #c0c0be; color: #666; }

[data-theme="light"] .page-header {
  background: #e0eed4;
  border-bottom-color: #b8d4a0;
}

[data-theme="light"] .cat-security { background: rgba(231,76,60,0.12);  color: #a03020; }
[data-theme="light"] .cat-ai       { background: rgba(52,152,219,0.12); color: #1060a0; }
[data-theme="light"] .cat-vehicles { background: rgba(241,196,15,0.12); color: #8a6a00; }
[data-theme="light"] .cat-ui       { background: rgba(155,89,182,0.12); color: #6a3890; }
[data-theme="light"] .cat-tools    { background: rgba(78,138,46,0.12);  color: #3d7020; }
[data-theme="light"] .cat-scripts  { background: rgba(230,126,34,0.12); color: #8a4a10; }

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 16px 56px;
}

a { color: var(--accent); }
a:hover { color: var(--accent-h); }

code {
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  background: var(--surface3);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.88em;
  color: #b0e080;
}

/* ─── Site Nav ───────────────────────────────────────────────── */
.site-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-nav-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
}
.site-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.05em;
  color: var(--text);
  text-decoration: none;
}
.site-brand:hover { color: var(--text); }
.site-brand-icon { font-size: 1.2em; }
.site-brand-dim { color: var(--text-dim); font-weight: 400; }
.site-nav-links {
  list-style: none;
  display: flex;
  gap: 4px;
  align-items: center;
}
.site-nav-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.9em;
  padding: 6px 10px;
  border-radius: 5px;
  transition: color 0.15s, background 0.15s;
}
.site-nav-links a:hover, .site-nav-links a.active { color: var(--text); background: var(--accent-dim); }
.site-nav-links a.active { color: var(--accent-h); }
.nav-search-btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid #333; border-radius: 6px;
  color: #888; cursor: pointer; font-size: 0.88em; padding: 4px 10px;
  gap: 5px; transition: color 0.15s, background 0.15s, border-color 0.15s;
  white-space: nowrap; font-family: inherit;
}
.nav-search-btn:hover { color: var(--text); background: #222; border-color: #555; }
.nav-search-shortcut {
  display: inline-block; font-size: 0.8em; background: #222;
  border: 1px solid #3a3a3a; border-radius: 3px; padding: 0 4px; color: #555; line-height: 1.4;
}

/* ─── Page Header ────────────────────────────────────────────── */
.page-header {
  background: linear-gradient(160deg, #0e1a09 0%, #0d0d0d 60%);
  border-bottom: 1px solid var(--border);
  padding: 28px 16px 24px;
}
.page-header-inner { max-width: 960px; margin: 0 auto; }
.page-title { font-size: 1.8em; font-weight: 700; letter-spacing: -0.5px; margin-bottom: 6px; }
.page-sub { color: var(--text-dim); font-size: 0.9em; max-width: 620px; }
.page-sub kbd {
  display: inline-block; background: var(--surface3); border: 1px solid var(--border2);
  border-radius: 3px; padding: 0 5px; font-size: 0.88em; color: var(--text-dim);
  font-family: inherit;
}

/* ─── Filter Bar ─────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  padding-top: 4px;
}
.filter-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 100px;
  padding: 6px 14px;
  font-size: 0.85em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  font-family: inherit;
  white-space: nowrap;
}
.filter-btn:hover { background: var(--surface3); color: var(--text); border-color: var(--border2); }
.filter-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent-h);
}
.filter-count {
  display: inline-block;
  background: var(--surface3);
  border-radius: 100px;
  padding: 0 6px;
  font-size: 0.85em;
  margin-left: 3px;
  color: var(--text-muted);
}
.filter-btn.active .filter-count { background: rgba(78,138,46,0.25); color: var(--accent-h); }

/* ─── Sort Row ───────────────────────────────────────────────── */
.sort-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.sort-label { font-size: 0.85em; color: var(--text-muted); }
.sort-select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 0.85em;
  padding: 5px 10px;
  outline: none;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s;
}
.sort-select:focus { border-color: var(--accent); color: var(--text); }
.results-count { font-size: 0.82em; color: var(--text-muted); margin-left: auto; }

/* ─── Repo Grid ──────────────────────────────────────────────── */
.repo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 16px;
}

/* ─── Repo Card ──────────────────────────────────────────────── */
.repo-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s;
}
.repo-card:hover { border-color: var(--border2); }
.repo-card.hidden { display: none; }

.repo-card-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.repo-icon { font-size: 1.6em; flex-shrink: 0; margin-top: 1px; line-height: 1; }
.repo-title-block { flex: 1; min-width: 0; }
.repo-title { font-size: 0.97em; font-weight: 700; line-height: 1.3; margin-bottom: 2px; }
.repo-author { font-size: 0.78em; color: var(--text-muted); }
.repo-author a { color: var(--text-muted); }
.repo-author a:hover { color: var(--text-dim); }

/* ─── Category Badges ────────────────────────────────────────── */
.cat-badge {
  flex-shrink: 0;
  font-size: 0.7em;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
  margin-top: 2px;
}
.cat-security { background: rgba(231,76,60,0.2);   color: #e87070; }
.cat-ai       { background: rgba(52,152,219,0.2);  color: #5db8e8; }
.cat-vehicles { background: rgba(241,196,15,0.2);  color: #d4b800; }
.cat-ui       { background: rgba(155,89,182,0.2);  color: #c39be0; }
.cat-tools    { background: rgba(78,138,46,0.2);   color: #7ec850; }
.cat-scripts  { background: rgba(230,126,34,0.2);  color: #e8955a; }

/* ─── Card Body ──────────────────────────────────────────────── */
.repo-desc { font-size: 0.87em; color: var(--text-dim); line-height: 1.65; }
.repo-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  list-style: none;
}
.repo-tags li {
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.75em;
  color: var(--text-muted);
  padding: 2px 8px;
}
.repo-tip {
  font-size: 0.82em;
  color: var(--text-muted);
  background: rgba(78,138,46,0.07);
  border: 1px solid rgba(78,138,46,0.2);
  border-radius: 6px;
  padding: 8px 12px;
  line-height: 1.5;
}
.repo-tip a { color: var(--accent); }
.repo-tip strong { color: var(--text-dim); }

/* ─── Changelog expander ─────────────────────────────────────── */
.repo-extra {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.repo-extra summary {
  font-size: 0.82em;
  color: var(--text-muted);
  padding: 7px 12px;
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface2);
  transition: background 0.12s, color 0.12s;
}
.repo-extra summary:hover { background: var(--surface3); color: var(--text-dim); }
.repo-extra summary::before { content: '›'; font-size: 1.1em; transition: transform 0.15s; }
.repo-extra[open] summary::before { transform: rotate(90deg); }
.repo-changelog {
  margin: 0;
  padding: 10px 16px 12px 28px;
  font-size: 0.82em;
  color: var(--text-dim);
  line-height: 1.7;
  background: var(--surface2);
  list-style: disc;
}
.repo-changelog li { margin-bottom: 2px; }

/* ─── GitHub Link Button ─────────────────────────────────────── */
.repo-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: auto;
  background: var(--accent-dim);
  border: 1px solid rgba(78,138,46,0.4);
  color: var(--accent-h);
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 0.85em;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s;
  align-self: flex-start;
}
.repo-link-btn:hover { background: rgba(78,138,46,0.3); color: var(--accent-h); }

/* ─── Suggest Note ───────────────────────────────────────────── */
.suggest-note {
  margin-top: 32px;
  font-size: 0.85em;
  color: var(--text-muted);
  text-align: center;
}
.suggest-note a { color: var(--text-muted); text-decoration: underline; }
.suggest-note a:hover { color: var(--text-dim); }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  .repo-grid { grid-template-columns: 1fr; }
  .filter-bar { gap: 6px; }
  .filter-btn { padding: 5px 11px; font-size: 0.8em; }
}
