/* StaffLoader styles. Colors come from CSS variables so you can match Astrona's theme. */

.sl-root {
  --sl-bg: rgba(10, 8, 32, 0.38);
  --sl-border: rgba(160, 140, 255, 0.2);
  --sl-text: #ece9ff;
  --sl-muted: #9b95c9;
  --sl-line: rgba(200, 190, 255, 0.34);
  --sl-accent: #a78bfa;
  --sl-accent-2: #38bdf8;
  --sl-error: #fb7185;
  color: var(--sl-text);
  width: 100%;
  margin: 24px 0;
}

.sl-root.sl-hidden { display: none; }

.sl-panel {
  position: relative;
  overflow: hidden;
  padding: 18px 20px 14px;
  border-radius: 18px;
  background: var(--sl-bg);
  border: 1px solid var(--sl-border);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: sl-enter 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.sl-panel.is-leaving { opacity: 0; transform: translateY(8px) scale(0.985); }

/* header */
.sl-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.sl-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.sl-pulse {
  position: relative;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--sl-accent);
  box-shadow: 0 0 12px var(--sl-accent);
  flex: none;
}
.sl-pulse::after {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid var(--sl-accent);
  animation: sl-ping 1.6s ease-out infinite;
}

.sl-ellipsis i {
  display: inline-block;
  width: 4px;
  height: 4px;
  margin-inline-start: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.25;
  animation: sl-dot 1.2s infinite;
}
.sl-ellipsis i:nth-child(2) { animation-delay: 0.2s; }
.sl-ellipsis i:nth-child(3) { animation-delay: 0.4s; }

.sl-percent {
  font-variant-numeric: tabular-nums;
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1;
  background: linear-gradient(90deg, var(--sl-accent), var(--sl-accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* staff */
.sl-stage { width: 100%; }
.sl-svg { display: block; width: 100%; height: auto; overflow: visible; }

.sl-line {
  stroke: var(--sl-line);
  stroke-width: 1.2;
}
.sl-edge {
  stroke: var(--sl-line);
  stroke-width: 1.6;
}
.sl-bar-line {
  stroke: var(--sl-line);
  stroke-width: 1.2;
}

.sl-clef {
  fill: none;
  stroke: var(--sl-accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.9;
}
.sl-clef-dot { fill: var(--sl-accent); opacity: 0.9; }

.sl-playhead {
  stroke: var(--sl-accent-2);
  stroke-width: 2;
  stroke-linecap: round;
  opacity: 0.9;
  filter: drop-shadow(0 0 6px var(--sl-accent-2));
}
.sl-playhead-cap { fill: var(--sl-accent-2); }
.sl-playhead-glow { color: var(--sl-accent-2); }

/* notes: color comes from --h, set per note from its pitch (low = purple, high = cyan) */
.sl-note {
  --c: hsl(var(--h) 90% 70%);
  transform-box: fill-box;
  transform-origin: center;
  opacity: 0.92;
  transition: opacity 0.35s ease, transform 0.18s ease;
}
.sl-note .head.fill { fill: var(--c); stroke: none; }
.sl-note .head.hollow { fill: none; stroke: var(--c); stroke-width: 2.4; }
.sl-note .stem { stroke: var(--c); stroke-width: 1.8; stroke-linecap: round; }
.sl-note .ledger { stroke: var(--sl-line); stroke-width: 1.4; }
.sl-note .acc line { stroke: var(--c); stroke-linecap: round; }

.sl-note.is-active {
  opacity: 1;
  transform: scale(1.22);
  filter: drop-shadow(0 0 7px var(--c)) drop-shadow(0 0 14px var(--c));
}
.sl-note.is-done { opacity: 0.4; }

/* the notes appear only once real ones are ready */
.sl-notes { opacity: 0; transition: opacity 0.6s ease; }
.is-ready .sl-notes { opacity: 1; }

/* progress bar */
.sl-bar {
  height: 5px;
  margin-top: 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.sl-bar-fill {
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--sl-accent), var(--sl-accent-2));
  box-shadow: 0 0 12px var(--sl-accent);
  transform: scaleX(0);
  transform-origin: left center;
}

.sl-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--sl-muted);
}
.sl-file {
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  direction: ltr;
}

/* error */
.sl-panel.is-error { border-color: rgba(251, 113, 133, 0.5); }
.sl-panel.is-error .sl-pulse { background: var(--sl-error); box-shadow: 0 0 12px var(--sl-error); }
.sl-panel.is-error .sl-pulse::after { border-color: var(--sl-error); animation: none; opacity: 0; }
.sl-panel.is-error .sl-ellipsis { display: none; }
.sl-panel.is-error .sl-percent {
  background: none;
  color: var(--sl-error);
  -webkit-text-fill-color: var(--sl-error);
}
.sl-panel.is-error .sl-bar-fill { background: var(--sl-error); box-shadow: none; }
.sl-panel.is-error .sl-notes { opacity: 0.25; }

@keyframes sl-enter {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
@keyframes sl-ping {
  0%   { transform: scale(0.6); opacity: 0.9; }
  100% { transform: scale(1.7); opacity: 0; }
}
@keyframes sl-dot {
  0%, 80%, 100% { opacity: 0.25; }
  40%           { opacity: 1; }
}

@media (max-width: 560px) {
  .sl-panel { padding: 14px 12px 12px; border-radius: 14px; }
  .sl-percent { font-size: 1.35rem; }
  .sl-title { font-size: 0.95rem; }
}

@media (prefers-reduced-motion: reduce) {
  .sl-pulse::after, .sl-ellipsis i { animation: none; }
  .sl-ellipsis i { opacity: 0.7; }
  .sl-panel { animation: none; }
}

/* Keep the panel inside the page width on narrow screens (phones). */
.sl-root {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  contain: layout paint;
}
.sl-panel {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
}
.sl-stage {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
.sl-svg {
  max-width: 100%;
  overflow: hidden;
}
.sl-head, .sl-foot { min-width: 0; }
.sl-title { min-width: 0; flex: 1 1 auto; }
.sl-percent { flex: none; }

/* melody mode (notes stay after the analysis, move while the song plays) */
.is-melody .sl-bar, .is-melody .sl-percent, .is-melody .sl-ellipsis, .is-melody .sl-phase { display: none; }
