/* ═══════════════════════════════════════════════════════════════════════
   Human_PPCA v0.3 — Professional Academic Database Theme
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  --blue-700: #1a4080;
  --blue-600: #1d5cb8;
  --blue-500: #2e6fcf;
  --blue-400: #4a90d9;
  --blue-300: #7bb3e1;
  --blue-200: #a8d0f0;
  --blue-100: #d0e8fa;
  --blue-50: #eaf3fc;
  --blue-25: #f4f9fd;
  --blue-900: #0e2448;
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --ev-high: #15803d;
  --ev-high-bg: #f0fdf4;
  --ev-medium: #b45309;
  --ev-medium-bg: #fffbeb;
  --ev-low: #dc2626;
  --ev-low-bg: #fef2f2;
  --ev-review: #9333ea;
  --radius: 8px;
  --radius-sm: 4px;
  --nav-height: 56px;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--slate-50);
  color: var(--slate-800);
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Navigation ──────────────────────────────────────────────────────── */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: var(--blue-900); color: white;
  height: var(--nav-height);
  display: flex; align-items: center; padding: 0 24px;
  border-bottom: 2px solid var(--blue-700);
  font-size: 14px;
}
.nav-logo { font-weight: 800; font-size: 16px; letter-spacing: 0.5px; margin-right: 32px; display: flex; align-items: center; gap: 8px; }
.nav-logo .logo-icon { width: 28px; height: 28px; background: var(--blue-500); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 14px; }
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-links a { padding: 6px 14px; color: var(--blue-200); cursor: pointer; border-radius: var(--radius-sm); transition: all 0.15s; font-weight: 500; text-decoration: none; }
.nav-links a:hover { color: white; background: var(--blue-700); }
.nav-links a.active { color: white; background: var(--blue-600); }
.nav-version { color: var(--blue-300); font-size: 11px; font-weight: 600; padding: 2px 8px; background: var(--blue-800); border-radius: var(--radius-sm); }

/* ── Pages ───────────────────────────────────────────────────────────── */
.page { display: none; }
.page.active { display: block; }
.page-container { max-width: 1280px; margin: 0 auto; padding: 20px 24px; }
.page-header { margin-bottom: 16px; }
.page-header h2 { font-size: 22px; color: var(--blue-900); font-weight: 700; display: flex; align-items: center; gap: 10px; }
.page-header .icon svg { vertical-align: middle; }
.page-header .result-info { font-size: 13px; color: var(--slate-500); margin-top: 4px; }

/* ── Dashboard ───────────────────────────────────────────────────────── */
.dash-search-wrap { background: var(--blue-900); padding: 16px 0; }
.dash-search-bar {
  max-width: 680px; margin: 0 auto; position: relative;
}
.dash-search-bar input {
  width: 100%; padding: 12px 48px 12px 16px; border: 2px solid var(--blue-600);
  border-radius: var(--radius); font-size: 15px; background: white; color: var(--slate-800);
  outline: none; transition: border-color 0.2s;
}
.dash-search-bar input:focus { border-color: var(--blue-400); }
.dash-search-bar input::placeholder { color: var(--slate-400); }
.dash-search-btn {
  position: absolute; right: 8px; top: 8px; width: 36px; height: 36px;
  background: var(--blue-600); border: none; border-radius: var(--radius-sm);
  color: white; cursor: pointer; display: flex; align-items: center; justify-content: center;
}

.dash-stats-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin: 16px 0; }
.stat-card {
  background: white; border: 1px solid var(--slate-200); border-radius: var(--radius);
  padding: 14px; text-align: center; transition: border-color 0.15s;
}
.stat-card:hover { border-color: var(--blue-400); }
.stat-card .stat-num { font-size: 24px; font-weight: 800; color: var(--blue-700); }
.stat-card .stat-label { font-size: 11px; color: var(--slate-500); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }

.dash-quick-filters { margin: 16px 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dash-quick-filters .label { font-size: 12px; color: var(--slate-600); font-weight: 600; margin-right: 4px; }
.quick-chip {
  padding: 5px 12px; border: 1px solid var(--slate-200); border-radius: 16px;
  font-size: 12px; color: var(--slate-700); cursor: pointer; background: white;
  transition: all 0.15s; font-weight: 500;
}
.quick-chip:hover { border-color: var(--blue-400); color: var(--blue-600); }
.quick-chip.active { background: var(--blue-600); color: white; border-color: var(--blue-600); }

.conf-legend { display: flex; gap: 12px; margin: 12px 0; flex-wrap: wrap; }
.conf-legend-item { font-size: 12px; display: flex; align-items: center; gap: 4px; }
.conf-dot { width: 10px; height: 10px; border-radius: 50%; }

/* ── Data Tables ─────────────────────────────────────────────────────── */
.data-table-wrap { overflow-x: auto; background: white; border: 1px solid var(--slate-200); border-radius: var(--radius); }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  background: var(--blue-25); color: var(--blue-700); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.3px; padding: 10px 12px;
  border-bottom: 2px solid var(--blue-200); text-align: left; white-space: nowrap;
}
.data-table td { padding: 8px 12px; border-bottom: 1px solid var(--slate-100); color: var(--slate-700); vertical-align: top; }
.data-table tr:hover td { background: var(--blue-25); }
.data-table tr.needs-review td { background: var(--ev-medium-bg); }
.data-table .mono { font-family: var(--font-mono); font-size: 12px; }

/* ── Confidence badges ───────────────────────────────────────────────── */
.conf-high { color: var(--ev-high); font-weight: 700; }
.conf-medium { color: var(--ev-medium); font-weight: 700; }
.conf-low { color: var(--ev-low); font-weight: 700; }
.badge { display: inline-block; padding: 2px 8px; border-radius: var(--radius-sm); font-size: 11px; font-weight: 700; }
.badge-high { background: var(--ev-high-bg); color: var(--ev-high); border: 1px solid #bbf7d0; }
.badge-medium { background: var(--ev-medium-bg); color: var(--ev-medium); border: 1px solid #fde68a; }
.badge-low { background: var(--ev-low-bg); color: var(--ev-low); border: 1px solid #fecaca; }
.review-flag { display: inline-block; padding: 2px 8px; border-radius: var(--radius-sm); font-size: 11px; font-weight: 700; background: #f3e8ff; color: var(--ev-review); border: 1px solid #d8b4fe; }

/* ── Link chips ──────────────────────────────────────────────────────── */
.link-chip { color: var(--blue-600); cursor: pointer; text-decoration: none; transition: color 0.1s; font-weight: 600; }
.link-chip:hover { color: var(--blue-400); text-decoration: underline; }
.link-chip.pdb { font-family: var(--font-mono); }
.external-link { font-size: 11px; color: var(--blue-400); text-decoration: none; }
.external-link:hover { color: var(--blue-600); text-decoration: underline; }

/* ── Pagination ──────────────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.pagination .page-info { font-size: 13px; color: var(--slate-500); }
.pagination .page-btns { display: flex; gap: 6px; }
.page-btn {
  padding: 6px 14px; border: 1px solid var(--slate-200); border-radius: var(--radius-sm);
  font-size: 13px; background: white; cursor: pointer; color: var(--slate-700);
  transition: all 0.15s; font-weight: 500;
}
.page-btn:hover { border-color: var(--blue-400); color: var(--blue-600); }
.page-btn:disabled { opacity: 0.4; cursor: default; }

/* ── Detail Pages ────────────────────────────────────────────────────── */
.detail-page { max-width: 1280px; margin: 0 auto; padding: 20px 24px; }
.detail-back { display: inline-block; padding: 6px 14px; background: var(--slate-100); border-radius: var(--radius-sm); font-size: 13px; color: var(--slate-600); cursor: pointer; margin-bottom: 16px; font-weight: 500; transition: background 0.15s; }
.detail-back:hover { background: var(--slate-200); }
.detail-header { margin-bottom: 20px; }
.detail-header h2 { font-size: 20px; color: var(--blue-900); font-weight: 700; }
.detail-meta { font-size: 13px; color: var(--slate-500); margin-top: 4px; display: flex; gap: 12px; flex-wrap: wrap; }
.detail-meta .mono { font-family: var(--font-mono); }
.detail-section { margin-top: 20px; }
.detail-section h3 { font-size: 16px; color: var(--blue-700); font-weight: 700; margin-bottom: 8px; border-bottom: 1px solid var(--blue-100); padding-bottom: 4px; }
.summary-box { background: var(--blue-25); border: 1px solid var(--blue-100); border-radius: var(--radius); padding: 16px; font-size: 14px; line-height: 1.6; }
.evidence-group { margin-bottom: 16px; }
.evidence-group h4 { font-size: 14px; color: var(--blue-600); font-weight: 600; margin-bottom: 8px; }
.evidence-item { background: white; border: 1px solid var(--slate-200); border-radius: var(--radius); padding: 12px; margin-bottom: 8px; }
.evidence-item.review-flag-border { border-left: 3px solid var(--ev-review); }
.evidence-item .ev-header { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.evidence-item .ev-quote { font-size: 13px; color: var(--slate-700); line-height: 1.5; background: var(--slate-50); padding: 8px; border-radius: var(--radius-sm); margin-top: 6px; border: 1px solid var(--slate-100); }

/* ── Protein Card Grid ───────────────────────────────────────────────── */
.protein-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.protein-card {
  background: white; border: 1px solid var(--slate-200); border-radius: var(--radius);
  padding: 14px; cursor: pointer; transition: border-color 0.15s;
}
.protein-card:hover { border-color: var(--blue-400); }
.protein-card .pc-name { font-size: 14px; font-weight: 700; color: var(--blue-700); margin-bottom: 4px; }
.protein-card .pc-uniprot { font-family: var(--font-mono); font-size: 12px; color: var(--blue-600); }
.protein-card .pc-gene { font-size: 12px; color: var(--slate-500); }
.protein-card .pc-stats { display: flex; gap: 10px; margin-top: 8px; font-size: 12px; color: var(--slate-500); }
.protein-card .pc-stats strong { color: var(--blue-700); }

/* ── Search ──────────────────────────────────────────────────────────── */
.search-input-wrap { position: relative; margin-bottom: 16px; }
.search-input-wrap input { width: 100%; padding: 10px 40px 10px 16px; border: 1px solid var(--slate-200); border-radius: var(--radius); font-size: 14px; }
.search-input-wrap input:focus { border-color: var(--blue-400); outline: none; }

/* ── About Page ──────────────────────────────────────────────────────── */
.about-section { margin-bottom: 24px; }
.about-section h3 { font-size: 16px; color: var(--blue-700); font-weight: 700; margin-bottom: 8px; }
.about-section p { font-size: 14px; color: var(--slate-600); line-height: 1.6; }
.about-section ul { font-size: 14px; color: var(--slate-600); line-height: 1.6; padding-left: 20px; }
.conf-def-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
.conf-def-card { border-radius: var(--radius); padding: 12px; }
.conf-def-card.high { background: var(--ev-high-bg); border: 1px solid #bbf7d0; }
.conf-def-card.medium { background: var(--ev-medium-bg); border: 1px solid #fde68a; }
.conf-def-card.low { background: var(--ev-low-bg); border: 1px solid #fecaca; }
.conf-def-label { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.conf-def-text { font-size: 12px; line-height: 1.5; }
.data-file-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
.data-file-card { border: 1px solid var(--slate-200); border-radius: var(--radius); padding: 16px; background: var(--blue-25); transition: border-color 0.15s; }
.data-file-card:hover { border-color: var(--blue-400); }
.data-file-name { font-size: 14px; font-weight: 700; color: var(--blue-700); font-family: var(--font-mono); margin-bottom: 4px; }
.download-icon { color: var(--blue-600); font-size: 16px; font-weight: 700; margin-right: 4px; }
.data-file-desc { font-size: 12px; color: var(--slate-500); line-height: 1.5; }
.data-file-badge { display: inline-block; padding: 2px 6px; border-radius: 4px; font-size: 10px; font-weight: 600; background: var(--blue-50); color: var(--blue-600); margin-top: 6px; }
.data-file-download-btn { display: inline-block; margin-top: 8px; padding: 5px 14px; background: var(--blue-600); color: white; border-radius: var(--radius-sm); font-size: 12px; font-weight: 600; cursor: default; }

/* ── Error state ─────────────────────────────────────────────────────── */
.error-state { padding: 40px; text-align: center; }
.error-state h3 { color: var(--ev-low); font-size: 18px; }
.error-state p { color: var(--slate-500); font-size: 14px; margin-top: 8px; }
.loading-state { padding: 20px; text-align: center; color: var(--slate-400); font-size: 14px; }

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 1024px) { .dash-stats-row { grid-template-columns: repeat(3, 1fr); } .conf-def-grid { grid-template-columns: 1fr; } .data-file-grid { grid-template-columns: 1fr; } }
@media (max-width: 768px) { .dash-stats-row { grid-template-columns: repeat(2, 1fr); } .nav-links { overflow-x: auto; } .protein-grid { grid-template-columns: 1fr; } }
