/* style.css — SnapGene 文件解析 */
*, *::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; }

/* 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; }

/* 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); }

/* 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; }

/* Section title between blocks */
.section-title { font-size: .85rem; font-weight: 700; color: var(--gray-700); margin: 18px 0 8px; }

/* Sequence box */
.seq-box {
  background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: .76rem; line-height: 1.7; word-break: break-all;
  max-height: 160px; overflow: auto; color: var(--gray-700);
}
.mono { font-family: "SF Mono", "Cascadia Code", Consolas, monospace; }

/* Tables */
.table-wrap { max-height: 500px; overflow: auto; border: 1px solid var(--gray-100); border-radius: var(--radius-sm); }
.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: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qual-cell { font-size: .74rem; color: var(--gray-500); max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strand-pos { color: var(--green); font-weight: 600; }
.strand-neg { color: var(--red); font-weight: 600; }
.type-chip { display: inline-block; padding: 1px 8px; border-radius: 20px; background: var(--blue-bg); color: var(--blue); font-size: .72rem; font-weight: 600; }

/* 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; }
  .hero-section h1 { font-size: 1.2rem; }
  .hero-desc { font-size: .8rem; }
  .card-body { padding: 12px 14px; }
  .btn-run { padding: 12px; font-size: .94rem; }
  .hap-table { font-size: .7rem; }
  .hap-table th, .hap-table td { padding: 4px 6px; }
  .upload-zone { padding: 24px 12px; }
}
@media (max-width: 380px) {
  .header-inner { padding: 0 8px; }
  .main { padding: 14px 8px 28px; }
  .nav-badge { font-size: .68rem; padding: 2px 6px; }
}
