/* ==========================================================================
   FretlyScalePicker component stylesheet (.fsp-*)
   Consumed wherever the Scale Picker component mounts.
   All colors come from Fretly's semantic tokens (with fallbacks), so the
   component auto-themes in light/dark — never hardcode colors outside var().
   ========================================================================== */

/* ---- Card shell ---------------------------------------------------------- */

.fsp-card {
  background: var(--surface, #fff);
  border: 1px solid var(--border, rgba(0, 0, 0, .09));
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
  overflow: hidden;
  margin-bottom: 16px;
  font-family: var(--font, 'DM Sans', system-ui, sans-serif);
  color: var(--text, #1a1a18);
}

/* ---- Header band ---------------------------------------------------------- */

.fsp-head {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2, #f7f6f3);
  border-bottom: 1px solid var(--border, rgba(0, 0, 0, .09));
  padding: 10px 16px;
}

.fsp-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text, #1a1a18);
}

.fsp-hint {
  font-size: 12px;
  color: var(--text-3, #8a8a84);
}

.fsp-head-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---- Body layout ----------------------------------------------------------
   <960px: single column, results below the main column, capped height.
   >=960px: two-column grid — results (300px, right border) | main (1fr).     */

.fsp-body {
  display: flex;
  flex-direction: column;
}

.fsp-results-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  order: 2;
}

.fsp-main-col {
  padding: 14px 16px;
  min-width: 0;
  order: 1;
}

.fsp-body .fsp-results {
  max-height: 340px;
}

@media (min-width: 960px) {
  .fsp-body {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 0;
  }

  .fsp-results-col {
    order: 0;
    border-right: 1px solid var(--border, rgba(0, 0, 0, .09));
  }

  .fsp-main-col {
    order: 0;
  }

  .fsp-body .fsp-results {
    max-height: 480px;
  }
}

/* ---- Results column ------------------------------------------------------- */

.fsp-results-head {
  padding: 12px 14px 4px;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text, #1a1a18);
}

.fsp-results-sub {
  padding: 0 14px 10px;
  font-size: 12px;
  color: var(--text-3, #8a8a84);
}

.fsp-note {
  font-family: var(--font-mono, 'DM Mono', monospace);
  color: var(--accent, #e8874a);
}

.fsp-results {
  flex: 1;
  overflow-y: auto;
  max-height: 480px;
}

/* Sticky group header inside the results list */
.fsp-grp {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 5px 12px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-3, #8a8a84);
  background: var(--surface-2, #f7f6f3);
  border-top: 1px solid var(--border, rgba(0, 0, 0, .09));
  border-bottom: 1px solid var(--border, rgba(0, 0, 0, .09));
}

/* ---- Result rows ----------------------------------------------------------- */

.fsp-row {
  padding: 8px 12px;
  border-bottom: 1px solid var(--surface-2, #f7f6f3);
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}

.fsp-row:hover {
  background: rgba(232, 135, 74, .08);
}

.fsp-row.is-sel {
  background: var(--accent-bg, rgba(232, 135, 74, .12));
  border-left-color: var(--accent, #e8874a);
}

.fsp-row:focus-visible {
  outline: 2px solid var(--accent, #e8874a);
  outline-offset: -2px;
}

.fsp-row-name {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text, #1a1a18);
}

.fsp-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.4;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-2, #f7f6f3);
  border: 1px solid var(--border, rgba(0, 0, 0, .09));
  color: var(--text-3, #8a8a84);
  white-space: nowrap;
}

.fsp-row.is-sel .fsp-badge {
  background: var(--accent, #e8874a);
  border-color: var(--accent, #e8874a);
  color: #fff;
}

.fsp-row-alias {
  font-size: 11.5px;
  font-weight: 400;
  color: var(--text-3, #8a8a84);
}

.fsp-row-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-top: 2px;
  font-family: var(--font-mono, 'DM Mono', monospace);
  font-size: 10.5px;
  color: var(--text-3, #8a8a84);
}

.fsp-row-extra {
  margin-top: 2px;
  font-size: 11px;
  font-weight: 500;
  color: var(--accent, #e8874a);
}

.fsp-empty {
  padding: 24px 14px;
  font-size: 13px;
  color: var(--text-3, #8a8a84);
  text-align: center;
}

/* ---- Results footer actions ------------------------------------------------ */

.fsp-actions {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface-2, #f7f6f3);
  border-top: 1px solid var(--border, rgba(0, 0, 0, .09));
}

/* ---- Buttons ---------------------------------------------------------------- */

.fsp-btn {
  font-family: var(--font, 'DM Sans', system-ui, sans-serif);
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--border, rgba(0, 0, 0, .09));
  background: var(--surface, #fff);
  color: var(--text-2, #4a4a46);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}

.fsp-btn:hover {
  background: var(--surface-2, #f7f6f3);
}

.fsp-btn:focus-visible {
  outline: 2px solid var(--accent, #e8874a);
  outline-offset: 2px;
}

.fsp-btn[disabled] {
  opacity: .5;
  cursor: default;
}

.fsp-btn--primary {
  background: var(--accent, #e8874a);
  border-color: var(--accent, #e8874a);
  color: #fff;
}

.fsp-btn--primary:hover {
  background: var(--accent, #e8874a);
  filter: brightness(1.05);
}

/* ---- Main column: controls --------------------------------------------------- */

.fsp-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: flex-end;
  margin-bottom: 12px;
}

.fsp-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.fsp-field-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-3, #8a8a84);
}

.fsp-select {
  font-family: var(--font, 'DM Sans', system-ui, sans-serif);
  font-size: 12.5px;
  padding: 5px 10px;
  border: 1px solid var(--border, rgba(0, 0, 0, .09));
  border-radius: 4px;
  background: var(--surface, #fff);
  color: var(--text, #1a1a18);
  transition: border-color .15s ease;
}

.fsp-select:focus-visible {
  outline: 2px solid var(--accent, #e8874a);
  outline-offset: 1px;
}

/* Segmented control */
.fsp-seg {
  display: inline-flex;
  border: 1px solid var(--border, rgba(0, 0, 0, .09));
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface, #fff);
}

.fsp-seg > button {
  font-family: var(--font, 'DM Sans', system-ui, sans-serif);
  font-size: 12.5px;
  font-weight: 500;
  padding: 5px 12px;
  border: 0;
  border-right: 1px solid var(--border, rgba(0, 0, 0, .09));
  background: transparent;
  color: var(--text-2, #4a4a46);
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}

.fsp-seg > button:last-child {
  border-right: 0;
}

.fsp-seg > button:hover {
  background: rgba(232, 135, 74, .08);
}

.fsp-seg > button.is-on {
  background: var(--accent, #e8874a);
  color: #fff;
  font-weight: 600;
}

.fsp-seg > button:focus-visible {
  outline: 2px solid var(--accent, #e8874a);
  outline-offset: -2px;
}

/* Group chips (small filter chips) */
.fsp-gchips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.fsp-gchip {
  font-family: var(--font, 'DM Sans', system-ui, sans-serif);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border: 1px solid var(--border, rgba(0, 0, 0, .09));
  border-radius: 4px;
  background: var(--surface-2, #f7f6f3);
  color: var(--text-2, #4a4a46);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.fsp-gchip:hover {
  background: rgba(232, 135, 74, .08);
}

.fsp-gchip.is-on {
  background: var(--accent, #e8874a);
  border-color: var(--accent, #e8874a);
  color: #fff;
}

.fsp-gchip:focus-visible {
  outline: 2px solid var(--accent, #e8874a);
  outline-offset: 2px;
}

/* ---- Fretboard area ----------------------------------------------------------- */

.fsp-board-wrap {
  position: relative;
}

.fsp-board-wrap svg {
  width: 100%;
  height: auto;
  display: block;
  cursor: crosshair;
}

/* Legend */
.fsp-legend {
  display: flex;
  gap: 16px;
  align-items: center;
  margin: 6px 0 10px;
  font-size: 12px;
  color: var(--text-3, #8a8a84);
}

.fsp-legend-sw {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  vertical-align: -1px;
  margin-right: 5px;
}

/* Legend swatches — mirror fretboard.js default dot colors (dotActive /
   light-theme dotGhost); FretlyDisplayConfig theming may differ slightly,
   these are indicative only. */
.fsp-legend-sw--active { background: #f2a93b; }
.fsp-legend-sw--ghost  { background: var(--surface-3, #e0ddd8); border: 1px solid var(--border, rgba(0, 0, 0, .09)); }

/* ---- Note chips ------------------------------------------------------------------ */

.fsp-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.fsp-chips-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-3, #8a8a84);
  margin-right: 8px;
}

.fsp-chip {
  font-family: var(--font-mono, 'DM Mono', monospace);
  font-size: 13px;
  padding: 6px 4px;
  min-width: 40px;
  text-align: center;
  border: 1px solid var(--border, rgba(0, 0, 0, .09));
  border-radius: 6px;
  background: var(--surface-2, #f7f6f3);
  color: var(--text-2, #4a4a46);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.fsp-chip:hover {
  background: rgba(232, 135, 74, .08);
}

.fsp-chip.is-on {
  background: var(--accent, #e8874a);
  border-color: var(--accent, #e8874a);
  color: #fff;
  font-weight: 600;
}

.fsp-chip:focus-visible {
  outline: 2px solid var(--accent, #e8874a);
  outline-offset: 2px;
}

/* ---- Toolbar cell -------------------------------------------------------------------
   .fsp-ctrl-cell deliberately has NO layout overrides: it must inherit the
   native .se-ctrl-cell stacking (label above control) exactly like the
   chrome-cells graft's injected cells.                                                 */

/* ---- Reduced motion ----------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .fsp-row,
  .fsp-btn,
  .fsp-select,
  .fsp-seg > button,
  .fsp-gchip,
  .fsp-chip {
    transition: none;
  }
}

/* ---- Recognition strip (intervals at 2 notes, chords at 3+) -------------------------- */

.fsp-recog {
  padding: 0 14px 10px;
  font-size: 12px;
  color: var(--text-2, #4a4a46);
}

.fsp-recog-line {
  margin-top: 2px;
  line-height: 1.5;
}

.fsp-recog-line b {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-3, #8a8a84);
  margin-right: 4px;
}

.fsp-recog-dim {
  color: var(--text-3, #8a8a84);
}

.fsp-recog-chip {
  display: inline-block;
  font-family: var(--font-mono, 'DM Mono', monospace);
  font-size: 11.5px;
  padding: 1px 7px;
  margin: 1px 2px 1px 0;
  border: 1px solid var(--border, rgba(0, 0, 0, .09));
  border-radius: 4px;
  background: var(--surface-2, #f7f6f3);
  color: var(--text, #1a1a18);
}
