/* Styles for reusable components: fretboard, badges, progress/mood bars, tabs, selects. */

/* ---------- Fretboard ---------- */
.fretboard-scroll {
  overflow-x: auto;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #1c140a, #100c07);
  border: 1px solid var(--border-strong);
  padding-bottom: 4px;
}
.fretboard-grid { display: grid; min-width: 900px; }
.fret-cell { display: flex; align-items: center; justify-content: center; position: relative; }
.fret-cell--corner { background: var(--bg-elevated); position: sticky; inset-inline-start: 0; z-index: 3; }
.fret-cell--number {
  color: var(--text-muted); font-size: 0.72rem; padding-block: 6px;
  border-bottom: 1px solid var(--border); background: var(--bg-elevated);
}
.fret-cell--number.has-marker { color: var(--text-secondary); }
.fret-cell--number.marker-2 { color: var(--accent); font-weight: 700; }
.fret-cell--string-label {
  color: var(--text-secondary); font-weight: 700; font-size: 0.8rem;
  border-inline-end: 2px solid var(--border-strong); background: var(--bg-elevated);
  position: sticky; inset-inline-start: 0; z-index: 2;
}
.fret-cell--note {
  height: 44px; border-inline-end: 1px solid var(--border); border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  background: transparent; padding: 0; position: relative; color: inherit;
}
.fret-cell--note.fret-cell--open { border-inline-end: 3px solid var(--border-strong); }
button.fret-cell--note { cursor: pointer; }
button.fret-cell--note:hover { background: rgba(255, 255, 255, 0.05); }

.note-dot {
  width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.06); border: 1px solid transparent; transition: background 0.15s ease, border-color 0.15s ease;
}
.note-label { position: absolute; font-size: 0.66rem; color: var(--text-muted); pointer-events: none; }
.hide-note-names .note-label { display: none; }

.fret-cell--note[data-degree]::after {
  content: attr(data-degree); position: absolute; top: 1px; inset-inline-end: 1px;
  font-size: 0.52rem; line-height: 1.2; padding: 1px 3px; border-radius: 4px;
  background: rgba(0, 0, 0, 0.55); color: #fff; pointer-events: none;
}

.is-root .note-dot { background: var(--color-root); border-color: var(--color-root); box-shadow: 0 0 0 3px rgba(226, 168, 63, 0.28); }
.is-root .note-label { color: #1a1204; font-weight: 800; }
.is-scale-tone .note-dot { background: rgba(111, 147, 201, 0.85); border-color: var(--color-scale-tone); }
.is-scale-tone .note-label { color: #0c1524; font-weight: 700; }
.is-chord-tone .note-dot { background: rgba(217, 119, 87, 0.9); border-color: var(--color-chord-tone); }
.is-chord-tone .note-label { color: #2a0f06; font-weight: 700; }
.is-interval-root .note-dot { background: var(--color-root); border-color: var(--color-root); box-shadow: 0 0 0 3px rgba(226, 168, 63, 0.28); }
.is-interval-target .note-dot { background: rgba(155, 127, 209, 0.9); border-color: var(--color-interval-target); }
.is-interval-target .note-label { color: #160f22; font-weight: 700; }
.is-shape-tone .note-dot { background: rgba(217, 119, 87, 0.9); border-color: var(--color-chord-tone); }

/* ---------- Note / formula badges ---------- */
.badge-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.note-badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 38px;
  padding: 6px 12px; border-radius: 999px; background: var(--bg-elevated);
  border: 1px solid var(--border-strong); font-weight: 700; font-size: 0.9rem;
}
.note-badge--root { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }
.note-badge[role='button'] { cursor: pointer; }
.note-badge[role='button']:hover { background: var(--bg-card-hover); }

.formula-badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 34px;
  padding: 5px 10px; border-radius: 8px; font-weight: 700; font-size: 0.82rem;
  background: var(--bg-elevated); border: 1px solid var(--border);
}
.formula-badge.degree-flat { color: var(--color-scale-tone); border-color: var(--color-scale-tone); }
.formula-badge.degree-sharp { color: var(--color-interval-target); border-color: var(--color-interval-target); }
.formula-badge.degree-natural { color: var(--text-primary); }

/* ---------- Progress bar / mood meter ---------- */
.progress-bar { margin-bottom: 10px; }
.progress-bar-label { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 4px; }
.progress-bar-track { height: 8px; border-radius: 999px; background: var(--bg-elevated); border: 1px solid var(--border); overflow: hidden; }
.progress-bar-fill {
  height: 100%; background: linear-gradient(90deg, var(--color-scale-tone), var(--accent));
  border-radius: 999px; transition: width 0.35s ease; width: 0%;
}
.mood-meter-disclaimer { font-size: 0.78rem; color: var(--text-muted); margin-top: 8px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tab-button {
  background: transparent; border: none; color: var(--text-secondary); padding: 10px 16px;
  font-weight: 600; font-size: 0.9rem; cursor: pointer; border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.tab-button.is-active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-button:hover { color: var(--text-primary); }

/* ---------- Select / dropdown ---------- */
.field-select { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; color: var(--text-secondary); }
.field-select-input {
  background: var(--bg-elevated); color: var(--text-primary); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: 0.95rem; min-width: 140px; cursor: pointer;
}
.field-select-input:hover { border-color: var(--accent); }

.checkbox-field { flex-direction: row; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--text-primary); }
.checkbox-field input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }

/* ---------- Note strip ---------- */
.note-strip { display: flex; align-items: center; flex-wrap: wrap; gap: 0; margin: 16px 0; }
.note-strip-item { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.note-strip-sublabel { font-size: 0.72rem; color: var(--text-muted); direction: rtl; }
.note-strip-gap {
  display: flex; align-items: center; justify-content: center; min-width: 34px; height: 26px;
  position: relative; margin: 0 4px; color: var(--text-muted); font-size: 0.72rem;
}
.note-strip-gap::before {
  content: ''; position: absolute; inset-inline: 0; top: 50%; border-top: 1px dashed var(--border-strong);
}
.note-strip-gap span { position: relative; background: var(--bg-card); padding: 0 5px; }

/* ---------- Chips ---------- */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.chip {
  background: var(--bg-elevated); border: 1px solid var(--border-strong); color: var(--text-secondary);
  padding: 7px 14px; border-radius: 999px; font-size: 0.85rem; font-weight: 600; cursor: pointer;
  transition: all 0.15s ease; direction: rtl;
}
.chip:hover { color: var(--text-primary); border-color: var(--accent); }
.chip.is-active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }

/* ---------- Fact grid (interval / chord / scale summaries) ---------- */
.fact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 16px 0; }
.fact-item {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 12px 14px; display: flex; flex-direction: column; gap: 4px;
}
.fact-label { font-size: 0.78rem; color: var(--text-muted); }
.fact-value { font-size: 1.05rem; font-weight: 700; color: var(--text-primary); }
.character-text { font-size: 1rem; color: var(--text-primary); font-weight: 500; }
.interval-result { margin-bottom: 20px; }

/* ---------- Data table ---------- */
.data-table { width: 100%; border-collapse: collapse; margin: 12px 0 20px; }
.data-table th {
  text-align: start; font-size: 0.8rem; color: var(--text-muted); font-weight: 600;
  padding: 8px 12px; border-bottom: 1px solid var(--border-strong);
}
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
.data-table tbody tr:hover { background: var(--bg-elevated); }
.data-table a { color: var(--accent); text-decoration: none; font-weight: 600; }
.data-table a:hover { text-decoration: underline; }
.is-diff-cell { color: var(--accent-strong); font-weight: 700; background: var(--accent-soft); border-radius: var(--radius-sm); }

/* ---------- Quiz ---------- */
.quiz-meta-row { display: flex; justify-content: space-between; font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 6px; }
.quiz-card h2 { margin-bottom: 16px; }
.quiz-fretboard { margin-bottom: 16px; }
.quiz-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 16px; }
.quiz-choice {
  background: var(--bg-elevated); border: 1px solid var(--border-strong); color: var(--text-primary);
  padding: 14px 16px; border-radius: var(--radius-md); font-size: 0.95rem; font-weight: 600; cursor: pointer;
  transition: all 0.15s ease; text-align: center;
}
.quiz-choice:hover:not(:disabled) { border-color: var(--accent); }
.quiz-choice:disabled { cursor: default; }
.quiz-choice.is-correct { background: rgba(120, 184, 110, 0.18); border-color: #78b86e; color: #a9dba0; }
.quiz-choice.is-wrong { background: rgba(217, 100, 89, 0.18); border-color: #d96459; color: #f0a49c; }
.quiz-feedback-correct { color: #a9dba0; font-weight: 600; }
.quiz-feedback-wrong { color: #f0a49c; font-weight: 600; }
.quiz-results { text-align: center; }
.quiz-score { font-size: 2rem; font-weight: 800; color: var(--accent); }

/* ---------- Toast ---------- */
.toast-host { position: fixed; bottom: 20px; inset-inline-end: 20px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg-elevated); border: 1px solid var(--border-strong); color: var(--text-primary);
  padding: 12px 18px; border-radius: var(--radius-md); box-shadow: var(--shadow-card);
  opacity: 0; transform: translateY(8px); transition: opacity 0.2s ease, transform 0.2s ease; font-size: 0.9rem;
}
.toast.is-visible { opacity: 1; transform: translateY(0); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); z-index: 400;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: var(--bg-card); border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  max-width: 520px; width: 100%; max-height: 80vh; overflow-y: auto; box-shadow: var(--shadow-card);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-header h2 { margin: 0; font-size: 1.15rem; }
.modal-close { background: none; border: none; color: var(--text-secondary); font-size: 1.4rem; line-height: 1; cursor: pointer; padding: 4px 8px; }
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 20px; color: var(--text-secondary); line-height: 1.8; }

/* ---------- Chord diagram ---------- */
.chord-diagram { width: 128px; display: inline-block; }
.chord-diagram-basefret { font-size: 0.7rem; color: var(--text-muted); height: 14px; text-align: left; }
.chord-diagram-markers { display: grid; grid-template-columns: repeat(6, 1fr); margin-bottom: 3px; }
.chord-diagram-marker { text-align: center; font-size: 0.78rem; color: var(--color-root); }
.chord-diagram-marker.is-muted { color: var(--text-muted); }
.chord-diagram-grid {
  position: relative; display: grid; background: var(--bg-elevated);
  border-inline: 2px solid var(--border-strong); border-bottom: 2px solid var(--border-strong);
  border-top: 1px solid var(--border-strong); height: 110px;
}
.chord-diagram-grid.has-nut { border-top: 5px solid var(--text-primary); }
.chord-diagram-cell { border-inline-end: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.chord-diagram-dot {
  position: absolute; width: 18px; height: 18px; border-radius: 50%; background: var(--color-chord-tone);
  transform: translate(-50%, -50%); display: flex; align-items: center; justify-content: center;
  font-size: 0.62rem; font-weight: 700; color: #2a0f06; z-index: 2;
}
.chord-diagram-barre {
  position: absolute; height: 16px; border-radius: 8px; background: rgba(217, 119, 87, 0.5);
  transform: translateY(-50%); z-index: 1;
}
.chord-diagram-empty { font-size: 0.82rem; color: var(--text-muted); max-width: 160px; }
.chord-diagram-row { display: flex; flex-wrap: wrap; gap: 20px; margin: 16px 0; direction: ltr; }
.chord-diagram-item { text-align: center; }
.chord-diagram-item-label { font-size: 0.8rem; color: var(--text-secondary); margin-top: 6px; font-weight: 600; direction: rtl; }

/* ---------- Circle of Fifths ---------- */
.cof-wrap { max-width: 460px; margin-inline: auto; padding: 12px; }
.cof-svg { width: 100%; height: auto; display: block; direction: ltr; }
.cof-guide { fill: none; stroke: var(--border); stroke-width: 1; }
.cof-node { cursor: pointer; }
.cof-node-circle { fill: var(--bg-card); stroke: var(--border-strong); stroke-width: 1.5; transition: fill 0.15s ease, stroke 0.15s ease; }
.cof-node:hover .cof-node-circle { stroke: var(--accent); }
.cof-node:focus-visible { outline: none; }
.cof-node:focus-visible .cof-node-circle { stroke: var(--accent); stroke-width: 3; }
.cof-node.is-selected .cof-node-circle { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 3; }
.cof-node-text { fill: var(--text-primary); font-size: 15px; font-weight: 700; font-family: var(--font-body); pointer-events: none; }
.cof-node--minor .cof-node-text { font-size: 11px; fill: var(--text-secondary); }
.cof-node.is-selected .cof-node-text { fill: var(--accent-strong); }

/* ---------- Progression cards ---------- */
.progression-card { margin-bottom: 14px; transition: border-color 0.15s ease; }
.progression-card.is-active { border-color: var(--accent); }
.progression-card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.progression-card-head h3 { margin: 0; }
