/**
 * The shared player look (DECISIONS D38): the product-page player and the My Playlists player.
 * Desktop and tablet: the control strip, then the numbered track list. Phone width: larger
 * controls, sticky at the top while the list scrolls under them.
 *
 * Colours: the site's own blue (#15429e, the 32CountFitness.com link colour) in two shades.
 * Contrast (checked in player/test/ttc-player-core.test.ts): ink on white and on the light rows
 * and the hover row is above 4.5:1; white on the now-playing row is above 4.5:1.
 */
:root {
	--ttc-blue: #15429e;
	--ttc-blue-light: #e9eef8;
	--ttc-blue-hover: #d0dbf2;
	--ttc-ink: #1b1f24;
	--ttc-muted: #4b5563;
	--ttc-line: #d9dde3;
	--ttc-focus: #0b1f4d;
}

.ttc-player-root { font-family: inherit; color: var(--ttc-ink); }
.ttc-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---- control strip ---- */
.ttc-player-bar { background: #fff; border: 1px solid var(--ttc-line); border-radius: 10px; padding: 14px 18px; display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.ttc-player-title { font-size: 1.2em; font-weight: 700; line-height: 1.25; }
.ttc-player-title[hidden] { display: none; }
.ttc-player-now { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; min-height: 1.4em; }
.ttc-player-now-title { font-size: 1.1em; font-weight: 600; }
.ttc-player-now-artist { color: var(--ttc-muted); }
.ttc-player-count { margin-left: auto; color: var(--ttc-muted); font-size: .9em; font-variant-numeric: tabular-nums; }

.ttc-player-seekrow { display: flex; align-items: center; gap: 10px; }
.ttc-player-time { color: var(--ttc-muted); font-size: .85em; min-width: 2.8em; font-variant-numeric: tabular-nums; }
.ttc-player-time-len { text-align: right; }
.ttc-player-seek { flex: 1; height: 8px; background: #e2e5ea; border-radius: 4px; position: relative; cursor: pointer; touch-action: none; }
.ttc-player-seek-fill { display: block; height: 100%; width: 0; background: var(--ttc-blue); border-radius: 4px; }
.ttc-player-seek-handle { position: absolute; top: 50%; left: 0; width: 18px; height: 18px; margin: -9px 0 0 -9px; background: #fff; border: 2px solid var(--ttc-blue); border-radius: 50%; box-sizing: border-box; }
.ttc-player-seek:focus-visible { outline: 3px solid var(--ttc-focus); outline-offset: 4px; }

.ttc-player-controls { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.ttc-player-transport { display: flex; align-items: center; gap: 8px; }
.ttc-player-btn { width: 44px; height: 44px; padding: 0; border: 1px solid var(--ttc-line); background: #fff; color: var(--ttc-ink); border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.ttc-player-btn svg { width: 20px; height: 20px; }
.ttc-player-btn:hover { background: var(--ttc-blue-light); }
.ttc-player-btn:focus-visible { outline: 3px solid var(--ttc-focus); outline-offset: 2px; }
.ttc-player-btn[disabled] { opacity: .45; cursor: default; }
.ttc-player-playpause { width: 56px; height: 56px; border: 0; background: var(--ttc-blue); color: #fff; }
.ttc-player-playpause:hover { background: #0f3480; }
.ttc-player-playpause svg { width: 24px; height: 24px; }

.ttc-player-right { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.ttc-player-volume { display: flex; align-items: center; gap: 6px; }
.ttc-player-mute { border: 0; }
/* The slider, reset against theme and shop form styles (Divi / WooCommerce style every input). */
.ttc-player-root input.ttc-player-volume-range { all: unset; -webkit-appearance: none; appearance: none; box-sizing: border-box; display: inline-block; width: 110px; height: 20px; margin: 0; padding: 0; background: transparent; border: 0; border-radius: 0; box-shadow: none; cursor: pointer; vertical-align: middle; accent-color: var(--ttc-blue); }
.ttc-player-root input.ttc-player-volume-range::-webkit-slider-runnable-track { height: 6px; background: #e2e5ea; border-radius: 3px; }
.ttc-player-root input.ttc-player-volume-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; margin-top: -6px; background: #fff; border: 2px solid var(--ttc-blue); border-radius: 50%; box-sizing: border-box; }
.ttc-player-root input.ttc-player-volume-range::-moz-range-track { height: 6px; background: #e2e5ea; border-radius: 3px; border: 0; }
.ttc-player-root input.ttc-player-volume-range::-moz-range-thumb { width: 18px; height: 18px; background: #fff; border: 2px solid var(--ttc-blue); border-radius: 50%; box-sizing: border-box; }
.ttc-player-root input.ttc-player-volume-range:focus-visible { outline: 3px solid var(--ttc-focus); outline-offset: 2px; }
/* iOS Safari ignores a page-set volume: the slider goes, the mute button stays */
.ttc-player-root.is-ios .ttc-player-volume-range { display: none; }

/* loop: on-state by a tint, a border and the ON badge, not colour alone */
.ttc-player-loop { position: relative; }
.ttc-player-loop-badge { display: none; position: absolute; right: 2px; bottom: 2px; font-size: 9px; font-weight: 700; line-height: 1; letter-spacing: .04em; }
.ttc-player-loop.is-on { background: var(--ttc-blue-light); border-color: var(--ttc-blue); color: var(--ttc-blue); }
.ttc-player-loop.is-on .ttc-player-loop-badge { display: inline; }
.ttc-player-bpm { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: .95em; }
.ttc-player-bpm-select { min-height: 44px; padding: 0 12px; border: 1px solid var(--ttc-line); border-radius: 8px; background: #fff; color: var(--ttc-ink); font-size: 1em; }
.ttc-player-bpm-select:focus-visible { outline: 3px solid var(--ttc-focus); outline-offset: 2px; }

/* the bookmark form, moved into the strip: its own BPM select is driven by the player's */
.ttc-player-extra form { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.ttc-player-extra .ttc-player-bookmark-bpm { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.ttc-player-extra input[type='submit'] { min-height: 44px; padding: 0 14px; border: 1px solid var(--ttc-blue); border-radius: 8px; background: #fff; color: var(--ttc-blue); font-weight: 600; cursor: pointer; }
.ttc-player-extra input[type='submit']:hover { background: var(--ttc-blue-light); }
.ttc-player-extra input[type='submit']:focus-visible { outline: 3px solid var(--ttc-focus); outline-offset: 2px; }
.ttc-player.is-legacy .ttc-player-bookmark { margin-bottom: 10px; }

/* ---- track list ---- */
.ttc-tracklist { list-style: none; margin: 0; padding: 0; border: 1px solid var(--ttc-line); border-radius: 10px; overflow: hidden; background: #fff; }
.ttc-track-row { display: grid; grid-template-columns: 36px 20px minmax(0, 1fr) 56px auto; align-items: center; gap: 10px; padding: 0 14px 0 10px; min-height: 48px; background: #fff; color: var(--ttc-ink); border-top: 1px solid #eceff2; position: relative; }
.ttc-track-row:first-child { border-top: 0; }
.ttc-track-row.is-alt { background: var(--ttc-blue-light); }
.ttc-track-num { color: var(--ttc-muted); text-align: center; font-size: .9em; }
/* keeps its grid cell on every row; shown only on the now-playing row */
.ttc-track-now { display: inline-flex; visibility: hidden; color: inherit; width: 20px; height: 20px; align-items: center; justify-content: center; }
.ttc-track-play { all: unset; display: flex; flex-direction: column; justify-content: center; gap: 2px; min-width: 0; min-height: 48px; padding: 6px 0; cursor: pointer; color: inherit; }
.ttc-track-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ttc-track-artist, .ttc-track-meta { color: var(--ttc-muted); font-size: .9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ttc-track-time { color: var(--ttc-muted); text-align: right; font-size: .9em; font-variant-numeric: tabular-nums; }

/* hover: a darker tint plus a left bar, so it never looks like the now-playing row */
.ttc-track-row:not(.is-playing):not(.is-missing):hover { background: var(--ttc-blue-hover); box-shadow: inset 4px 0 0 var(--ttc-blue); }
/* keyboard focus: a dark outline inside the row */
.ttc-track-row:has(.ttc-track-play:focus-visible) { outline: 3px solid var(--ttc-focus); outline-offset: -3px; }
.ttc-track-play:focus-visible { outline: 3px solid var(--ttc-focus); outline-offset: -3px; }

/* now playing: the dark shade, white text, and the icon */
.ttc-track-row.is-playing { background: var(--ttc-blue); color: #fff; }
.ttc-track-row.is-playing .ttc-track-num { color: #fff; opacity: .85; }
.ttc-track-row.is-playing .ttc-track-artist, .ttc-track-row.is-playing .ttc-track-meta, .ttc-track-row.is-playing .ttc-track-time { color: #fff; opacity: .9; }
.ttc-track-row.is-playing .ttc-track-now { visibility: visible; }
.ttc-track-row.is-playing:has(.ttc-track-play:focus-visible), .ttc-track-row.is-playing .ttc-track-play:focus-visible { outline-color: #fff; }

.ttc-track-row.is-missing .ttc-track-play { cursor: default; opacity: .55; text-decoration: line-through; }
.ttc-track-row.is-missing .ttc-track-status { position: static; width: auto; height: auto; margin: 0; clip: auto; white-space: normal; font-size: .85em; color: #b32d2e; }

/* ---- phone width: bigger controls, sticky at the top ---- */
@media (max-width: 640px) {
	.ttc-player-bar { position: sticky; top: 0; z-index: 20; border-radius: 0 0 10px 10px; margin: 0 0 10px; padding: 10px 12px 12px; box-shadow: 0 2px 6px rgba(0, 0, 0, .08); }
	.ttc-player-now-title { font-size: 1.05em; }
	.ttc-player-seek { height: 10px; }
	.ttc-player-seek-handle { width: 22px; height: 22px; margin: -11px 0 0 -11px; }
	.ttc-player-controls { justify-content: center; }
	.ttc-player-transport { gap: 14px; order: 1; width: 100%; justify-content: center; }
	.ttc-player-btn { width: 48px; height: 48px; }
	.ttc-player-btn svg { width: 24px; height: 24px; }
	.ttc-player-playpause { width: 64px; height: 64px; border-radius: 50%; }
	.ttc-player-playpause svg { width: 28px; height: 28px; }
	.ttc-player-right { order: 2; width: 100%; justify-content: space-between; gap: 10px; }
	.ttc-player-root input.ttc-player-volume-range { width: 80px; }
	.ttc-track-row { grid-template-columns: 28px 20px minmax(0, 1fr) 48px auto; padding: 0 10px 0 6px; }
}

/* ---- admin bar offset for the sticky strip ---- */
@media (max-width: 640px) {
	body.admin-bar .ttc-player-bar { top: 46px; }
}
