/* nanopore.css — Nanopore 单倍型分析 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --ink: #1a1a2e; --ink-light: #4a5568;
  --blue: #2F6BFF; --blue-light: #4FB6FF; --blue-bg: #EAF1FF;
  --green: #16a34a; --green-bg: #f0fdf4;
  --red: #e11d48; --red-bg: #fef2f2;
  --gray-50: #f9fafb; --gray-100: #f3f4f6; --gray-200: #e5e7eb;
  --gray-300: #d1d5db; --gray-500: #6b7280; --gray-700: #374151;
  --gray-900: #111827;
  --white: #fff; --surface: #f8fafc;
  --radius: 10px; --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.06);
}

html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  background: var(--surface); color: var(--ink); line-height: 1.6;
  min-height: 100vh;
}

/* Header — matches gene search */
.header {
  background: linear-gradient(135deg, var(--ink) 0%, #1e293b 100%);
  color: var(--white); position: sticky; top: 0; z-index: 100;
}
.header-inner { max-width: 1200px; margin: 0 auto; padding: 0 24px; height: 56px; display: flex; align-items: center; justify-content: space-between; }
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--white); }
.logo-icon-svg { flex-shrink: 0; }
.logo-text { font-size: 1.1rem; font-weight: 400; }
.logo-text strong { font-weight: 700; }
.header-nav { display: flex; gap: 8px; }
.nav-badge { background: rgba(255,255,255,.12); color: var(--white); padding: 4px 12px; border-radius: 20px; font-size: .82rem; text-decoration: none; transition: background .15s; }
.nav-badge:hover { background: rgba(255,255,255,.2); }

/* Main */
.main { max-width: 1200px; margin: 0 auto; padding: 32px 24px 48px; }

.hero-section { text-align: center; margin-bottom: 28px; }
.hero-section h1 { font-size: 1.6rem; font-weight: 700; color: var(--ink); }
.hero-desc { margin-top: 6px; color: var(--gray-500); font-size: .92rem; }

/* Method tabs */
.method-card { margin-bottom: 24px; }
.method-tabs { display: flex; gap: 10px; }
.method-tab {
  flex: 1; padding: 16px 20px; border: 2px solid var(--gray-200); border-radius: var(--radius);
  background: var(--white); cursor: pointer; text-align: left; transition: border-color .15s, box-shadow .15s;
}
.method-tab:hover { border-color: var(--blue); }
.method-tab.active { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47,107,255,.12); }
.method-icon { font-size: 1.3rem; display: block; margin-bottom: 4px; }
.method-label { font-size: .92rem; font-weight: 700; color: var(--ink); }
.method-hint { font-size: .78rem; color: var(--gray-500); display: block; margin-top: 2px; }

/* Main grid */
.main-grid { display: grid; grid-template-columns: 400px 1fr; gap: 24px; align-items: start; }
.col-upload { display: flex; flex-direction: column; gap: 16px; }
.col-results { display: flex; flex-direction: column; gap: 16px; }

/* Cards */
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-header { padding: 14px 18px; border-bottom: 1px solid var(--gray-100); }
.card-header h2 { font-size: .9rem; font-weight: 700; color: var(--gray-700); }
.card-body { padding: 16px 18px; }

/* Upload zone */
.upload-zone {
  border: 2px dashed var(--gray-300); border-radius: var(--radius);
  padding: 40px 20px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s;
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--blue); background: var(--blue-bg); }
.upload-icon { font-size: 2.2rem; margin-bottom: 8px; }
.upload-text { font-size: .92rem; color: var(--ink); margin-bottom: 4px; }
.upload-hint { font-size: .78rem; color: var(--gray-500); }
.upload-info { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.upload-filename { font-weight: 600; font-size: .88rem; }
.upload-filesize { font-size: .78rem; color: var(--gray-500); }
.btn-text-only { background: none; border: none; color: var(--red); cursor: pointer; font-size: .8rem; }

/* Form elements */
.form-row { margin-bottom: 14px; }
.form-row:last-child { margin-bottom: 0; }
.form-label { display: block; font-size: .82rem; font-weight: 600; color: var(--gray-700); margin-bottom: 4px; }
.form-input, .form-select {
  width: 100%; padding: 8px 12px; font-size: .88rem; border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm); outline: none; background: var(--white);
  transition: border-color .15s;
}
.form-input:focus, .form-select:focus { border-color: var(--blue); }
.form-input.mono { font-family: "SF Mono", "Cascadia Code", Consolas, monospace; font-size: .82rem; }
.form-input-sm { max-width: 120px; }
.form-row-inline { display: flex; gap: 16px; }
.form-row-inline > div { flex: 1; }
.form-select { padding: 8px 10px; cursor: pointer; }

/* Run button */
.btn-run {
  width: 100%; padding: 14px; font-size: 1rem; font-weight: 700;
  background: linear-gradient(135deg, var(--blue), #1a5af0);
  color: var(--white); border: none; border-radius: var(--radius);
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: opacity .15s, transform .1s;
}
.btn-run:hover { opacity: .92; transform: translateY(-1px); }
.btn-run:active { transform: translateY(0); }
.btn-run:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.3); border-top-color: var(--white); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.status-msg { padding: 10px 14px; border-radius: var(--radius-sm); font-size: .85rem; text-align: center; }
.status-msg.loading { background: var(--blue-bg); color: var(--blue); }
.status-msg.error { background: var(--red-bg); color: var(--red); }
.status-msg.success { background: var(--green-bg); color: var(--green); }

/* Download button */
.btn-download {
  padding: 6px 14px; font-size: .82rem; font-weight: 600;
  background: var(--green); color: var(--white); border: none;
  border-radius: var(--radius-sm); cursor: pointer; transition: opacity .15s;
}
.btn-download:hover { opacity: .9; }

/* Summary grid */
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 16px; }
.summary-item { background: var(--gray-50); border-radius: var(--radius-sm); padding: 10px 12px; text-align: center; }
.summary-item .val { font-size: 1.2rem; font-weight: 700; color: var(--ink); }
.summary-item .lbl { font-size: .72rem; color: var(--gray-500); margin-top: 2px; }

/* Haplotype table */
.table-wrap { max-height: 500px; overflow-y: auto; }
.hap-table { width: 100%; font-size: .82rem; border-collapse: collapse; }
.hap-table th {
  text-align: left; padding: 8px 10px; background: var(--gray-50);
  color: var(--gray-700); font-weight: 600; font-size: .78rem;
  position: sticky; top: 0; border-bottom: 1px solid var(--gray-200);
}
.hap-table td { padding: 8px 10px; border-bottom: 1px solid var(--gray-100); color: var(--gray-700); }
.hap-table tr:hover td { background: var(--gray-50); }
.hap-seq { font-family: "SF Mono", "Cascadia Code", Consolas, monospace; font-size: .73rem; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hap-table .bar-cell { width: 120px; }
.hap-bar { height: 6px; background: var(--gray-200); border-radius: 3px; overflow: hidden; }
.hap-bar-fill { height: 100%; border-radius: 3px; background: var(--blue); transition: width .3s; }

/* Empty state */
.empty-state { text-align: center; padding: 40px 20px; }
.empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-title { font-size: 1rem; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
.empty-desc { font-size: .85rem; color: var(--gray-500); line-height: 1.7; }

/* Error state inside table */
.error-row td { text-align: center; color: var(--gray-500); padding: 24px; }

/* Responsive */
@media (max-width: 860px) {
  .main-grid { grid-template-columns: 1fr; }
  .hero-section h1 { font-size: 1.3rem; }
}
@media (max-width: 540px) {
  .header-inner { padding: 0 12px; }
  .main { padding: 20px 12px 36px; }
  .method-tabs { flex-direction: column; }
}
