/* ── Grapevine Mutation DB Styles ── */

:root {
  --primary: #2c5282;
  --primary-light: #ebf4ff;
  --accent: #c53030;
  --accent2: #2b6cb0;
  --bg: #f7fafc;
  --card-bg: #fff;
  --border: #e2e8f0;
  --text: #1a202c;
  --muted: #718096;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", sans-serif;
  --mono: "SFMono-Regular", "Cascadia Code", Consolas, monospace;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* ── Navbar ── */
.navbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 24px;
  height: 56px;
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  position: sticky; top: 0; z-index: 100;
}
.nav-brand a {
  color: #fff; font-size: 18px; font-weight: 700; text-decoration: none;
  letter-spacing: .5px;
}
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-links a {
  color: rgba(255,255,255,.8); text-decoration: none; padding: 6px 14px;
  border-radius: 6px; font-size: 14px; transition: all .15s;
}
.nav-links a:hover, .nav-links a.router-link-active {
  background: rgba(255,255,255,.15); color: #fff;
}
.nav-genome { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.nav-genome label { color: rgba(255,255,255,.7); }
.nav-genome select {
  padding: 6px 10px; border-radius: 6px; border: none;
  font-size: 13px; background: rgba(255,255,255,.15); color: #fff;
  cursor: pointer;
}
.nav-genome select option { color: #333; background: #fff; }
.nav-user { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.nav-username { color: rgba(255,255,255,.8); }
.btn-logout {
  padding: 5px 14px; background: rgba(255,255,255,.15); color: #fff;
  border: 1px solid rgba(255,255,255,.2); border-radius: 6px;
  cursor: pointer; font-size: 12px;
}
.btn-logout:hover { background: rgba(255,255,255,.25); }

/* ── Main Content ── */
.main-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

/* ── Dashboard ── */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin: 20px 0;
}
.stat-cards.small { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  text-align: center;
  border-left: 4px solid var(--primary-light);
}
.card.accent { border-left-color: var(--accent); }
.card.accent2 { border-left-color: var(--accent2); }
.card-num { font-size: 28px; font-weight: 800; color: var(--primary); }
.card.accent .card-num { color: var(--accent); }
.card.accent2 .card-num { color: var(--accent2); }
.card-label { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* ── Panels ── */
.panel {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.panel h3 { font-size: 15px; margin-bottom: 12px; color: var(--primary); }
.flex-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
@media (max-width: 768px) { .flex-row { grid-template-columns: 1fr; } }

/* ── Bar Chart ── */
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; font-size: 13px; }
.bar-label { width: 100px; text-align: right; flex-shrink: 0; }
.bar-track { flex: 1; height: 18px; background: #edf2f7; border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary); border-radius: 4px; min-width: 2px; transition: width .4s; }
.bar-num { width: 70px; font-family: var(--mono); font-size: 12px; color: var(--muted); text-align: left; }
.bar-HIGH { background: var(--accent); }
.bar-moderate { background: #dd6b20; }
.bar-low { background: #d69e2e; }
.bar-modifier { background: #718096; }

/* ── Chromosome Grid ── */
.chrom-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.chrom-cell {
  display: flex; flex-direction: column; gap: 2px; padding: 10px 14px;
  background: var(--primary-light); border-radius: 6px; cursor: pointer;
  transition: background .15s;
}
.chrom-cell:hover { background: #bee3f8; }
.chrom-name { font-weight: 600; font-size: 14px; }
.chrom-count { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.chrom-bar { height: 4px; background: var(--primary); border-radius: 2px; margin-top: 4px; }

/* ── Tables ── */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  background: var(--primary-light); color: var(--primary);
  padding: 10px 12px; text-align: left; font-weight: 600; font-size: 12px;
  white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
tbody td { padding: 8px 12px; border-bottom: 1px solid var(--border); }
tbody tr.clickable { cursor: pointer; transition: background .1s; }
tbody tr.clickable:hover { background: var(--primary-light); }

/* ── Impact Colors ── */
.impact-high { color: var(--accent); font-weight: 600; }
.impact-moderate { color: #dd6b20; }
.impact-low { color: #d69e2e; }
.impact-modifier { color: var(--muted); }

/* ── Confidence Badges ── */
.conf-badge {
  display: inline-block; padding: 2px 10px; border-radius: 12px;
  font-size: 12px; font-weight: 700; letter-spacing: .3px;
}
.conf-high { background: #c6f6d5; color: #22543d; }
.conf-medium { background: #fefcbf; color: #744210; }
.conf-low { background: #fed7d7; color: #822727; }

/* Confidence bar colors */
.bar-high { background: #38a169; }
.bar-medium { background: #ecc94b; }
.bar-low { background: #e53e3e; }

/* ── Toolbar ── */
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.search-box {
  padding: 8px 14px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 14px; font-family: var(--font); flex: 1; min-width: 180px;
}
.search-box.big { padding: 12px 18px; font-size: 16px; }
.search-box:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.search-bar { display: flex; gap: 10px; margin-bottom: 20px; }
select {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 14px; font-family: var(--font); background: #fff; cursor: pointer;
}
button {
  padding: 8px 20px; background: var(--primary); color: #fff; border: none;
  border-radius: 6px; font-size: 14px; font-family: var(--font); cursor: pointer;
  transition: background .15s;
}
button:hover { background: #1a365d; }
button:disabled { background: #a0aec0; cursor: not-allowed; }

/* ── Pagination ── */
.pagination {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  margin-top: 16px; font-size: 14px; color: var(--muted);
}

/* ── Gene List ── */
.gene-list { list-style: none; font-size: 13px; }
.gene-list li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); }
.gene-list a { color: var(--primary); text-decoration: none; }
.gene-list a:hover { text-decoration: underline; }
.badge { background: var(--primary-light); color: var(--primary); padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; }

/* ── Browser ── */
.genome-browser .browser-toolbar { display: flex; gap: 10px; margin-bottom: 16px; align-items: center; }

/* ── Utility ── */
.mono { font-family: var(--mono); }
.small { font-size: 11px; }
.muted { color: var(--muted); font-size: 14px; }
.error { color: var(--accent); background: #fff5f5; padding: 12px 18px; border-radius: 6px; font-size: 14px; }
.back-link { color: var(--primary); text-decoration: none; font-size: 14px; display: inline-block; margin-bottom: 12px; }
.back-link:hover { text-decoration: underline; }
h2 { font-size: 22px; margin-bottom: 4px; }
h3 { font-size: 16px; }

/* ── Loading ── */
.loading-overlay {
  position: fixed; inset: 0; background: rgba(255,255,255,.8);
  display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 999;
}
.spinner {
  width: 40px; height: 40px; border: 4px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Login Page ── */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 80vh;
}
.login-card {
  background: var(--card-bg); border-radius: 12px; padding: 40px;
  box-shadow: 0 4px 24px rgba(0,0,0,.1); width: 100%; max-width: 420px;
}
.login-card h1 { font-size: 24px; text-align: center; margin-bottom: 4px; }
.login-card p { text-align: center; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 4px; font-size: 14px; font-weight: 600; color: var(--text); }
