/* ── Dashboard supplemental styles (v0.14) ───────────────────────────
   New component styles for scoring bars, gate rows, maker timeline,
   settings cards, help tooltips, and accordion behavior.
   Base styles remain in base.html <style> for backwards compatibility.
   ─────────────────────────────────────────────────────────────────── */

/* ── Settings card accordion ─────────────────────────────────────── */
.settings-card {
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 0;
  margin-bottom: 0;
  overflow: hidden;
  transition: background 0.2s ease;
}
.settings-card:last-of-type {
  border-bottom: none;
}
.settings-card:hover {
  background: rgba(255, 255, 255, 0.02);
  box-shadow: none;
}
.settings-card-header {
  display: flex;
  align-items: center;
  padding: 0.9rem 1rem;
  cursor: pointer;
  user-select: none;
  gap: 0.6rem;
}
.settings-card-header h4 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}
.settings-card-header .tier-badge {
  font-size: 0.58rem;
  padding: 2px 7px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  font-family: var(--mono);
}
.tier-badge.basic { background: rgba(104, 246, 199, 0.10); color: rgba(104, 246, 199, 0.7); }
.tier-badge.advanced { background: rgba(247, 215, 116, 0.10); color: rgba(247, 215, 116, 0.7); }
.tier-badge.expert { background: rgba(255, 91, 110, 0.10); color: rgba(255, 91, 110, 0.7); }

.settings-card-header .chevron {
  transition: transform 0.25s ease;
  color: var(--muted);
  font-size: 0.65rem;
  opacity: 0.5;
}
.settings-card.open .chevron {
  transform: rotate(180deg);
  opacity: 0.8;
}
/* Section hint (shows when collapsed) */
.settings-card-header .section-hint {
  font-size: 0.68rem;
  color: var(--muted);
  font-family: var(--mono);
  opacity: 0.7;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.settings-card.open .settings-card-header .section-hint {
  display: none;
}
.settings-card-body {
  display: none;
  padding: 0 1rem 1rem 1rem;
}
.settings-card.open .settings-card-body {
  display: block;
}

/* ── Help system — inline descriptions ──────────────────────────── */
/* The .help-tip shows a subtle inline description pulled from
   .help-popup-short. The ? circle + hover popup are replaced by
   always-visible text beneath the label. The full popup still
   appears on hover for detailed info. */
.help-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 0.55rem;
  cursor: help;
  margin-left: 4px;
  vertical-align: middle;
  flex-shrink: 0;
  opacity: 0.5;
  transition: opacity 0.15s;
}
.help-tip:hover {
  background: rgba(247, 215, 116, 0.2);
  color: var(--gold);
  opacity: 1;
}
.help-popup {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: #1a1c24;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  min-width: 220px;
  max-width: 320px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}
.help-tip:hover .help-popup,
.help-tip.active .help-popup {
  display: block;
  pointer-events: auto;
}
.help-popup-title {
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--gold);
  margin-bottom: 0.25rem;
  display: block;
}
.help-popup-short {
  font-size: 0.7rem;
  color: var(--text);
  margin-bottom: 0.5rem;
  display: block;
}
.help-popup-detail {
  font-size: 0.65rem;
  color: var(--muted);
  line-height: 1.5;
  display: block;
}

/* ── Inline field descriptions (always visible under label) ──── */
.field-desc {
  display: block;
  font-size: 0.65rem;
  color: var(--muted);
  font-family: var(--mono);
  line-height: 1.4;
  margin-top: -0.15rem;
  opacity: 0.8;
}

/* ── Settings field-row ────────────────────────────────────────── */
.field-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
}
.field-row + .field-row {
  border-top: 1px solid rgba(255, 255, 255, 0.03);
}
/* Text labels get flex-column so .field-desc sits below */
.field-row > label:first-child {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 4px;
  flex: 1;
  font-size: 0.76rem;
  color: var(--text);
}
/* Toggle labels inside field-row should NOT flex-grow */
.field-row > label.toggle {
  flex: none;
}
/* Hide the ? circle in Settings tab — replaced by inline desc */
#tab-settings .help-tip {
  display: none;
}

/* ── Scoring bars ────────────────────────────────────────────────── */
.scoring-card { padding: 0.5rem 0; }
.scoring-bars { padding: 0 1rem; }
.scoring-bar-row {
  display: grid;
  grid-template-columns: 90px 1fr 50px 50px;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
  font-size: 0.7rem;
}
.scoring-label {
  color: var(--muted);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.scoring-bar-track {
  position: relative;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
}
.scoring-bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}
.scoring-bar-center {
  position: absolute;
  left: 50%;
  top: 0;
  width: 1px;
  height: 100%;
  background: var(--muted);
  opacity: 0.4;
}
.scoring-value {
  text-align: right;
  font-family: var(--mono);
  font-size: 0.7rem;
}
.scoring-weight {
  color: var(--muted);
  font-size: 0.6rem;
}
.scoring-summary {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--line);
  margin-top: 0.5rem;
}
.scoring-direction {
  font-size: 1rem;
  font-weight: 700;
}
.scoring-conf {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--gold);
}
.scoring-dominant {
  font-size: 0.7rem;
  color: var(--muted);
}

/* ── Gate rows ───────────────────────────────────────────────────── */
.gates-list { padding: 0 1rem; }
.gate-row {
  display: grid;
  grid-template-columns: 20px 1fr auto auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  font-size: 0.7rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.gate-row:last-child { border-bottom: none; }
.gate-icon { font-size: 0.75rem; text-align: center; }
.gate-pass .gate-icon { color: var(--mint); }
.gate-fail .gate-icon { color: var(--red); }
.gate-name { color: var(--text); }
.gate-value {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--muted);
}
.gate-threshold {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--muted);
  opacity: 0.6;
}

/* ── Maker order timeline ────────────────────────────────────────── */
.maker-timeline {
  display: flex;
  align-items: flex-start;
  gap: 0;
  padding: 1rem;
  overflow-x: auto;
}
.maker-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
  min-width: 80px;
}
.maker-step::after {
  content: '';
  position: absolute;
  top: 8px;
  left: calc(50% + 10px);
  right: calc(-50% + 10px);
  height: 2px;
  background: var(--line);
}
.maker-step:last-child::after { display: none; }
.maker-step.done::after { background: var(--mint); }
.maker-step.active::after {
  background: linear-gradient(90deg, var(--mint), var(--line));
}
.step-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--line);
  border: 2px solid var(--line);
  z-index: 1;
  margin-bottom: 0.5rem;
}
.maker-step.done .step-dot {
  background: var(--mint);
  border-color: var(--mint);
}
.maker-step.active .step-dot {
  background: transparent;
  border-color: var(--gold);
  animation: pulse-dot 1.5s infinite;
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(247, 215, 116, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(247, 215, 116, 0); }
}
.step-label {
  font-size: 0.65rem;
  color: var(--muted);
  text-align: center;
}
.maker-step.done .step-label,
.maker-step.active .step-label { color: var(--text); }
.step-value {
  font-family: var(--mono);
  font-size: 0.6rem;
  color: var(--gold);
  margin-top: 2px;
}
.maker-details {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem 1rem;
  font-size: 0.7rem;
  color: var(--muted);
}
.maker-details strong { color: var(--text); }

/* ── Text color helpers ──────────────────────────────────────────── */
.text-up { color: var(--mint); }
.text-down { color: var(--red); }
.text-muted { color: var(--muted); }

/* ── Settings tab layout ─────────────────────────────────────────── */
.settings-grid {
  display: flex;
  flex-direction: column;
  max-width: 640px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  overflow: hidden;
}
.settings-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.settings-header-bar .sh-title {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

/* ── Form field input styling ───────────────────────────────────── */
.field-row input[type="text"],
.field-row input:not([type]),
.field-row select {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.76rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  align-self: center;
}
.field-row input:focus,
.field-row select:focus {
  border-color: rgba(247, 215, 116, 0.35);
  box-shadow: 0 0 0 2px rgba(247, 215, 116, 0.08);
}

/* Save button at bottom of settings form */
.settings-save-row {
  padding: 0.75rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}
.btn-save {
  padding: 0.45rem 1.5rem;
  border-radius: 6px;
  border: 1px solid rgba(247, 215, 116, 0.3);
  background: linear-gradient(180deg, rgba(247, 215, 116, 0.15), rgba(247, 215, 116, 0.05));
  color: var(--gold);
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-save:hover {
  background: linear-gradient(180deg, rgba(247, 215, 116, 0.25), rgba(247, 215, 116, 0.12));
  border-color: rgba(247, 215, 116, 0.5);
}
.btn-danger-sm {
  padding: 0.3rem 0.8rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 91, 110, 0.25);
  background: rgba(255, 91, 110, 0.06);
  color: rgba(255, 91, 110, 0.7);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-danger-sm:hover {
  background: rgba(255, 91, 110, 0.12);
  border-color: rgba(255, 91, 110, 0.4);
  color: var(--red);
}
