/*
 * Vorlesen – Text-to-Speech im Browser: player styles.
 *
 * Every rule is scoped to .btts-player and sets its properties explicitly, so
 * theme styles (Avada, Divi, Elementor …) cannot bend the player. Colours come
 * from CSS custom properties written from the plugin settings.
 */

.btts-hidden,
.btts-player.btts-hidden { display: none !important; }

.btts-player,
.btts-player *,
.btts-player *::before,
.btts-player *::after { box-sizing: border-box !important; }

/* ------------------------------------------------------------------ Card */
.btts-player {
	display: grid !important;
	grid-template-columns: auto minmax(0, 1fr) auto;
	grid-template-areas: "play body controls";
	align-items: center;
	column-gap: 16px;
	row-gap: 10px;
	margin: 0 !important;
	padding: 14px 16px !important;
	background: var(--btts-bg, #f4f5f7) !important;
	color: var(--btts-text, #1d2327) !important;
	border: 1px solid var(--btts-border, #e2e4e7) !important;
	border-radius: var(--btts-radius, 14px) !important;
	box-shadow: 0 1px 2px rgba(16, 24, 40, .04) !important;
	font-family: inherit;
	font-size: 15px !important;
	font-weight: 400 !important;
	line-height: 1.35 !important;
	letter-spacing: normal !important;
	text-align: left !important;
	text-transform: none !important;
	position: relative;
	z-index: 5;
	clear: both;
	-webkit-font-smoothing: antialiased;
}

/* Buttons – reset everything a theme might set on <button>. */
.btts-player .btts-btn {
	-webkit-appearance: none !important;
	appearance: none !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	flex: 0 0 auto;
	position: relative;
	width: auto;
	height: auto;
	min-width: 0 !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 999px !important;
	background: transparent !important;
	box-shadow: none !important;
	color: var(--btts-text, #1d2327) !important;
	font: inherit !important;
	font-size: 13px !important;
	line-height: 1 !important;
	letter-spacing: 0 !important;
	text-transform: none !important;
	text-decoration: none !important;
	text-shadow: none !important;
	cursor: pointer;
	transition: transform .15s ease, background-color .15s ease, opacity .15s ease, box-shadow .15s ease;
}
.btts-player .btts-btn svg {
	display: block !important;
	width: 18px !important;
	height: 18px !important;
	fill: currentColor !important;
	pointer-events: none;
}
.btts-player .btts-btn:focus { outline: none !important; }
.btts-player .btts-btn:focus-visible,
.btts-player .btts-voice-wrap:focus-within,
.btts-player .btts-progress:focus-visible {
	outline: 2px solid var(--btts-accent, #2b59c3) !important;
	outline-offset: 2px !important;
}

/* Play / pause */
.btts-player .btts-play {
	grid-area: play;
	width: 52px !important;
	height: 52px !important;
	background: var(--btts-accent, #2b59c3) !important;
	color: var(--btts-accent-txt, #fff) !important;
	box-shadow: 0 4px 12px -4px var(--btts-accent, #2b59c3) !important;
}
.btts-player .btts-play:hover { transform: scale(1.06); }
.btts-player .btts-play:active { transform: scale(.95); }
.btts-player .btts-play svg { width: 24px !important; height: 24px !important; }
.btts-player .btts-btn .btts-ico-play { margin-left: 3px; }
.btts-player .btts-btn .btts-ico-pause { display: none !important; }
.btts-player.is-playing .btts-btn .btts-ico-play { display: none !important; }
.btts-player.is-playing .btts-btn .btts-ico-pause { display: block !important; }

/* Middle: title, meta, progress */
.btts-player .btts-body {
	grid-area: body;
	display: flex;
	flex-direction: column;
	gap: 9px;
	min-width: 0;
}
.btts-player.btts-layout-card .btts-body {
	flex-direction: row;
	flex-wrap: wrap;
	align-items: center;
	column-gap: 10px;
	row-gap: 9px;
}
.btts-player.btts-layout-card .btts-progress { flex: 1 0 100%; }
.btts-player .btts-head {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 2px 10px;
	min-width: 0;
	margin: 0 !important;
}
.btts-player .btts-title {
	font-size: 15px !important;
	font-weight: 650 !important;
	line-height: 1.3 !important;
	color: var(--btts-text, #1d2327) !important;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 100%;
}
.btts-player .btts-meta {
	display: inline-flex;
	gap: 8px;
	font-size: 13px !important;
	color: var(--btts-text, #1d2327) !important;
	opacity: .68;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}
.btts-player .btts-meta > span:empty { display: none; }
.btts-player .btts-duration:not(:empty) + .btts-status:not(:empty)::before {
	content: "·";
	margin-right: 8px;
}

/* Equalizer – only while playing */
.btts-player .btts-eq {
	display: none;
	align-items: flex-end;
	gap: 2px;
	height: 12px;
}
.btts-player.is-playing .btts-eq { display: inline-flex; }
.btts-player .btts-eq i {
	display: block;
	width: 3px;
	height: 100%;
	border-radius: 2px;
	background: var(--btts-progress, #2b59c3);
	transform-origin: bottom;
	animation: btts-eq 1s ease-in-out infinite;
}
.btts-player .btts-eq i:nth-child(2) { animation-delay: -.45s; }
.btts-player .btts-eq i:nth-child(3) { animation-delay: -.2s; }
.btts-player .btts-eq i:nth-child(4) { animation-delay: -.7s; }
@keyframes btts-eq {
	0%, 100% { transform: scaleY(.3); }
	50% { transform: scaleY(1); }
}

/* Progress */
.btts-player .btts-progress {
	position: relative;
	display: block;
	height: 6px;
	border-radius: 999px;
	background: var(--btts-border, #e2e4e7) !important;
	cursor: pointer;
	transition: height .15s ease;
}
.btts-player .btts-progress::after {
	/* larger hit area */
	content: "";
	position: absolute;
	inset: -9px 0;
}
.btts-player .btts-progress:hover { height: 8px; }
.btts-player .btts-progress-bar {
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	width: 0;
	min-width: 6px;
	border-radius: inherit;
	background: var(--btts-progress, #2b59c3) !important;
	transition: width .3s ease;
}
.btts-player .btts-progress-bar::after {
	/* knob */
	content: "";
	position: absolute;
	right: -6px;
	top: 50%;
	width: 12px;
	height: 12px;
	margin-top: -6px;
	border-radius: 50%;
	background: var(--btts-progress, #2b59c3);
	box-shadow: 0 0 0 3px var(--btts-bg, #f4f5f7);
	opacity: 0;
	transition: opacity .15s ease;
}
.btts-player.is-playing .btts-progress-bar::after,
.btts-player.is-paused .btts-progress-bar::after,
.btts-player .btts-progress:hover .btts-progress-bar::after { opacity: 1; }

/* Right: controls */
.btts-player .btts-controls {
	grid-area: controls;
	display: flex;
	align-items: center;
	gap: 6px;
}
.btts-player .btts-icon-btn {
	width: 36px !important;
	height: 36px !important;
	color: var(--btts-text, #1d2327) !important;
}
.btts-player .btts-icon-btn:hover:not(:disabled) { background: var(--btts-border, #e2e4e7) !important; }
.btts-player .btts-icon-btn:disabled { opacity: .35; cursor: default; }

.btts-player .btts-pill {
	height: 32px !important;
	min-width: 52px !important;
	padding: 0 12px !important;
	border: 1px solid var(--btts-border, #e2e4e7) !important;
	font-weight: 600 !important;
	font-variant-numeric: tabular-nums;
}
.btts-player .btts-pill:hover { background: var(--btts-border, #e2e4e7) !important; }

/* Voice: native select dressed as a pill (keeps mobile pickers & a11y) */
.btts-player .btts-voice-wrap {
	position: relative;
	display: inline-flex;
	align-items: center;
	height: 32px;
	border: 1px solid var(--btts-border, #e2e4e7);
	border-radius: 999px;
	color: var(--btts-text, #1d2327);
}
.btts-player .btts-voice-wrap.btts-empty { display: none !important; }
.btts-player .btts-voice-wrap:hover { background: var(--btts-border, #e2e4e7); }
.btts-player .btts-voice-ico {
	position: absolute;
	left: 10px;
	width: 15px;
	height: 15px;
	fill: currentColor;
	pointer-events: none;
	opacity: .8;
}
.btts-player .btts-voice {
	-webkit-appearance: none !important;
	appearance: none !important;
	display: block !important;
	width: auto !important;
	max-width: 150px !important;
	height: 30px !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0 26px 0 30px !important;
	border: 0 !important;
	border-radius: 999px !important;
	background-color: transparent !important;
	background-image:
		linear-gradient(45deg, transparent 50%, currentColor 50%),
		linear-gradient(135deg, currentColor 50%, transparent 50%) !important;
	background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50% !important;
	background-size: 5px 5px, 5px 5px !important;
	background-repeat: no-repeat !important;
	box-shadow: none !important;
	color: var(--btts-text, #1d2327) !important;
	font: inherit !important;
	font-size: 13px !important;
	line-height: 30px !important;
	cursor: pointer;
	text-overflow: ellipsis;
	white-space: nowrap;
	overflow: hidden;
	outline: none !important;
}
.btts-player .btts-voice option { color: #1d2327; background: #fff; }

.btts-sr {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

/* ----------------------------------------------------- Narrow card (JS) */
.btts-player.btts-layout-card.btts-narrow {
	grid-template-columns: auto minmax(0, 1fr);
	grid-template-areas:
		"play body"
		"controls controls";
	padding: 14px !important;
}
.btts-player.btts-layout-card.btts-narrow .btts-controls {
	justify-content: flex-start;
	padding-top: 10px;
	border-top: 1px solid var(--btts-border, #e2e4e7);
}
.btts-player.btts-layout-card.btts-narrow .btts-stop { margin-left: auto !important; }
.btts-player.btts-narrow .btts-voice { max-width: 120px !important; }

/* ------------------------------------------------------------------ Slim */
.btts-player.btts-layout-slim .btts-progress { display: none !important; }
.btts-player.btts-layout-slim {
	display: flex !important;
	align-items: center;
	gap: 10px;
	padding: 6px 8px 6px 6px !important;
}
.btts-player.btts-layout-slim .btts-play {
	width: 40px !important;
	height: 40px !important;
	box-shadow: 0 3px 8px -4px var(--btts-accent, #2b59c3) !important;
}
.btts-player.btts-layout-slim .btts-play svg { width: 19px !important; height: 19px !important; }
.btts-player.btts-layout-slim .btts-btn .btts-ico-play { margin-left: 2px; }
.btts-player.btts-layout-slim .btts-body {
	flex: 1 1 auto;
	gap: 1px;
}
.btts-player.btts-layout-slim .btts-head { flex-wrap: nowrap; gap: 8px; }
.btts-player.btts-layout-slim .btts-title { font-size: 14px !important; }
.btts-player.btts-layout-slim .btts-meta { font-size: 12px !important; }
.btts-player.btts-layout-slim .btts-meta:empty,
.btts-player.btts-layout-slim .btts-meta:not(:has(span:not(:empty))) { display: none; }
.btts-player.btts-layout-slim .btts-controls { gap: 2px; }
.btts-player.btts-layout-slim .btts-icon-btn { width: 32px !important; height: 32px !important; }
.btts-player.btts-layout-slim .btts-icon-btn svg { width: 16px !important; height: 16px !important; }
.btts-player.btts-layout-slim .btts-pill {
	height: 28px !important;
	min-width: 44px !important;
	margin: 0 2px !important;
	padding: 0 9px !important;
	font-size: 12px !important;
}
.btts-player.btts-layout-slim .btts-voice-wrap { height: 28px; margin: 0 2px; }
.btts-player.btts-layout-slim .btts-voice-ico { left: 8px; width: 13px; height: 13px; }
.btts-player.btts-layout-slim .btts-voice {
	max-width: 112px !important;
	height: 26px !important;
	padding: 0 22px 0 25px !important;
	font-size: 12px !important;
	line-height: 26px !important;
	background-position: calc(100% - 13px) 50%, calc(100% - 8px) 50% !important;
	background-size: 4px 4px, 4px 4px !important;
}

/* Slim on very narrow space: controls move to a second row */
.btts-player.btts-layout-slim.btts-narrow {
	flex-wrap: wrap;
	row-gap: 6px;
	padding: 8px !important;
}
.btts-player.btts-layout-slim.btts-narrow .btts-body { flex-basis: calc(100% - 52px); }
.btts-player.btts-layout-slim.btts-narrow .btts-controls {
	flex-basis: 100%;
	justify-content: space-between;
	padding-top: 6px;
	border-top: 1px solid var(--btts-border, #e2e4e7);
}

/* ------------------------------------------------- Wrapper and alignment */
.btts-wrap {
	display: block;
	margin: 0 0 1.5em !important;
	padding: 0 !important;
	clear: both;
}
.btts-wrap .btts-player {
	width: 100%;
	max-width: var(--btts-width, 100%) !important;
	margin: 0 !important;
}
.btts-wrap.btts-align-center .btts-player { margin-left: auto !important; margin-right: auto !important; }
.btts-wrap.btts-align-right .btts-player { margin-left: auto !important; }

/* ---------------------------------------------------- Highlight in text */
.btts-reading {
	background-color: var(--btts-highlight, #fff3bf) !important;
	box-shadow: 0 0 0 .3em var(--btts-highlight, #fff3bf) !important;
	color: var(--btts-highlight-txt, #1d2327) !important;
	border-radius: 4px;
	transition: background-color .25s ease, box-shadow .25s ease;
}
.btts-reading *:not(a) { color: inherit !important; }

@media (prefers-reduced-motion: reduce) {
	.btts-player *,
	.btts-player,
	.btts-reading { transition: none !important; animation: none !important; }
	.btts-player.is-playing .btts-eq i { transform: scaleY(.7); }
}

@media print {
	.btts-player { display: none !important; }
}
