/* =========================================================
   Text to Voice — Custom Audio Player
   ========================================================= */

.ttv-wrapper {
	margin: 24px 0;
}

/* ----- Player shell ----- */
.ttv-player {
	background: #1e1e2e;
	border-radius: 12px;
	padding: 14px 18px;
	color: #cdd6f4;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	font-size: 14px;
	line-height: 1.4;
	box-shadow: 0 4px 18px rgba(0, 0, 0, .25);
	user-select: none;
}

/* ----- Loading state ----- */
.ttv-loading {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 4px 0;
	color: #a6adc8;
}

.ttv-spinner {
	flex-shrink: 0;
	width: 18px;
	height: 18px;
	border: 3px solid rgba(203, 166, 247, .2);
	border-top-color: #cba6f7;
	border-radius: 50%;
	animation: ttv-spin .7s linear infinite;
}

@keyframes ttv-spin {
	to { transform: rotate(360deg); }
}

/* ----- Controls row ----- */
.ttv-controls {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}

/* ----- Buttons ----- */
.ttv-btn {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	border: none;
	border-radius: 8px;
	padding: 7px 14px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: background .15s, transform .1s;
	white-space: nowrap;
}

.ttv-btn:active {
	transform: scale(.95);
}

.ttv-play-btn {
	background: #cba6f7;
	color: #1e1e2e;
	min-width: 110px;
	justify-content: center;
}

.ttv-play-btn:hover {
	background: #d4b4fa;
}

.ttv-play-btn.is-playing {
	background: #f38ba8;
}

.ttv-play-btn.is-playing:hover {
	background: #f5a0b5;
}

.ttv-rewind-btn {
	background: #313244;
	color: #cdd6f4;
}

.ttv-rewind-btn:hover {
	background: #45475a;
}

/* ----- Time + progress row ----- */
.ttv-time-row {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 1;
	min-width: 160px;
}

.ttv-current-time,
.ttv-duration {
	font-variant-numeric: tabular-nums;
	font-size: 12px;
	color: #a6adc8;
	min-width: 34px;
	text-align: center;
}

/* ----- Progress bar ----- */
.ttv-progress-bar {
	position: relative;
	flex: 1;
	height: 6px;
	background: #313244;
	border-radius: 99px;
	cursor: pointer;
	overflow: hidden;
}

/* How far the user has already listened (seekable zone) */
.ttv-bar-available {
	position: absolute;
	inset: 0 auto 0 0;
	width: 0;
	background: rgba(203, 166, 247, .35);
	border-radius: 99px;
	transition: width .1s linear;
	pointer-events: none;
}

/* Current playback position */
.ttv-bar-played {
	position: absolute;
	inset: 0 auto 0 0;
	width: 0;
	background: #cba6f7;
	border-radius: 99px;
	transition: width .1s linear;
	pointer-events: none;
	z-index: 1;
}

/* Cursor hint: can seek in listened zone, blocked beyond */
.ttv-progress-bar.can-seek {
	cursor: pointer;
}

.ttv-progress-bar.no-seek {
	cursor: not-allowed;
}

/* "No forward skip" flash */
@keyframes ttv-shake {
	0%, 100% { transform: translateX(0); }
	20%, 60% { transform: translateX(-4px); }
	40%, 80% { transform: translateX(4px); }
}

.ttv-progress-bar.ttv-blocked {
	animation: ttv-shake .3s ease;
}

/* ----- Hidden audio element ----- */
.ttv-audio {
	display: none;
}

/* ----- Error state ----- */
.ttv-error-msg {
	color: #f38ba8;
	font-size: 13px;
	padding: 4px 0;
}

/* ----- Content below player ----- */
.ttv-content {
	margin-top: 20px;
}

/* ----- LearnPress complete-lesson button locked state ----- */
.lp-btn-complete-item.ttv-lesson-locked {
	opacity: 0.45;
	cursor: not-allowed;
	filter: grayscale(0.6);
}
