/**
 * Article Text-to-Speech Player stylesheet
 * Premium Trinity Audio-like styling with clean typography and responsiveness.
 */

:root {
	--attsp-primary: #000000;
	--attsp-primary-hover: #1f2937;
	--attsp-primary-light: #dbeafe;
	--attsp-gradient: linear-gradient(135deg, #000000 0%, #1f2937 100%);
	--attsp-bg: #EDF2FE;
	--attsp-border: rgba(147, 197, 253, 0.5);
	--attsp-text-main: #000000;
	--attsp-text-muted: #1f2937;
	--attsp-shadow: 0 4px 15px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
}

/* Base Player Container */
.article-tts-player {
	margin: 24px 0;
	padding: 16px 20px;
	background: var(--attsp-bg);
	border: 1px solid var(--attsp-border);
	border-radius: 16px;
	box-shadow: var(--attsp-shadow);
	font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	box-sizing: border-box;
	transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.article-tts-player * {
	box-sizing: border-box;
}

.article-tts-player:hover {
	border-color: rgba(0, 0, 0, 0.15);
	box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 4px 12px -2px rgba(15, 23, 42, 0.05);
}

/* Player layout */
.article-tts-player-inner {
	display: flex;
	align-items: center;
	gap: 20px;
}

/* Control Section (Play Button) */
.article-tts-control-section {
	flex-shrink: 0;
}

.article-tts-play-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 52px;
	height: 52px;
	border-radius: 50%;
	border: none;
	background: var(--attsp-gradient);
	color: #ffffff;
	cursor: pointer;
	padding: 0;
	margin: 0;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
	transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease, background 0.2s ease;
	outline: none;
}

.article-tts-play-btn:hover {
	transform: scale(1.08);
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
	background: linear-gradient(135deg, #1f2937 0%, #000000 100%);
}

.article-tts-play-btn:active {
	transform: scale(0.96);
}

.article-tts-play-btn svg {
	width: 22px;
	height: 22px;
	transition: transform 0.2s ease;
}

/* Info and Progress Section */
.article-tts-info-section {
	flex-grow: 1;
	display: flex;
	flex-direction: column;
	gap: 10px;
	min-width: 0; /* Prevents text overflow bugs in flex containers */
}

/* Title & Attribution Header */
.article-tts-header {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 12px;
	flex-wrap: wrap;
}

.article-tts-title {
	font-size: 15px;
	font-weight: 700;
	color: var(--attsp-text-main);
	letter-spacing: -0.01em;
}

.article-tts-author {
	font-size: 12px;
	color: var(--attsp-text-muted);
}

.article-tts-author strong {
	color: var(--attsp-text-main);
	font-weight: 600;
}

/* Progress Wrapper */
.article-tts-progress-wrapper {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

/* Progress Track */
.article-tts-progress-track {
	position: relative;
	height: 6px;
	background: #ffffff;
	border: 1px solid var(--attsp-border);
	border-radius: 10px;
	cursor: pointer;
	overflow: hidden;
}

/* Progress Bar Fill */
.article-tts-progress-bar {
	position: absolute;
	left: 0;
	top: 0;
	height: 100%;
	width: 0%;
	background: var(--attsp-primary);
	border-radius: 10px;
	transition: width 0.15s linear;
}

/* Time Indicator */
.article-tts-time-display {
	display: flex;
	justify-content: space-between;
	font-size: 11px;
	color: var(--attsp-text-muted);
	font-weight: 500;
	font-variant-numeric: tabular-nums;
}

/* Settings and Speed Section */
.article-tts-settings-section {
	position: relative;
	flex-shrink: 0;
}

.article-tts-speed-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: #ffffff;
	border: 1px solid var(--attsp-border);
	color: var(--attsp-text-main);
	font-size: 12px;
	font-weight: 600;
	padding: 8px 14px;
	border-radius: 20px;
	cursor: pointer;
	outline: none;
	transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.article-tts-speed-btn:hover,
.article-tts-speed-btn:focus {
	background-color: #f1f5f9;
	border-color: #94a3b8;
	color: #0f172a;
}

/* Dropdown styling */
.article-tts-speed-dropdown {
	position: absolute;
	bottom: 100%;
	right: 0;
	margin-bottom: 8px;
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 10px;
	box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
	display: none;
	flex-direction: column;
	padding: 6px 0;
	min-width: 130px;
	z-index: 9999;
}

.article-tts-speed-dropdown.active {
	display: flex;
	animation: attspFadeInUp 0.15s ease-out;
}

.article-tts-speed-dropdown button {
	background: none;
	border: none;
	padding: 8px 16px;
	text-align: left;
	font-size: 13px;
	color: var(--attsp-text-main);
	cursor: pointer;
	width: 100%;
	outline: none;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.article-tts-speed-dropdown button:hover {
	background-color: #f1f5f9;
	color: var(--attsp-primary);
}

.article-tts-speed-dropdown button.selected {
	background-color: var(--attsp-primary-light);
	color: var(--attsp-primary);
	font-weight: 600;
}

/* Animation */
@keyframes attspFadeInUp {
	from {
		opacity: 0;
		transform: translateY(4px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Mobile Optimizations */
@media (max-width: 640px) {
	.article-tts-player-inner {
		flex-wrap: wrap;
		gap: 16px;
	}

	.article-tts-info-section {
		width: calc(100% - 72px); /* Fill space next to play button */
	}

	.article-tts-settings-section {
		width: 100%;
		display: flex;
		justify-content: flex-end;
		border-top: 1px solid #e2e8f0;
		padding-top: 12px;
		margin-top: 4px;
	}

	.article-tts-speed-dropdown {
		bottom: auto;
		top: 100%;
		margin-top: 8px;
		margin-bottom: 0;
	}
}

@media (max-width: 480px) {
	.article-tts-player {
		padding: 12px 14px;
		border-radius: 12px;
	}

	.article-tts-player-inner {
		gap: 12px;
	}

	.article-tts-play-btn {
		width: 46px;
		height: 46px;
	}

	.article-tts-play-btn svg {
		width: 20px;
		height: 20px;
	}

	.article-tts-info-section {
		width: calc(100% - 58px);
		gap: 8px;
	}

	.article-tts-title {
		font-size: 13.5px;
	}

	.article-tts-author {
		font-size: 11px;
	}
}
