@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── CSS Variables ─────────────────────────────────────────────────────── */
:root {
  --bg:        #ffffff;
  --bg2:       #f8fafc;
  --bg3:       #f1f5f9;
  --border:    #e2e8f0;
  --border2:   #cbd5e1;
  --text:      #0f172a;
  --text2:     #475569;
  --text3:     #94a3b8;
  --accent:    #2563eb;
  --accent2:   #1d4ed8;
  --accent-lt: #eff6ff;
  --accent-md: #bfdbfe;
  --green:     #16a34a;
  --green-lt:  #f0fdf4;
  --amber:     #d97706;
  --amber-lt:  #fffbeb;
  --purple:    #7c3aed;
  --purple-lt: #f5f3ff;
  --red:       #dc2626;
  --red-lt:    #fef2f2;

  /* Kingdom colors — 확장 대비 */
  --basidio:   #2563eb;
  --asco:      #16a34a;
  --pan:       #7c3aed;

  --font-body: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  --radius:    6px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow:    0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
}

/* ── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ────────────────────────────────────────────────────────────── */
.container        { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: 880px;  margin: 0 auto; padding: 0 24px; }

/* ── Nav ───────────────────────────────────────────────────────────────── */
nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: 56px;
  display: flex; align-items: center;
  padding: 0 24px; gap: 0;
}
.nav-logo {
  font-size: 18px; font-weight: 700;
  color: var(--text); letter-spacing: -0.5px;
  text-decoration: none; flex-shrink: 0;
  display: flex; align-items: center; gap: 8px;
}
.nav-logo-icon {
  width: 28px; height: 28px;
  background: var(--accent); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; color: #fff;
}
.nav-logo span { color: var(--accent); }
.nav-links {
  display: flex; gap: 4px; align-items: center;
  margin-left: 24px; flex: 1;
}
.nav-links a {
  color: var(--text2); font-size: 14px; font-weight: 400;
  padding: 6px 12px; border-radius: var(--radius);
  transition: all 0.15s; text-decoration: none;
}
.nav-links a:hover  { background: var(--bg3); color: var(--text); }
.nav-links a.active { background: var(--accent-lt); color: var(--accent); font-weight: 500; }

/* Kingdom selector (확장 대비) */
.nav-kingdom {
  display: flex; align-items: center; gap: 6px;
  margin-left: auto; margin-right: 16px;
}
.kingdom-pill {
  font-size: 11px; font-weight: 500; padding: 3px 10px;
  border-radius: 20px; border: 1px solid; cursor: pointer;
  transition: all 0.15s; white-space: nowrap;
}
.kingdom-pill.basidio.active {
  background: var(--accent-lt); color: var(--accent); border-color: var(--accent-md);
}
.kingdom-pill.basidio:not(.active) {
  background: transparent; color: var(--text3); border-color: var(--border);
}
.kingdom-pill.asco {
  background: transparent; color: var(--text3); border-color: var(--border);
  opacity: 0.5; cursor: not-allowed;
}

.nav-search {
  display: flex; align-items: center;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0 10px;
  gap: 6px; width: 200px; transition: border-color 0.2s;
}
.nav-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.nav-search input {
  background: none; border: none; outline: none;
  color: var(--text); font-family: var(--font-body); font-size: 13px;
  width: 100%; padding: 6px 0;
}
.nav-search input::placeholder { color: var(--text3); }
.nav-search .si { color: var(--text3); font-size: 14px; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-body); font-size: 14px; font-weight: 500;
  padding: 8px 18px; border-radius: var(--radius); border: none;
  cursor: pointer; transition: all 0.15s; text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent2); text-decoration: none; color: #fff; }
.btn-secondary {
  background: var(--bg); color: var(--text2);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg3); color: var(--text); text-decoration: none; }

/* ── Search bar ─────────────────────────────────────────────────────────── */
.search-bar {
  display: flex; gap: 8px; align-items: center;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--radius-lg); padding: 6px 6px 6px 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: var(--shadow-sm);
}
.search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.search-bar input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-family: var(--font-body); font-size: 15px; padding: 6px 0;
}
.search-bar input::placeholder { color: var(--text3); }
.search-bar button {
  background: var(--accent); color: #fff; border: none;
  border-radius: 8px; padding: 9px 20px; font-size: 14px;
  font-family: var(--font-body); cursor: pointer; font-weight: 500;
  transition: background 0.15s;
}
.search-bar button:hover { background: var(--accent2); }

/* ── Badge ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  font-family: var(--font-mono); font-size: 11px;
  padding: 2px 7px; border-radius: 4px;
  border: 1px solid; line-height: 1.5; white-space: nowrap; font-weight: 500;
}
.badge-blue   { color: var(--accent);  border-color: var(--accent-md); background: var(--accent-lt); }
.badge-green  { color: var(--green);   border-color: #bbf7d0; background: var(--green-lt); }
.badge-amber  { color: var(--amber);   border-color: #fde68a; background: var(--amber-lt); }
.badge-purple { color: var(--purple);  border-color: #ddd6fe; background: var(--purple-lt); }
.badge-red    { color: var(--red);     border-color: #fecaca; background: var(--red-lt); }
.badge-dim    { color: var(--text2);   border-color: var(--border); background: var(--bg2); }

/* ── Card ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
}
.card:hover { box-shadow: var(--shadow); }

/* ── Table ──────────────────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left; padding: 10px 14px;
  color: var(--text3); font-weight: 600; font-size: 11px;
  letter-spacing: 0.05em; text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
}
.data-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background 0.1s; }
.data-table tbody tr:hover { background: var(--bg2); }
.data-table a { color: var(--accent); font-family: var(--font-mono); font-size: 12px; }

/* ── Stat grid ──────────────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px; background: var(--border);
  border: 1px solid var(--border); border-radius: var(--radius-xl);
  overflow: hidden; box-shadow: var(--shadow-sm);
}
.stat-cell {
  background: var(--bg); padding: 20px 24px;
  display: flex; flex-direction: column; gap: 4px;
  transition: background 0.15s;
}
.stat-cell:hover { background: var(--bg2); }
.stat-num {
  font-size: 26px; font-weight: 700; color: var(--text);
  letter-spacing: -0.5px; line-height: 1.1;
}
.stat-label { font-size: 12px; color: var(--text3); font-weight: 400; }

/* ── Loading / Empty ────────────────────────────────────────────────────── */
.loading {
  display: flex; align-items: center; justify-content: center;
  padding: 60px; color: var(--text3); gap: 10px; font-size: 13px;
}
.loading::before {
  content: ''; width: 16px; height: 16px;
  border: 2px solid var(--border2); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty { padding: 60px; text-align: center; color: var(--text3); font-size: 13px; }

/* ── Pagination ─────────────────────────────────────────────────────────── */
.pagination { display: flex; gap: 6px; align-items: center; justify-content: center; padding: 24px 0; }
.page-btn {
  background: var(--bg); border: 1px solid var(--border);
  color: var(--text2); font-family: var(--font-mono); font-size: 12px;
  padding: 6px 14px; border-radius: var(--radius); cursor: pointer; transition: all 0.15s;
}
.page-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); background: var(--accent-lt); }
.page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.page-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── Mono / Seq ─────────────────────────────────────────────────────────── */
.mono { font-family: var(--font-mono); }
.seq  { font-family: var(--font-mono); font-size: 12px; color: var(--text2); word-break: break-all; line-height: 1.8; letter-spacing: 0.03em; }
.text-dim   { color: var(--text2); }
.text-muted { color: var(--text3); }
.text-mono  { font-family: var(--font-mono); font-size: 12px; }

/* ── Genome bar ─────────────────────────────────────────────────────────── */
.genome-bar-wrap { display: flex; align-items: center; gap: 8px; }
.genome-bar      { flex: 1; height: 4px; background: var(--bg3); border-radius: 2px; overflow: hidden; min-width: 60px; }
.genome-bar-fill { height: 100%; background: var(--accent); border-radius: 2px; }
.genome-num      { font-family: var(--font-mono); font-size: 12px; color: var(--accent); min-width: 32px; font-weight: 500; }

/* ── Section label ──────────────────────────────────────────────────────── */
.section-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text3); margin-bottom: 8px;
}

/* ── Footer ─────────────────────────────────────────────────────────────── */
footer {
  margin-top: 80px; border-top: 1px solid var(--border);
  padding: 32px 24px; color: var(--text3); font-size: 12px;
  display: flex; justify-content: space-between; align-items: center;
}
footer a { color: var(--text3); }
footer a:hover { color: var(--text2); }

/* ── Animations ─────────────────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up   { animation: fadeUp 0.45s ease both; }
.fade-up-2 { animation: fadeUp 0.45s 0.07s ease both; }
.fade-up-3 { animation: fadeUp 0.45s 0.14s ease both; }
.fade-up-4 { animation: fadeUp 0.45s 0.21s ease both; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav-search, .nav-kingdom { display: none; }
  .stat-grid { grid-template-columns: repeat(2,1fr); }
  .container, .container-narrow { padding: 0 16px; }
}
