/*!
 * TTVD TTS — kiểu dáng trình đọc bài viết (Web Speech API)
 */

/* ── Nút "Nghe bài viết" (thu gọn) ─────────────────────────────── */
.ttvd-tts {
	margin: 22px 0 10px;
	line-height: 1.4;
}

.ttvd-tts *,
.ttvd-tts *::before,
.ttvd-tts *::after {
	box-sizing: border-box;
}

.ttvd-tts__pill {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 10px 20px 10px 15px;
	background: #fff;
	border: 1px solid #d9d9d9;
	border-radius: 999px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .07);
	color: #222;
	font-size: 14.5px;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
	transition: border-color .15s ease, box-shadow .15s ease, transform .1s ease;
}

.ttvd-tts__pill:hover {
	border-color: #d0021b;
	box-shadow: 0 2px 8px rgba(208, 2, 27, .12);
}

.ttvd-tts__pill:active {
	transform: scale(.98);
}

.ttvd-tts__pill:focus-visible {
	outline: 2px solid #d0021b;
	outline-offset: 2px;
}

.ttvd-tts__pill svg {
	width: 21px;
	height: 21px;
	flex: 0 0 auto;
	color: #d0021b;
}

/* ── Trình phát mở rộng ────────────────────────────────────────── */
.ttvd-tts__player {
	display: none;
	align-items: center;
	gap: 14px;
	padding: 12px 14px;
	background: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 14px;
	box-shadow: 0 2px 6px rgba(0, 0, 0, .06);
}

.ttvd-tts.is-open .ttvd-tts__pill {
	display: none;
}

.ttvd-tts.is-open .ttvd-tts__player {
	display: flex;
}

.ttvd-tts__toggle {
	flex: 0 0 auto;
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 50%;
	background: #d0021b;
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 2px 5px rgba(208, 2, 27, .35);
	transition: background .15s ease, transform .1s ease;
}

.ttvd-tts__toggle:hover {
	background: #b00216;
}

.ttvd-tts__toggle:active {
	transform: scale(.95);
}

.ttvd-tts__toggle:focus-visible {
	outline: 2px solid #222;
	outline-offset: 2px;
}

.ttvd-tts__toggle svg {
	width: 18px;
	height: 18px;
}

.ttvd-tts__meta {
	flex: 1;
	min-width: 0;
}

.ttvd-tts__row {
	display: flex;
	align-items: center;
	gap: 8px;
}

.ttvd-tts__label {
	flex: 1;
	min-width: 0;
	font-size: 14px;
	font-weight: 700;
	color: #333;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.ttvd-tts__rate {
	flex: 0 0 auto;
	border: 1px solid #d5d5d5;
	background: #fafafa;
	border-radius: 999px;
	font-size: 12.5px;
	font-weight: 700;
	color: #444;
	padding: 4px 11px;
	line-height: 1.2;
	cursor: pointer;
	min-width: 46px;
	text-align: center;
	transition: border-color .15s ease, color .15s ease;
}

.ttvd-tts__rate:hover,
.ttvd-tts__rate:focus-visible {
	border-color: #d0021b;
	color: #d0021b;
	outline: none;
}

.ttvd-tts__close {
	flex: 0 0 auto;
	border: 0;
	background: none;
	color: #999;
	font-size: 22px;
	font-weight: 400;
	line-height: 1;
	cursor: pointer;
	padding: 0 4px;
}

.ttvd-tts__close:hover {
	color: #222;
}

.ttvd-tts__close:focus-visible {
	outline: 2px solid #222;
	outline-offset: 1px;
}

.ttvd-tts__progress {
	margin-top: 8px;
	display: flex;
	align-items: center;
	gap: 10px;
}

.ttvd-tts__track {
	flex: 1;
	display: block;
	height: 5px;
	background: #ededed;
	border-radius: 99px;
	overflow: hidden;
	cursor: pointer;
}

.ttvd-tts__track:focus-visible {
	outline: 2px solid #d0021b;
	outline-offset: 2px;
}

.ttvd-tts__fill {
	display: block;
	height: 100%;
	width: 0;
	background: #d0021b;
	border-radius: 99px;
	transition: width .4s linear;
}

.ttvd-tts__time {
	flex: 0 0 auto;
	font-size: 12px;
	color: #888;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.ttvd-tts__msg {
	display: none;
	margin-top: 7px;
	font-size: 12.5px;
	line-height: 1.45;
	color: #c0392b;
}

.ttvd-tts.has-error .ttvd-tts__msg {
	display: block;
}

/* ── Highlight khối đang đọc ───────────────────────────────────── */
.ttvd-tts-reading {
	background: linear-gradient(transparent 45%, #fff1a8 45%);
	border-radius: 2px;
}

/* ── Ẩn nút chia sẻ đầu bài trên desktop ── đã có khối "Lan tỏa bài viết
   này" ở cuối bài; mobile/tablet vẫn giữ để tiện chia sẻ nhanh ───── */
@media (min-width: 992px) {
	.tvd-share-top {
		display: none;
	}
}

/* ── Mobile ────────────────────────────────────────────────────── */
@media (max-width: 600px) {
	.ttvd-tts {
		margin: 16px 0 8px;
	}

	.ttvd-tts__pill {
		font-size: 14px;
		padding: 9px 17px 9px 13px;
	}

	.ttvd-tts__player {
		gap: 10px;
		padding: 10px 11px;
		border-radius: 12px;
	}

	.ttvd-tts__toggle {
		width: 40px;
		height: 40px;
	}

	.ttvd-tts__label {
		font-size: 13px;
	}

	.ttvd-tts__time {
		font-size: 11px;
	}
}
