/* ──────────────────────────────────────────────────────────────
   Shared Practice Audio Player
   ──────────────────────────────────────────────────────────────
   Consolidates the 7 identical audio-player copies from
   hcs / hiw / lmcma / lmcsa / smw / sst / wfd mode CSS.

   Each mode's HTML section keeps its existing mode-prefixed class
   (e.g. .hcs-audio, .sst-audio) AND gains .practice-audio-player.
   JS binds by ID, so no script changes are needed.

   Modes can override the background via the custom property:
     --practice-audio-bg: var(--sst-accent);

   CONSTRAINT: Child elements use [class$="-play-btn"] attribute-ends-with
   selectors. These break if a second class is ever added to those elements
   (e.g. classList.add('is-playing') makes class="hcs-play-btn is-playing"
   and $= stops matching). Do NOT add classes to child elements inside
   .practice-audio-player — use data attributes or parent-state classes
   (.practice-audio-player.is-playing) instead.
   ────────────────────────────────────────────────────────────── */

/* ── Container ── */
.practice-audio-player {
  width: min(470px, 100%);
  margin: 6px auto 20px;
  padding: 22px 24px;
  border-radius: 8px;
  background: var(--practice-audio-bg, #235e92);
  color: #fff;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
}

/* ── Play / Pause Button ── */
.practice-audio-player [class$="-play-btn"] {
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  min-height: 44px;
  padding: 0 14px 0 9px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.practice-audio-player [class$="-play-btn"]:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}

/* ── Progress Track ── */
.practice-audio-player [class$="-progress-wrap"] {
  position: relative;
}

.practice-audio-player [class$="-progress"] {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.34);
}

.practice-audio-player [class$="-progress-fill"] {
  width: 0;
  height: 100%;
  background: #fff;
  border-radius: inherit;
}

/* ── Invisible Seek Overlay ── */
.practice-audio-player [class$="-seek"] {
  position: absolute;
  inset: -12px 0;
  width: 100%;
  height: 32px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.practice-audio-player [class$="-seek"]:disabled {
  pointer-events: none;
}

/* ── Focus Ring on Progress ── */
.practice-audio-player [class$="-progress-wrap"]:focus-within [class$="-progress"] {
  outline: 2px solid #fff;
  outline-offset: 4px;
}

/* ── Timestamp ── */
.practice-audio-player [class$="-audio-time"] {
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ── Volume ── */
.practice-audio-player [class$="-volume-label"] {
  grid-column: 1 / 2;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.88);
}

.practice-audio-player [class$="-volume"] {
  grid-column: 2 / 4;
  accent-color: #fff;
}

/* ── Mobile Reflow ── */
@media (max-width: 640px) {
  .practice-audio-player {
    grid-template-columns: auto 1fr;
    padding: 18px 16px;
  }

  .practice-audio-player [class$="-audio-time"] {
    grid-column: 1 / -1;
    justify-self: end;
  }

  .practice-audio-player [class$="-volume-label"] {
    grid-column: 1 / 2;
  }

  .practice-audio-player [class$="-volume"] {
    grid-column: 2 / -1;
  }
}

/* ── Companion Meta Row ──
   Status that belongs to the clip but not inside the player grid — Repeat
   Sentence's remaining-replays badge, for instance. Sits directly under the
   box and shares its centred width. */
.practice-audio-meta {
  width: min(470px, 100%);
  margin: -12px auto 18px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  min-height: 0;
}

.practice-audio-meta:empty {
  display: none;
}

/* ── Read Aloud Real Audio Player & Source Tabs ── */
.ra-real-audio-player-wrapper {
  width: min(520px, 100%);
  margin: 14px auto 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ra-audio-source-tabs {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  background: var(--surface-2, #f1f5f9);
  padding: 4px;
  border-radius: 999px;
  width: fit-content;
  margin: 0 auto;
  border: 1px solid var(--border-subtle, #e2e8f0);
}

.ra-source-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--text-secondary, #64748b);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.ra-source-tab:hover:not(:disabled) {
  color: var(--text-primary, #1e293b);
}

.ra-source-tab.active {
  background: #ffffff;
  color: var(--brand-primary, #2563eb);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ra-source-tab:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ra-real-audio-player-wrapper .practice-audio-player {
  width: 100%;
  margin: 0;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.12);
}
