/* ── Reset & Base ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --void:       #08090E;
  --surface:    #111420;
  --panel:      #1A1F35;
  --card-hover: #232A45;
  --primary:    #7C3AED;
  --primary-dim:#5B21B6;
  --secondary:  #06B6D4;
  --border:     rgba(255,255,255,0.07);
  --border-md:  rgba(255,255,255,0.12);
  --text:       #FFFFFF;
  --text-muted: #A1A1AA;
  --text-dim:   #71717A;
  --radius:     12px;
  --radius-sm:  8px;
  --mono:       'JetBrains Mono', monospace;
  --sans:       'Inter', sans-serif;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--void);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }
input, button { font-family: var(--sans); outline: none; }
button { cursor: pointer; }

/* ── Scrollbar ────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--void); }
::-webkit-scrollbar-thumb { background: var(--panel); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--card-hover); }

/* ── Navbar ───────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(8,9,14,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: 56px;
}

.nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-left { display: flex; align-items: center; gap: 16px; flex: 1; }

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.brand-icon {
  font-size: 18px;
  color: var(--primary);
  line-height: 1;
}

.brand-accent { color: var(--secondary); }

.global-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  height: 36px;
  width: 320px;
  transition: border-color 0.2s;
}

.global-search:focus-within { border-color: var(--primary); }

.search-icon { color: var(--text-dim); display: flex; align-items: center; }

.global-search input {
  background: none;
  border: none;
  color: var(--text);
  font-size: 13px;
  flex: 1;
  min-width: 0;
}

.global-search input::placeholder { color: var(--text-dim); }

.search-shortcut {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text-dim);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  white-space: nowrap;
}

.nav-links { display: flex; align-items: center; gap: 4px; }

.nav-link {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  transition: color 0.2s, background 0.2s;
}

.nav-link:hover { color: var(--text); background: var(--surface); }
.nav-link.active { color: var(--text); }

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

.btn-ghost {
  background: none;
  border: 1px solid var(--border-md);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  transition: color 0.2s, border-color 0.2s;
}

.btn-ghost:hover { color: var(--text); border-color: var(--border-md); }

.btn-primary {
  background: var(--primary);
  border: 1px solid transparent;
  color: #fff;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.2s, transform 0.15s;
}

.btn-primary:hover { background: var(--primary-dim); }
.btn-primary:active { transform: scale(0.97); }

/* ── Layout ───────────────────────────────────────── */
.layout {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 24px 0;
  display: flex;
  gap: 24px;
  flex: 1;
  width: 100%;
}

/* ── Sidebar ──────────────────────────────────────── */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  position: sticky;
  top: 80px;
  height: calc(100vh - 96px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-bottom: 24px;
}

.sidebar-section {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.sidebar-section:last-child { border-bottom: none; }

.sidebar-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.filter-list { display: flex; flex-direction: column; gap: 2px; }

.filter-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  transition: background 0.15s, color 0.15s;
  user-select: none;
}

.filter-item:hover { background: var(--surface); color: var(--text); }
.filter-item.active { background: var(--panel); color: var(--text); }

.filter-item input { display: none; }

.filter-item span:first-of-type { flex: 1; }

.filter-count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  min-width: 20px;
  text-align: right;
}

.tags-wrap { display: flex; flex-wrap: wrap; gap: 6px; }

.tag {
  font-size: 11px;
  font-family: var(--mono);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-md);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}

.tag:hover { border-color: var(--primary); color: var(--text); }
.tag.active { border-color: var(--primary); background: rgba(124,58,237,0.15); color: var(--primary); }

.slider-wrap { display: flex; flex-direction: column; gap: 8px; }

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 3px;
  border-radius: 2px;
  background: var(--panel);
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 2px solid var(--void);
  transition: transform 0.15s;
}

input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); }

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text-dim);
}

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

.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
}

.content-meta { display: flex; align-items: baseline; gap: 12px; }

.content-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.content-count {
  font-size: 12px;
  font-family: var(--mono);
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 20px;
}

.view-toggle { display: flex; gap: 4px; }

.view-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.view-btn:hover { color: var(--text); border-color: var(--border-md); }
.view-btn.active { background: var(--panel); color: var(--text); border-color: var(--border-md); }

/* ── Model Grid ───────────────────────────────────── */
.model-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.model-grid.list-mode { grid-template-columns: 1fr; }

/* ── Model Card ───────────────────────────────────── */
.model-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: fadeIn 0.25s ease;
}

.model-card:hover {
  background: var(--card-hover);
  border-color: var(--border-md);
  transform: translateY(-1px);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }

.card-avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  font-family: var(--mono);
}

.card-id {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.3;
  word-break: break-all;
}

.card-badges { display: flex; flex-wrap: wrap; gap: 4px; }

.badge {
  font-size: 10px;
  font-family: var(--mono);
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid;
  text-transform: lowercase;
}

.badge-task {
  color: var(--secondary);
  border-color: rgba(6,182,212,0.3);
  background: rgba(6,182,212,0.08);
}

.badge-lang {
  color: #A78BFA;
  border-color: rgba(167,139,250,0.3);
  background: rgba(167,139,250,0.08);
}

.badge-lib {
  color: #6EE7B7;
  border-color: rgba(110,231,183,0.3);
  background: rgba(110,231,183,0.08);
}

.card-name {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  word-break: break-word;
}

.card-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-stats {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.stat {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text-dim);
}

.stat svg { flex-shrink: 0; }

.stat-val { color: var(--text-muted); }

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

.provider-pill {
  font-size: 10px;
  font-family: var(--mono);
  color: var(--text-dim);
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 20px;
}

.updated-at {
  font-size: 10px;
  font-family: var(--mono);
  color: var(--text-dim);
}

/* ── Skeleton ─────────────────────────────────────── */
.skeleton-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  height: 190px;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Error State ──────────────────────────────────── */
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 64px 24px;
  text-align: center;
}

.error-icon { font-size: 28px; color: var(--text-dim); }
.error-msg { color: var(--text-muted); font-size: 14px; }

.hidden { display: none !important; }

/* ── Pagination ───────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 32px;
  padding: 20px 0;
  border-top: 1px solid var(--border);
}

.page-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: var(--mono);
  transition: all 0.15s;
}

.page-btn:hover:not(:disabled) {
  background: var(--panel);
  color: var(--text);
  border-color: var(--border-md);
}

.page-btn:disabled { opacity: 0.35; cursor: default; }

.page-numbers { display: flex; gap: 4px; }

.page-num {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  font-family: var(--mono);
  cursor: pointer;
  transition: all 0.15s;
}

.page-num:hover { background: var(--panel); color: var(--text); }
.page-num.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ── Modal ────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8,9,14,0.8);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeOverlay 0.2s ease;
}

@keyframes fadeOverlay {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border-md);
  border-radius: 16px;
  width: 100%;
  max-width: 640px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  animation: slideModal 0.2s ease;
}

@keyframes slideModal {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
  z-index: 1;
}

.modal-close:hover { color: var(--text); }

.modal-body { padding: 28px; }

.modal-header { margin-bottom: 20px; }

.modal-avatar {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  font-family: var(--mono);
  margin-bottom: 14px;
}

.modal-name {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
  word-break: break-word;
}

.modal-id {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
}

.modal-badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }

.modal-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 20px 0;
}

.modal-stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}

.modal-stat-val {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  display: block;
}

.modal-stat-label {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 3px;
  display: block;
}

.modal-section { margin-top: 20px; }

.modal-section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.modal-command {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.modal-command code {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--secondary);
  flex: 1;
  word-break: break-all;
}

.copy-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 4px 8px;
  border-radius: 5px;
  font-size: 11px;
  font-family: var(--mono);
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.copy-btn:hover { border-color: var(--primary); color: var(--primary); }

.modal-hf-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--primary);
  margin-top: 14px;
  transition: opacity 0.15s;
}

.modal-hf-link:hover { opacity: 0.8; }

/* ── Footer ───────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  margin-top: auto;
  background: var(--void);
}

.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.footer-brand {
  font-weight: 600;
  font-size: 13px;
  color: var(--primary);
  white-space: nowrap;
}

.footer-copy {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--mono);
  flex: 1;
}

.footer-links {
  display: flex;
  gap: 16px;
}

.footer-links a {
  font-size: 12px;
  color: var(--text-dim);
  transition: color 0.15s;
}

.footer-links a:hover { color: var(--text-muted); }

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 1024px) {
  .model-grid { grid-template-columns: 1fr; }
  .global-search { width: 220px; }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .layout { padding: 16px; }
  .nav-links { display: none; }
  .global-search { width: 180px; }
  .modal-stats { grid-template-columns: repeat(2, 1fr); }
}
