:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: #1a1f2e;
  --bg-card-hover: #232a3e;
  --bg-input: #1e2538;
  --bg-modal: #141b2b;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-color: #2d3548;
  --border-hover: #4a5568;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);
  --danger: #ef4444;
  --danger-hover: #f87171;
  --success: #22c55e;
  --warning: #f59e0b;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --transition: 0.3s ease;
  --nav-height: 64px;
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-input: #e2e8f0;
  --bg-modal: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border-color: #e2e8f0;
  --border-hover: #cbd5e1;
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* ===== Navigation ===== */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--nav-height);
  background: var(--bg-secondary); border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; z-index: 1000; backdrop-filter: blur(12px);
  transition: background var(--transition), border-color var(--transition);
}
.nav-left { display: flex; align-items: center; gap: 16px; }
.nav-logo {
  font-size: 22px; font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; cursor: pointer;
}
.nav-logo-sub { font-size: 13px; color: var(--text-muted); margin-left: 4px; -webkit-text-fill-color: var(--text-muted); }
.nav-center { display: flex; gap: 4px; }
.nav-btn {
  padding: 8px 16px; border: none; background: transparent;
  color: var(--text-secondary); font-size: 14px; cursor: pointer;
  border-radius: var(--radius-sm); transition: all var(--transition);
}
.nav-btn:hover { background: var(--bg-card); color: var(--text-primary); }
.nav-btn.active { background: var(--accent); color: white; }
.nav-right { display: flex; align-items: center; gap: 12px; }
.theme-toggle {
  background: none; border: 1px solid var(--border-color); font-size: 20px;
  cursor: pointer; padding: 6px 10px; border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.theme-toggle:hover { background: var(--bg-card); }

/* ===== User Menu ===== */
.user-menu { position: relative; }
.user-btn {
  display: flex; align-items: center; gap: 6px; padding: 6px 12px;
  border: 1px solid var(--border-color); border-radius: var(--radius);
  background: var(--bg-card); color: var(--text-primary);
  font-size: 14px; cursor: pointer; transition: all var(--transition);
}
.user-btn:hover { border-color: var(--accent); }
.user-btn .user-avatar { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.user-btn .user-avatar-placeholder {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent-gradient); color: white; display: flex;
  align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
}
.user-dropdown {
  position: absolute; top: 100%; right: 0; margin-top: 8px;
  min-width: 220px; background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  z-index: 1001; display: none; overflow: hidden;
}
.user-dropdown.open { display: block; }
.user-dropdown-header { display: flex; align-items: center; gap: 12px; padding: 16px; }
.user-dropdown-header .user-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.user-dropdown-header .user-avatar-placeholder {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent-gradient); color: white; display: flex;
  align-items: center; justify-content: center; font-size: 18px; font-weight: 700;
}
.dropdown-info h4 { font-size: 14px; color: var(--text-primary); }
.dropdown-info span { font-size: 12px; color: var(--text-muted); }
.dropdown-divider { height: 1px; background: var(--border-color); }
.dropdown-item {
  display: flex; align-items: center; gap: 8px; padding: 10px 16px;
  font-size: 14px; color: var(--text-secondary); cursor: pointer;
  transition: all var(--transition); text-decoration: none;
}
.dropdown-item:hover { background: var(--bg-card-hover); color: var(--text-primary); }

/* ===== Main Container ===== */
.main-container { max-width: 1400px; margin: 0 auto; padding: calc(var(--nav-height) + 16px) 24px 40px; }

/* ===== Stats Bar ===== */
.stats-bar {
  display: flex; gap: 24px; padding: 12px 20px;
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius); margin-bottom: 16px;
}
.stat-item { font-size: 14px; color: var(--text-secondary); }
.stat-item strong { color: var(--text-primary); margin-left: 4px; }

/* ===== Filters ===== */
.filters-bar {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px;
}
.filters-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-group label { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }
.filter-group select, .filter-group input {
  background: var(--bg-input); border: 1px solid var(--border-color);
  color: var(--text-primary); padding: 6px 12px; border-radius: var(--radius-sm);
  font-size: 13px; outline: none; transition: border-color var(--transition);
}
.filter-group select:focus, .filter-group input:focus { border-color: var(--accent); }
.filter-search { display: flex; align-items: flex-end; gap: 6px; }
.filter-search button {
  padding: 6px 16px; border: none; border-radius: var(--radius-sm);
  background: var(--accent); color: white; cursor: pointer;
  font-size: 13px; transition: all var(--transition); height: 32px;
}
.filter-search button:hover { background: var(--accent-hover); }
.filter-reset-btn { background: var(--bg-input) !important; color: var(--text-secondary) !important; border: 1px solid var(--border-color) !important; }

/* ===== View Toggle ===== */
.view-toggle { display: flex; gap: 8px; margin-bottom: 16px; }
.view-btn {
  padding: 8px 20px; border: 1px solid var(--border-color); border-radius: var(--radius-sm);
  background: var(--bg-card); color: var(--text-secondary); cursor: pointer;
  font-size: 14px; transition: all var(--transition);
}
.view-btn:hover { border-color: var(--accent); color: var(--text-primary); }
.view-btn.active { background: var(--accent); color: white; border-color: var(--accent); }

/* ===== Loading ===== */
.loading { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.spinner {
  width: 36px; height: 36px; border: 3px solid var(--border-color);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.8s linear infinite; margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Card View ===== */
.card-view { display: flex; flex-direction: column; gap: 16px; }
.tier-section { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius); overflow: hidden; }
.tier-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; cursor: pointer; user-select: none;
  transition: background var(--transition);
}
.tier-header:hover { background: var(--bg-card-hover); }
.tier-header-left { display: flex; align-items: center; gap: 12px; }
.tier-badge {
  display: inline-block; padding: 4px 12px; border-radius: 20px;
  font-size: 13px; font-weight: 700; color: white;
}
.tier-count { font-size: 13px; color: var(--text-muted); }
.tier-header-arrow { color: var(--text-muted); font-size: 12px; transition: transform var(--transition); }
.tier-section.collapsed .tier-header-arrow { transform: rotate(-90deg); }
.tier-section.collapsed .tier-gpus { display: none; }
.tier-gpus { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; padding: 0 20px 20px; }

/* ===== GPU Card ===== */
.gpu-card {
  background: var(--bg-primary); border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); padding: 14px; cursor: pointer;
  transition: all var(--transition);
  display: flex; flex-direction: column;
}
.gpu-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.gpu-card-brand { font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.gpu-card-model { font-size: 15px; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; }
.gpu-card-type {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 600;
}
.gpu-card-year { font-size: 11px; color: var(--text-muted); }
.gpu-card-specs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; margin-bottom: 6px; }
.gpu-card-spec { font-size: 11px; color: var(--text-secondary); }
.gpu-card-bottom {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: auto; padding-top: 8px; border-top: 1px solid var(--border-color);
}
.gpu-card-tier { font-size: 13px; font-weight: 700; }
.gpu-card-score { font-size: 18px; font-weight: 800; color: var(--accent); }

/* ===== Vertical View ===== */
.vertical-view-inner { display: flex; flex-direction: column; gap: 24px; }
.vertical-brand-section {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius); overflow: hidden;
}
.vertical-brand-header {
  padding: 14px 20px; font-size: 16px; font-weight: 700;
  color: var(--text-primary); display: flex; align-items: center; gap: 10px;
}
.vertical-gpu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 0 16px 16px; }
.vertical-gpu-col { display: flex; flex-direction: column; gap: 6px; }
.vbar-item {
  padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer;
  transition: all var(--transition);
}
.vbar-item:hover { background: var(--bg-card-hover); }
.vbar-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.vbar-model { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.vbar-score { font-size: 13px; font-weight: 700; }
.vbar-track {
  height: 6px; background: var(--bg-primary); border-radius: 3px;
  margin-bottom: 4px; overflow: hidden;
}
.vbar-fill { height: 100%; border-radius: 3px; transition: width 0.5s ease; }
.vbar-specs { display: flex; gap: 8px; font-size: 11px; color: var(--text-muted); }

/* ===== Empty State ===== */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7); z-index: 2000; display: none;
  align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-content {
  background: var(--bg-modal); border: 1px solid var(--border-color);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 700px; max-height: 85vh; overflow-y: auto;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--border-color);
}
.modal-header h2 { font-size: 18px; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px; border: none; background: var(--bg-input);
  border-radius: 50%; font-size: 16px; cursor: pointer; color: var(--text-secondary);
  transition: all var(--transition); display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--danger); color: white; }
.modal-body { padding: 24px; }

/* ===== GPU Detail ===== */
.gpu-detail-header { display: flex; gap: 20px; margin-bottom: 24px; }
.gpu-detail-icon { font-size: 48px; }
.gpu-detail-info h2 { font-size: 22px; margin-bottom: 4px; }
.brand-name { font-size: 14px; color: var(--text-secondary); margin-bottom: 12px; }
.gpu-detail-score { display: flex; align-items: center; gap: 12px; }
.score-big { font-size: 36px; font-weight: 800; color: var(--accent); }
.specs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.spec-item { background: var(--bg-card); padding: 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-color); }
.spec-item label { font-size: 11px; color: var(--text-muted); display: block; margin-bottom: 4px; }
.spec-item span { font-size: 14px; color: var(--text-primary); font-weight: 600; }
.admin-comment-box {
  background: var(--bg-card); border: 1px solid var(--accent);
  border-radius: var(--radius-sm); padding: 16px; margin-bottom: 20px;
}
.admin-comment-box .label { font-size: 13px; color: var(--accent); margin-bottom: 8px; font-weight: 600; }
.admin-comment-box p { font-size: 14px; color: var(--text-secondary); }

/* ===== Comments ===== */
.comments-section { margin-top: 20px; }
.comments-section h3 { font-size: 16px; margin-bottom: 16px; }
.comment-form { display: flex; gap: 8px; margin-bottom: 16px; }
.comment-form textarea {
  flex: 1; background: var(--bg-input); border: 1px solid var(--border-color);
  color: var(--text-primary); padding: 10px 12px; border-radius: var(--radius-sm);
  font-size: 14px; outline: none; resize: vertical; min-height: 40px;
  font-family: inherit;
}
.comment-form textarea:focus { border-color: var(--accent); }
.comment-form button {
  padding: 8px 20px; background: var(--accent); color: white; border: none;
  border-radius: var(--radius-sm); cursor: pointer; font-size: 14px;
  font-weight: 600; transition: all var(--transition); white-space: nowrap;
}
.comment-form button:hover { background: var(--accent-hover); }
.comment-item { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border-color); }
.comment-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent-gradient); color: white; display: flex;
  align-items: center; justify-content: center; font-weight: 700;
  font-size: 14px; flex-shrink: 0;
}
.comment-body { flex: 1; }
.comment-user { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.comment-text { font-size: 14px; color: var(--text-secondary); line-height: 1.5; }
.comment-time { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ===== Toast ===== */
.toast-container { position: fixed; top: 80px; right: 20px; z-index: 3000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 10px 20px; border-radius: var(--radius-sm); color: white;
  font-size: 14px; animation: slideIn 0.3s ease; box-shadow: var(--shadow);
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--accent); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ===== Auth Pages ===== */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: var(--bg-primary);
}
.auth-box {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-lg); padding: 40px; width: 100%; max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.auth-box h1 {
  text-align: center; font-size: 28px; font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; margin-bottom: 4px;
}
.auth-box .subtitle { text-align: center; color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 6px;
}
.form-group input, .form-group select {
  width: 100%; padding: 10px 14px; background: var(--bg-input);
  border: 1px solid var(--border-color); border-radius: var(--radius-sm);
  color: var(--text-primary); font-size: 14px; outline: none;
  transition: border-color var(--transition);
}
.form-group input:focus, .form-group select:focus { border-color: var(--accent); }
.form-group input:disabled { opacity: 0.5; cursor: not-allowed; }
.form-actions { margin-top: 20px; }
.btn-primary {
  width: 100%; padding: 10px 20px; background: var(--accent-gradient);
  color: white; border: none; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: all var(--transition);
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.form-footer { text-align: center; margin-top: 16px; font-size: 14px; color: var(--text-muted); }
.form-footer a { color: var(--accent); text-decoration: none; font-weight: 600; }
.form-footer a:hover { text-decoration: underline; }

/* ===== Alert ===== */
.alert { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; display: none; }
.alert.error { display: block; background: rgba(239,68,68,0.15); color: var(--danger); border: 1px solid rgba(239,68,68,0.3); }
.alert.success { display: block; background: rgba(34,197,94,0.15); color: var(--success); border: 1px solid rgba(34,197,94,0.3); }

/* ===== Profile Page ===== */
.profile-page { max-width: 600px; margin: 100px auto; padding: 24px; }
.profile-card {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow-lg);
}
.profile-avatar { text-align: center; margin-bottom: 24px; }
.profile-avatar img {
  width: 100px; height: 100px; border-radius: 50%; object-fit: cover;
  border: 3px solid var(--accent); cursor: pointer;
}
.profile-avatar .placeholder {
  width: 100px; height: 100px; border-radius: 50%;
  background: var(--accent-gradient); display: flex;
  align-items: center; justify-content: center; font-size: 36px;
  color: white; font-weight: 700; margin: 0 auto; cursor: pointer;
}
.profile-avatar input { display: none; }
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--accent); text-decoration: none; font-size: 14px; margin-bottom: 20px;
}
.back-link:hover { text-decoration: underline; }

/* ===== Site Footer ===== */
.site-footer {
  text-align: center; padding: 24px; color: var(--text-muted);
  font-size: 13px; border-top: 1px solid var(--border-color);
}
.site-footer a { color: var(--accent); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* ===== Mobile ===== */
@media (max-width: 768px) {
  .nav-center { display: none; }
  .navbar { padding: 0 12px; }
  .main-container { padding: calc(var(--nav-height) + 12px) 12px 32px; }
  .filters-row { flex-direction: column; }
  .filter-group { width: 100%; }
  .filter-search { width: 100%; flex-wrap: wrap; }
  .tier-gpus { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); padding: 0 12px 12px; }
  .vertical-gpu-grid { grid-template-columns: 1fr; }
  .stats-bar { flex-wrap: wrap; gap: 12px; }
  .specs-grid { grid-template-columns: repeat(2, 1fr); }
  .gpu-detail-header { flex-direction: column; align-items: center; text-align: center; }
  .gpu-detail-score { justify-content: center; }
  .modal-content { max-width: 95vw; }
}
