/* Page-specific styles. Hero card, jobs table, build wizard, job detail. */

/* === Page header — quieter than the original. The 36px h2 set a marketing-
   site tone; 22px reads like a tool. The eyebrow slug above is optional and
   shows section context (e.g. "Workspace") in tighter weight. === */
.page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: var(--space-7);
  gap: var(--space-4);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}
.page-header-text h2 {
  font-size: var(--text-xl);            /* 22px */
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tight);
  margin-bottom: 4px;
  color: var(--text-primary);
}
.page-header-text p {
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}
.page-header-eyebrow {
  font-size: 11px;
  font-weight: var(--weight-semibold);
  color: var(--text-tertiary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

/* === Hero — quieter than v1. The gradient block + radial blob were the
   most "AI saas template" thing on the page. We swapped it for a neutral
   surface with crisp typography and an accent kicker line. The page no
   longer SHOUTS at the user when they land. === */
.hero-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-8) var(--space-8) var(--space-7);
  margin-bottom: var(--space-7);
  position: relative;
}
/* Single-pixel accent stripe reads as "branded but not loud". Sits flush
   with the card's left edge under the rounded corner so it's a clean line. */
.hero-card::before {
  content: '';
  position: absolute;
  left: 0; top: 16px; bottom: 16px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}
.hero-content { max-width: 620px; padding-left: var(--space-3); }
.hero-eyebrow {
  font-size: 11px;
  font-weight: var(--weight-semibold);
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.hero-title {
  font-size: var(--text-2xl);          /* 28px — refined, not marketing-page */
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-snug);
  margin-bottom: 8px;
  color: var(--text-primary);
}
.hero-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-5);
  line-height: var(--leading-relaxed);
  max-width: 560px;
}
.hero-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

/* === Jobs table === */
.jobs-table { width: 100%; border-collapse: collapse; }
.jobs-table th {
  text-align: left; font-size: 11px; font-weight: var(--weight-semibold);
  color: var(--text-tertiary); text-transform: uppercase;
  letter-spacing: 0.05em; padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}
.jobs-table td {
  padding: 12px var(--space-4); font-size: var(--text-sm);
  border-bottom: 1px solid var(--border-subtle); vertical-align: middle;
}
.jobs-table tr:last-child td { border-bottom: none; }
.jobs-table tbody tr {
  cursor: pointer;
  transition: background var(--duration-fast);
}
.jobs-table tbody tr:hover { background: var(--bg-hover); }

.job-name-cell { display: flex; align-items: center; gap: var(--space-3); }
.job-avatar {
  width: 34px; height: 34px; border-radius: var(--radius-md);
  background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.job-avatar svg { width: 16px; height: 16px; color: var(--accent); stroke-width: 1.6; }
.time-ago { color: var(--text-tertiary); font-size: var(--text-xs); }

/* === Build wizard === */
.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5); }
@media (max-width: 768px) { .upload-grid { grid-template-columns: 1fr; } }

.upload-section-label {
  margin-bottom: var(--space-2);
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
  display: flex; align-items: center; gap: var(--space-2);
}

.config-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: var(--space-5) var(--space-8);
}
@media (max-width: 640px) { .config-grid { grid-template-columns: 1fr; } }

.review-section { display: flex; flex-direction: column; }
.review-row {
  display: flex; align-items: center; gap: var(--space-4);
  padding: 12px 0; border-bottom: 1px solid var(--border-subtle);
}
.review-row:last-child { border-bottom: none; }
.review-label {
  font-size: var(--text-sm); color: var(--text-tertiary);
  min-width: 150px;
}
.review-value { font-size: var(--text-sm); font-weight: var(--weight-medium); }

.step-panel { display: none; }
.step-panel.active { display: block; }
.step-actions {
  display: flex; justify-content: space-between;
  margin-top: var(--space-8); padding-top: var(--space-5);
  border-top: 1px solid var(--border-subtle);
}

.ligand-mode-section {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--space-5);
}

/* === 3D structure viewer ===
   Layout: header (controls) + body (3D + 2D side panel) + sequence strip + legend.
   The whole panel can go fullscreen via the Fullscreen API; CSS reflows the
   body to fill 100vh.
*/
.viewer-panel {
  margin-top: var(--space-6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  overflow: hidden;
  display: flex; flex-direction: column;
}

/* Header */
.viewer-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-3);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  flex-wrap: wrap;
}
.viewer-title {
  display: flex; align-items: baseline; gap: var(--space-3);
  min-width: 0;
}
.viewer-title-text {
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
}
.viewer-title-meta {
  font-size: var(--text-xs); color: var(--text-tertiary);
  font-feature-settings: "tnum";
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.viewer-controls {
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
}

/* Segmented control (Cartoon / Surface) — Apple-style toggle */
.seg-group {
  display: inline-flex;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 2px;
}
.seg-btn {
  padding: 4px 12px;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
  border: none;
  transition: background var(--duration-fast), color var(--duration-fast);
}
.seg-btn:hover { color: var(--text-primary); }
.seg-btn.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.04);
}
[data-theme="dark"] .seg-btn.active {
  box-shadow: 0 0 0 1px rgba(255,255,255,0.1);
}

/* Auxiliary buttons (Reset, Spin, Fullscreen) */
.viewer-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--duration-fast), color var(--duration-fast);
}
.viewer-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.viewer-btn.active { background: var(--accent-soft); color: var(--accent); }
.viewer-btn svg { width: 14px; height: 14px; stroke-width: 1.6; }
.viewer-btn-icon { padding: 6px; }
.viewer-btn-icon svg { width: 16px; height: 16px; }

/* Body: 3D canvas + 2D side panel */
.viewer-body {
  display: grid;
  grid-template-columns: 1fr 280px;
  background: var(--bg-base);
  flex: 1; min-height: 0;
}
@media (max-width: 768px) {
  .viewer-body { grid-template-columns: 1fr; }
  .viewer-side { border-left: none; border-top: 1px solid var(--border-subtle); }
}

.viewer-main { position: relative; min-width: 0; }
.viewer-canvas {
  position: relative;
  width: 100%;
  height: 460px;
  background: #0b0d12;
}
.viewer-canvas canvas { outline: none; display: block; }

.viewer-empty {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.45);
  font-size: var(--text-sm);
  pointer-events: none;
  text-align: center; padding: 0 var(--space-6);
}
.viewer-loading {
  position: absolute; top: 10px; right: 10px;
  padding: 4px 10px;
  font-size: var(--text-xs);
  background: rgba(0,0,0,0.55);
  color: white;
  border-radius: var(--radius-sm);
  display: none;
  backdrop-filter: blur(6px);
}
.viewer-loading.active { display: block; }

/* Tooltip that follows the mouse over the 3D canvas to show residue info */
.viewer-residue-tip {
  position: absolute;
  pointer-events: none;
  padding: 4px 8px;
  background: rgba(0,0,0,0.78);
  color: white;
  font-size: 11px;
  font-family: var(--font-mono);
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, -130%);
  transition: opacity 100ms ease;
}
.viewer-residue-tip.active { opacity: 1; }

/* 2D ligand side panel */
.viewer-side {
  border-left: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  display: flex; flex-direction: column;
  min-width: 0;
}
.viewer-side-title {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 11px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}
.ligand2d-stack {
  flex: 1;
  padding: var(--space-3);
  display: flex; flex-direction: column; gap: var(--space-3);
  overflow-y: auto;
}
.ligand2d-empty {
  margin: auto;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  text-align: center;
  padding: var(--space-6);
}
.ligand2d-card {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  padding: 8px;
  display: flex; flex-direction: column; gap: 6px;
}
.ligand2d-header {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px;
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
}
.ligand2d-swatch {
  width: 8px; height: 8px; border-radius: 2px;
  flex-shrink: 0;
}
.ligand2d-name {
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--text-primary);
  font-family: var(--font-mono); font-size: 11px;
}
.ligand2d-svg {
  display: flex; align-items: center; justify-content: center;
  background: white;
  border-radius: 4px;
  min-height: 140px;
  padding: 4px;
}
.ligand2d-svg svg {
  max-width: 100%; max-height: 220px; height: auto;
  display: block;
}
.ligand2d-error {
  font-size: 11px;
  color: var(--status-warning);
  background: rgba(255,159,10,0.08);
  border-radius: 4px;
  padding: 8px;
  text-align: center;
}

/* Sequence strip — protein chains as 1-letter code, hoverable residues */
.viewer-sequence {
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  max-height: 156px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
}
.viewer-sequence:empty { display: none; }
.seq-chain { padding: 8px 14px; border-bottom: 1px solid var(--border-subtle); }
.seq-chain:last-child { border-bottom: none; }
.seq-chain-head {
  display: flex; align-items: center; gap: var(--space-2);
  margin-bottom: 4px;
  font-size: 11px;
  font-family: var(--font-sans);
  color: var(--text-tertiary);
  font-weight: var(--weight-medium);
}
.seq-chain-tag {
  display: inline-flex;
  width: 16px; height: 16px;
  border-radius: 3px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: var(--weight-semibold);
  align-items: center; justify-content: center;
  font-size: 10px;
}
.seq-chain-len { color: var(--text-tertiary); }
.seq-residues {
  display: flex; flex-wrap: wrap;
  word-break: break-all;
  letter-spacing: 0.05em;
}
.seq-res {
  display: inline-block;
  padding: 0 1px;
  cursor: pointer;
  color: var(--text-secondary);
  border-radius: 2px;
  transition: background var(--duration-fast), color var(--duration-fast);
}
.seq-res:hover {
  background: var(--accent);
  color: white;
}
.seq-res.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.seq-res-tickmark {
  /* every 10th residue gets a thin top accent */
  border-top: 2px solid var(--border-strong);
}
.seq-empty { padding: var(--space-4); color: var(--text-tertiary); font-size: 11px; font-family: var(--font-sans); }

/* Legend strip */
.viewer-legend {
  display: flex; gap: var(--space-4);
  padding: 8px 14px;
  border-top: 1px solid var(--border-subtle);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  background: var(--bg-elevated);
  flex-wrap: wrap;
}
.viewer-legend:empty { display: none; }
.viewer-legend-item { display: flex; align-items: center; gap: 6px; }
.viewer-legend-swatch {
  width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0;
}

/* Inline error banner (CDN failures, RDKit init failures, etc.) */
.viewer-error {
  margin: 0 14px var(--space-3);
  padding: 8px 10px;
  background: rgba(255,59,48,0.08);
  border: 1px solid rgba(255,59,48,0.25);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  color: var(--status-error);
  display: none;
}
.viewer-error.active { display: block; }

/* Fullscreen — when the panel is fullscreen, expand to fill viewport. */
.viewer-panel:fullscreen {
  border-radius: 0;
  border: none;
  background: var(--bg-elevated);
}
.viewer-panel:fullscreen .viewer-canvas { height: 100%; }
.viewer-panel:fullscreen .viewer-body { flex: 1; }
.viewer-panel:fullscreen .viewer-side { width: 320px; }
.viewer-panel:-webkit-full-screen { background: var(--bg-elevated); }
.viewer-panel:-webkit-full-screen .viewer-canvas { height: 100%; }

/* === Jobs list === */
.jobs-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-3); margin-bottom: var(--space-5); flex-wrap: wrap;
}
.search-box {
  display: flex; align-items: center; gap: var(--space-2);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 7px 12px; width: 260px;
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}
.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-box svg { width: 14px; height: 14px; color: var(--text-tertiary); flex-shrink: 0; stroke-width: 1.6; }
.search-box input {
  border: none; outline: none; background: none;
  font-size: var(--text-sm); width: 100%;
  color: var(--text-primary);
}
.search-box input::placeholder { color: var(--text-tertiary); }

.filter-tabs {
  display: flex; gap: 2px;
  background: var(--bg-input);
  padding: 2px; border-radius: var(--radius-sm);
}
.filter-tab {
  padding: 5px 12px;
  font-size: var(--text-xs); font-weight: var(--weight-medium);
  color: var(--text-secondary);
  border-radius: 6px; cursor: pointer;
  transition: background var(--duration-fast), color var(--duration-fast);
  background: transparent; border: none;
}
.filter-tab:hover { color: var(--text-primary); }
.filter-tab.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: 0 1px 1px rgba(0,0,0,0.04), 0 0 0 1px rgba(0,0,0,0.04);
}
[data-theme="dark"] .filter-tab.active {
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08);
}

/* Slimmer job cards. Dropped the tall stacked status column on the right;
   status + time + progress now sit on one row to save vertical space. */
.jobs-list { display: flex; flex-direction: column; gap: 8px; }
.job-card {
  padding: 12px var(--space-4);
  display: flex; align-items: center; gap: var(--space-3);
  cursor: pointer;
  border-radius: var(--radius-md);
}
.job-card:hover { border-color: var(--border-strong); }
.job-card-info { flex: 1; min-width: 0; }
.job-card-name {
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
  margin-bottom: 2px;
  letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.job-card-detail {
  font-size: var(--text-xs); color: var(--text-tertiary);
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
}
.job-card-detail > span:not(:last-child)::after {
  content: '·';
  margin-left: 8px;
  color: var(--border-strong);
}
.job-card-right {
  display: flex; align-items: center; gap: var(--space-3);
  flex-shrink: 0;
}
.job-card-progress { width: 100px; }
.job-card .job-avatar {
  width: 30px; height: 30px;
  background: transparent;
  border: 1px solid var(--border-strong);
}
.job-card .job-avatar svg { color: var(--text-secondary); }

/* === Job detail === */
.detail-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--space-6); margin-bottom: var(--space-6);
}
.detail-title-group { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.detail-meta { display: flex; gap: var(--space-5); margin-top: var(--space-3); flex-wrap: wrap; }
.detail-meta-item {
  font-size: var(--text-sm); color: var(--text-tertiary);
  display: flex; align-items: center; gap: 5px;
}
.detail-meta-item svg { width: 14px; height: 14px; stroke-width: 1.6; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-6); }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }
.files-grid { display: flex; flex-direction: column; gap: var(--space-2); }
.file-sub { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }

/* Output directory tree (PRISM produces GMX_PROLIG_*, mdps/, *.amb2gmx, etc.) */
.dir-tree { display: flex; flex-direction: column; gap: var(--space-3); margin-top: var(--space-3); }
.dir-block {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-elevated);
}
.dir-summary {
  cursor: pointer;
  list-style: none;
  display: flex; align-items: center; gap: var(--space-2);
  padding: 10px 14px;
  font-size: var(--text-sm);
  color: var(--text-primary);
  background: var(--bg-base);
  user-select: none;
  border-bottom: 1px solid transparent;
}
.dir-block[open] .dir-summary { border-bottom-color: var(--border-subtle); }
.dir-summary::-webkit-details-marker { display: none; }
.dir-summary::before {
  content: '▸';
  font-size: 10px;
  color: var(--text-tertiary);
  transition: transform var(--duration-fast);
  width: 12px; text-align: center;
}
.dir-block[open] > .dir-summary::before { transform: rotate(90deg); }
.dir-summary svg { width: 14px; height: 14px; color: var(--text-secondary); flex-shrink: 0; }
.dir-name { font-weight: var(--weight-medium); font-family: var(--font-mono); font-size: 12px; }
.dir-count { font-size: 11px; color: var(--text-tertiary); margin-left: auto; }
.dir-files { padding: var(--space-3); gap: var(--space-1); }
.dir-empty { font-size: 11px; color: var(--text-tertiary); padding: var(--space-2) var(--space-1); }
.dir-truncated {
  margin-top: var(--space-3);
  padding: 8px 12px;
  font-size: var(--text-xs);
  color: var(--status-warning);
  background: rgba(255,159,10,0.08);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; gap: var(--space-2);
}
.dir-truncated svg { width: 14px; height: 14px; flex-shrink: 0; }

/* Job-detail polish: card-header w/ trailing action button */
.detail-error-card { border-color: rgba(255,59,48,0.35); }
.detail-error-row { color: var(--status-error); }
.detail-error-row svg { width: 18px; height: 18px; flex-shrink: 0; }
.detail-error-title { font-weight: var(--weight-semibold); font-size: var(--text-sm); }
.detail-error-msg { font-size: var(--text-xs); color: var(--text-secondary); margin-top: 2px; word-break: break-word; }

.log-meta { font-size: var(--text-xs); color: var(--text-tertiary); font-family: var(--font-mono); }
.log-viewer { scroll-behavior: smooth; }
