/* ── hw-model-scout — dark theme ── */

:root {
  --bg: #0e0f14;
  --bg2: #141620;
  --bg3: #1c1e2e;
  --bg4: #232538;
  --border: #2a2d42;
  --border2: #353858;
  --accent: #6c63ff;
  --accent2: #8b83ff;
  --accent-glow: rgba(108, 99, 255, 0.25);
  --green: #3ddc97;
  --yellow: #f5c542;
  --red: #ff6b6b;
  --orange: #ff9a3c;
  --text: #e8eaf6;
  --text2: #9ea3c0;
  --text3: #5c6080;
  --radius: 10px;
  --radius-sm: 6px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

/* ── Header ── */
.header {
  background: linear-gradient(135deg, var(--bg2) 0%, var(--bg3) 100%);
  border-bottom: 1px solid var(--border);
  padding: 18px 24px;
}
.header-inner { max-width: 1600px; margin: 0 auto; }

.logo { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.logo-icon { font-size: 22px; }
.logo-text { font-size: 20px; font-weight: 700; color: var(--text); letter-spacing: -0.3px; }
.logo-badge {
  font-size: 10px; font-weight: 600; letter-spacing: 1px;
  background: var(--accent); color: #fff;
  padding: 2px 7px; border-radius: 4px; text-transform: uppercase;
}
.tagline { color: var(--text2); font-size: 13px; }

/* ── Main layout ── */
.main {
  display: grid;
  grid-template-columns: 280px 1fr 260px;
  gap: 0;
  max-width: 1600px;
  margin: 0 auto;
  min-height: calc(100vh - 100px);
}

.panel {
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
.panel-config { padding: 20px 16px; background: var(--bg2); }
.panel-results { padding: 20px; background: var(--bg); }
.panel-side { padding: 20px 16px; background: var(--bg2); border-right: none; }

/* ── Config sections ── */
.config-section { margin-bottom: 24px; }
.section-title {
  font-size: 13px; font-weight: 600; color: var(--text2);
  text-transform: uppercase; letter-spacing: 0.8px;
  margin-bottom: 14px; display: flex; align-items: center; gap: 6px;
}
.section-icon { font-size: 15px; }

.field-group { margin-bottom: 14px; }
.field-group.half { flex: 1; }
.field-row { display: flex; gap: 10px; }
.field-label { display: block; font-size: 12px; color: var(--text2); margin-bottom: 6px; font-weight: 500; }
.field-hint { font-size: 11px; color: var(--text3); margin-top: 4px; display: block; }

.select-wrap { position: relative; }
.select, .input {
  width: 100%; padding: 8px 10px;
  background: var(--bg3); border: 1px solid var(--border2);
  color: var(--text); border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 13px;
  transition: border-color 0.2s;
  appearance: none; -webkit-appearance: none;
}
.select:focus, .input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.select-wrap::after {
  content: '▾'; position: absolute; right: 10px; top: 50%;
  transform: translateY(-50%); color: var(--text2); pointer-events: none; font-size: 12px;
}

.manual-specs { margin-top: 10px; }

/* Toggle rows */
.toggle-row {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.toggle-btn {
  padding: 5px 12px; border-radius: var(--radius-sm);
  background: var(--bg3); border: 1px solid var(--border2);
  color: var(--text2); cursor: pointer; font-size: 12px;
  font-family: var(--font); transition: all 0.15s;
}
.toggle-btn:hover { border-color: var(--accent); color: var(--text); }
.toggle-btn.active {
  background: var(--accent); border-color: var(--accent);
  color: #fff; font-weight: 600;
}

/* Workload grid */
.workload-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.workload-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 6px; background: var(--bg3); border: 1px solid var(--border2);
  color: var(--text2); cursor: pointer; border-radius: var(--radius-sm);
  font-family: var(--font); transition: all 0.15s;
}
.workload-btn:hover { border-color: var(--accent); color: var(--text); }
.workload-btn.active { background: var(--bg4); border-color: var(--accent); color: var(--accent2); }
.wb-icon { font-size: 18px; }
.wb-label { font-size: 11px; font-weight: 500; }

/* Slider */
.slider-row { display: flex; align-items: center; gap: 10px; }
.slider-label { font-size: 11px; color: var(--text3); white-space: nowrap; }
.slider { flex: 1; accent-color: var(--accent); }
.priority-hint { font-size: 12px; color: var(--accent2); float: right; }

/* Run button */
.run-btn {
  width: 100%; padding: 12px; margin-top: 8px;
  background: var(--accent); border: none; border-radius: var(--radius);
  color: #fff; font-size: 14px; font-weight: 700; cursor: pointer;
  font-family: var(--font); letter-spacing: 0.2px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all 0.15s;
}
.run-btn:hover { background: var(--accent2); transform: translateY(-1px); }
.run-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.spinner {
  width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff; border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Profile actions */
.profile-actions { display: flex; gap: 8px; margin-top: 10px; }
.input-sm { height: 32px; font-size: 12px; padding: 4px 8px; }
.btn-sm {
  padding: 6px 12px; background: var(--bg3); border: 1px solid var(--border2);
  color: var(--text2); cursor: pointer; border-radius: var(--radius-sm);
  font-size: 12px; font-family: var(--font); white-space: nowrap;
  transition: all 0.15s;
}
.btn-sm:hover { border-color: var(--accent); color: var(--accent2); }

/* ── Results ── */
.results-empty {
  text-align: center; padding: 80px 40px; color: var(--text2);
}
.empty-icon { font-size: 48px; margin-bottom: 16px; }
.results-empty h3 { font-size: 18px; color: var(--text); margin-bottom: 10px; font-weight: 500; }
.results-empty em { color: var(--accent2); font-style: normal; }
.results-empty p { color: var(--text2); line-height: 1.6; }

.results-header { margin-bottom: 12px; }
.results-title { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.hw-summary { display: flex; gap: 8px; flex-wrap: wrap; }
.hw-chip {
  background: var(--bg3); border: 1px solid var(--border2);
  padding: 3px 10px; border-radius: 20px; font-size: 12px; color: var(--text2);
}
.results-note { font-size: 11px; color: var(--text3); margin-bottom: 16px; font-style: italic; }

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
}

/* Result cards */
.result-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  position: relative; transition: border-color 0.2s, box-shadow 0.2s;
}
.result-card:hover { border-color: var(--border2); box-shadow: 0 4px 20px rgba(0,0,0,0.3); }
.result-card-top {
  border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 4px 24px var(--accent-glow);
}

.top-badge {
  position: absolute; top: -10px; left: 16px;
  background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700; padding: 2px 10px; border-radius: 10px;
  letter-spacing: 0.3px;
}

.card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.card-model-name { font-size: 15px; font-weight: 700; margin-bottom: 2px; line-height: 1.3; }
.card-arch { font-size: 11px; color: var(--text3); }

.score-circle {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--bg4); border: 2px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; color: var(--accent2);
  flex-shrink: 0;
}

.card-metrics { display: flex; gap: 12px; margin-bottom: 12px; }
.metric { text-align: center; flex: 1; }
.metric-value { display: block; font-size: 18px; font-weight: 800; line-height: 1; }
.metric-label { font-size: 10px; color: var(--text3); margin-top: 2px; display: block; text-transform: uppercase; }

/* Speed classes */
.speed-fast { color: var(--green); }
.speed-mid  { color: var(--yellow); }
.speed-slow { color: var(--orange); }
.quality-elite { color: var(--green); }
.quality-high  { color: var(--accent2); }
.quality-mid   { color: var(--yellow); }
.quality-low   { color: var(--orange); }

/* Quant chips */
.card-quant-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.quant-label { font-size: 11px; color: var(--text3); white-space: nowrap; }
.quant-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.quant-chip {
  padding: 3px 8px; font-size: 11px; border-radius: 4px;
  background: var(--bg3); border: 1px solid var(--border2);
  color: var(--text3); cursor: pointer; font-family: var(--mono);
  transition: all 0.12s;
}
.quant-chip:hover { border-color: var(--accent); color: var(--text); }
.quant-selected { background: var(--bg4); border-color: var(--accent); color: var(--accent2); }

.card-explanation { font-size: 12px; color: var(--text2); margin-bottom: 12px; line-height: 1.5; }

.card-command-wrap {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--border2);
  border-radius: var(--radius-sm); padding: 6px 10px;
  margin-bottom: 10px;
}
.card-command {
  flex: 1; font-family: var(--mono); font-size: 12px; color: var(--green);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.copy-btn {
  background: none; border: none; color: var(--text2); cursor: pointer;
  font-size: 16px; padding: 0 4px; transition: color 0.15s;
}
.copy-btn:hover { color: var(--accent); }

.card-footer { display: flex; justify-content: space-between; align-items: center; }
.card-link {
  font-size: 12px; color: var(--accent2); text-decoration: none;
}
.card-link:hover { text-decoration: underline; }
.card-details-btn {
  background: none; border: 1px solid var(--border2); color: var(--text2);
  padding: 4px 10px; border-radius: var(--radius-sm); font-size: 11px;
  cursor: pointer; font-family: var(--font); transition: all 0.15s;
}
.card-details-btn:hover { border-color: var(--accent); color: var(--accent2); }

.no-results { color: var(--text2); text-align: center; padding: 40px; font-size: 15px; }

/* ── Side panel ── */
.side-section { margin-bottom: 28px; }
.side-title {
  font-size: 12px; font-weight: 600; color: var(--text2);
  text-transform: uppercase; letter-spacing: 0.8px;
  margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center;
}
.news-status { font-size: 10px; color: var(--text3); font-weight: 400; text-transform: none; letter-spacing: 0; }
.side-empty { font-size: 12px; color: var(--text3); }

/* Profiles */
.profiles-list { display: flex; flex-direction: column; gap: 6px; }
.profile-item { display: flex; align-items: stretch; border: 1px solid var(--border2); border-radius: var(--radius-sm); overflow: hidden; }
.profile-load {
  flex: 1; background: none; border: none; text-align: left; cursor: pointer;
  padding: 8px 10px; color: var(--text); display: flex; flex-direction: column; gap: 2px;
}
.profile-load:hover { background: var(--bg3); }
.profile-name { font-size: 13px; font-weight: 500; }
.profile-spec { font-size: 11px; color: var(--text3); }
.profile-delete {
  background: none; border: none; border-left: 1px solid var(--border2);
  color: var(--text3); cursor: pointer; padding: 0 10px; font-size: 14px;
  transition: all 0.15s;
}
.profile-delete:hover { background: rgba(255,107,107,0.1); color: var(--red); }

/* News */
.news-list { display: flex; flex-direction: column; gap: 8px; }
.news-item {
  display: block; text-decoration: none; color: var(--text);
  padding: 8px 10px; background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); transition: all 0.15s;
}
.news-item:hover { border-color: var(--accent); background: var(--bg4); }
.news-source { display: block; font-size: 10px; color: var(--accent2); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 3px; }
.news-title { display: block; font-size: 12px; line-height: 1.4; color: var(--text); }
.news-age { display: block; font-size: 10px; color: var(--text3); margin-top: 3px; }

/* ── Modal ── */
.modal {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); }
.modal-box {
  position: relative; background: var(--bg2); border: 1px solid var(--border2);
  border-radius: 12px; padding: 28px; max-width: 520px; width: 90%;
  max-height: 80vh; overflow-y: auto; z-index: 1;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.modal-close {
  position: absolute; top: 12px; right: 14px;
  background: none; border: none; color: var(--text2); font-size: 18px;
  cursor: pointer; padding: 4px 8px;
}
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.modal-meta { font-size: 12px; color: var(--text2); margin-bottom: 6px; }
.modal-hf-link { font-size: 13px; color: var(--accent2); text-decoration: none; display: block; margin-bottom: 18px; }
.modal-hf-link:hover { text-decoration: underline; }
.modal-sub { font-size: 13px; font-weight: 600; color: var(--text2); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.5px; }
.modal-note { font-size: 11px; color: var(--text3); margin-top: 12px; font-style: italic; }

.quant-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.quant-table th { text-align: left; padding: 6px 8px; color: var(--text2); font-weight: 600; border-bottom: 1px solid var(--border); }
.quant-table td { padding: 7px 8px; border-bottom: 1px solid var(--border); }
.quant-table tr:last-child td { border-bottom: none; }
.quant-name { font-family: var(--mono); color: var(--text); }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  padding: 10px 18px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; z-index: 9999;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  animation: slideIn 0.2s ease;
}
.toast-info    { background: var(--bg4); border: 1px solid var(--border2); color: var(--text); }
.toast-success { background: rgba(61,220,151,0.15); border: 1px solid var(--green); color: var(--green); }
.toast-error   { background: rgba(255,107,107,0.15); border: 1px solid var(--red); color: var(--red); }
@keyframes slideIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ── Footer ── */
.footer {
  border-top: 1px solid var(--border); padding: 12px 24px;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  font-size: 11px; color: var(--text3); max-width: 1600px; margin: 0 auto;
}
.footer a { color: var(--text3); text-decoration: none; }
.footer a:hover { color: var(--accent2); }

/* ── Responsive ── */
@media (max-width: 1100px) {
  .main { grid-template-columns: 260px 1fr; }
  .panel-side { display: none; }
}
@media (max-width: 720px) {
  .main { grid-template-columns: 1fr; }
  .panel-config { border-right: none; border-bottom: 1px solid var(--border); }
  .results-grid { grid-template-columns: 1fr; }
}
