/**
 * AGFO Cmx Full Width - media experience styles.
 * Prompt card and the realistic MediaElement audio player skin. Themed with --agfo-primary.
 */

/* ------------------------------------------------------------------
 * Prompt card
 * ---------------------------------------------------------------- */

.agfo-media-prompt {
	position: fixed;
	right: 24px;
	bottom: 24px;
	z-index: 99990;
	display: flex;
	align-items: flex-start;
	gap: 14px;
	max-width: 360px;
	padding: 18px 20px;
	background: #ffffff;
	border: 1px solid rgba(15, 23, 42, 0.08);
	border-radius: 16px;
	box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
	opacity: 0;
	transform: translateY(16px);
	transition: opacity 0.3s ease, transform 0.3s ease;
}

.agfo-media-prompt.is-open {
	opacity: 1;
	transform: translateY(0);
}

.agfo-media-prompt-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 42px;
	height: 42px;
	border-radius: 12px;
	background: color-mix(in srgb, var(--agfo-primary, #a61e30) 12%, #ffffff);
	color: var(--agfo-primary, #a61e30);
}

.agfo-media-prompt-text {
	margin: 0 0 12px;
	font-size: 14.5px;
	line-height: 1.5;
	color: #1f2937;
}

.agfo-media-prompt-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.agfo-media-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 36px;
	padding: 7px 16px;
	border: 0;
	border-radius: 999px;
	font-size: 13.5px;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
	transition: filter 0.15s ease, background 0.15s ease;
}

.agfo-media-btn-primary {
	background: var(--agfo-primary, #a61e30);
	color: #ffffff;
}

.agfo-media-btn-primary:hover {
	filter: brightness(1.1);
}

.agfo-media-btn-ghost {
	background: transparent;
	color: #6b7280;
}

.agfo-media-btn-ghost:hover {
	background: rgba(15, 23, 42, 0.06);
	color: #374151;
}

/* ------------------------------------------------------------------
 * Main player attention pulse (after accepting the audio prompt)
 * ---------------------------------------------------------------- */

.agfo-media-highlight {
	animation: agfo-media-pulse 1s ease 2;
}

@keyframes agfo-media-pulse {
	0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--agfo-primary, #a61e30) 45%, transparent); }
	100% { box-shadow: 0 0 0 14px rgba(0, 0, 0, 0); }
}

/* ------------------------------------------------------------------
 * Realistic MediaElement audio player skin (body.agfo-media-skin)
 *
 * CHANGED: full rewrite. Sprite icons stay at their native 20x20 size so
 * the MediaElement icon sheet never shifts; the play button gets its
 * colored circle from the wrapper instead of a scaled sprite. Progress
 * and volume bars are vertically centered with absolute positioning
 * (the old margin hack painted a stray bar under the player).
 * ---------------------------------------------------------------- */

body.agfo-media-skin .entry-content .wp-audio-shortcode,
body.agfo-media-skin .entry-content .mejs-audio.mejs-container {
	width: calc(100% - 32px) !important;
	max-width: var(--agfo-audio-player-max, 1120px) !important;
	margin: 1.5rem auto !important;
}

body.agfo-media-skin .mejs-audio.mejs-container {
	position: relative;
	height: 84px !important;
	padding: 0;
	box-sizing: border-box;
	border: 1px solid rgba(15, 23, 42, 0.08);
	border-radius: 22px;
	background: linear-gradient(145deg, #ffffff 0%, #fbfcfd 55%, #f4f7f6 100%);
	box-shadow: 0 18px 46px rgba(15, 23, 42, 0.09), 0 4px 12px rgba(15, 23, 42, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.9);
	overflow: hidden;
}

body.agfo-media-skin .mejs-audio.mejs-container::before {
	content: '';
	position: absolute;
	inset: 0 0 auto 0;
	z-index: 2;
	height: 3px;
	background: linear-gradient(90deg, var(--agfo-primary, #a61e30) 0%, color-mix(in srgb, var(--agfo-primary, #a61e30) 45%, transparent) 34%, transparent 72%);
	opacity: 0.9;
	pointer-events: none;
}

body.agfo-media-skin .mejs-audio .mejs-inner {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}

body.agfo-media-skin .mejs-audio .mejs-controls {
	position: absolute !important;
	inset: 0 !important;
	display: grid !important;
	grid-template-columns: 52px 72px minmax(120px, 1fr) 72px 42px 92px;
	gap: 12px;
	align-items: center;
	width: 100% !important;
	height: 100% !important;
	padding: 14px 18px !important;
	background: transparent !important;
}

body.agfo-media-skin .mejs-audio .mejs-controls .mejs-button {
	position: relative;
	display: grid;
	place-items: center;
	width: auto;
	height: 52px;
	margin: 0;
	background: transparent;
}

body.agfo-media-skin .mejs-audio .mejs-controls .mejs-button > button {
	background-image: none !important;
	outline: 0;
}

/* Play / pause: custom CSS icon instead of the unchanged MediaElement sprite. */
body.agfo-media-skin .mejs-audio .mejs-controls .mejs-playpause-button {
	grid-column: 1;
	width: 52px;
	height: 52px;
	border: 2px solid rgba(255, 255, 255, 0.8);
	border-radius: 50%;
	background: linear-gradient(135deg, color-mix(in srgb, var(--agfo-primary, #a61e30) 82%, #ffffff 18%), var(--agfo-primary, #a61e30));
	box-shadow: 0 10px 22px color-mix(in srgb, var(--agfo-primary, #a61e30) 32%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.25);
	transition: transform 0.14s ease, filter 0.18s ease, box-shadow 0.18s ease;
}

body.agfo-media-skin .mejs-audio .mejs-controls .mejs-playpause-button:hover {
	filter: brightness(1.05);
	box-shadow: 0 13px 26px color-mix(in srgb, var(--agfo-primary, #a61e30) 40%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

body.agfo-media-skin .mejs-audio .mejs-controls .mejs-playpause-button:active {
	transform: scale(0.97);
}

body.agfo-media-skin .mejs-audio .mejs-controls .mejs-playpause-button > button {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	background: none !important;
	color: #ffffff;
	font-size: 0;
}

body.agfo-media-skin .mejs-playpause-button.mejs-play > button::before {
	content: '';
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-38%, -50%);
	border-top: 9px solid transparent;
	border-bottom: 9px solid transparent;
	border-left: 14px solid #ffffff;
	filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.14));
}

body.agfo-media-skin .mejs-playpause-button.mejs-pause > button::before,
body.agfo-media-skin .mejs-playpause-button.mejs-pause > button::after {
	content: '';
	position: absolute;
	top: 50%;
	width: 5px;
	height: 19px;
	border-radius: 2px;
	background: #ffffff;
	box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12);
}

body.agfo-media-skin .mejs-playpause-button.mejs-pause > button::before {
	left: 50%;
	transform: translate(-7px, -50%);
}

body.agfo-media-skin .mejs-playpause-button.mejs-pause > button::after {
	left: 50%;
	transform: translate(3px, -50%);
}

/* Time labels are centered and visually separate from the rail. */
body.agfo-media-skin .mejs-audio .mejs-controls .mejs-time {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 40px;
	padding: 0 10px;
	box-sizing: border-box;
	border: 1px solid rgba(15, 23, 42, 0.05);
	border-radius: 13px;
	background: rgba(248, 250, 252, 0.95);
	box-shadow: inset 0 1px 0 #ffffff;
	font-size: 13px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.01em;
	color: #334155;
}

body.agfo-media-skin .mejs-audio .mejs-controls .mejs-currenttime-container {
	grid-column: 2;
}

body.agfo-media-skin .mejs-audio .mejs-controls .mejs-duration-container {
	grid-column: 4;
}

/* Progress rail. Explicit grid sizing overrides MediaElement's inline width calculation. */
body.agfo-media-skin .mejs-audio .mejs-controls .mejs-time-rail {
	position: relative;
	grid-column: 3;
	width: 100% !important;
	height: 48px;
	margin: 0 !important;
	padding: 0 !important;
}

body.agfo-media-skin .mejs-audio .mejs-controls .mejs-time-total {
	position: absolute;
	top: 50%;
	left: 0;
	width: 100% !important;
	height: 9px;
	margin: 0 !important;
	transform: translateY(-50%);
	border-radius: 999px;
	background: #dce3e8;
	box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.12);
	overflow: visible;
}

body.agfo-media-skin .mejs-audio .mejs-controls .mejs-time-buffering,
body.agfo-media-skin .mejs-audio .mejs-controls .mejs-time-loaded {
	top: 0;
	height: 9px;
	border-radius: 999px;
	background: #cbd5dc;
}

body.agfo-media-skin .mejs-audio .mejs-controls .mejs-time-current {
	top: 0;
	height: 9px;
	border-radius: 999px;
	background: linear-gradient(90deg, color-mix(in srgb, var(--agfo-primary, #a61e30) 76%, #ffffff 24%), var(--agfo-primary, #a61e30));
	box-shadow: 0 2px 8px color-mix(in srgb, var(--agfo-primary, #a61e30) 22%, transparent);
	overflow: visible;
}

body.agfo-media-skin .mejs-audio .mejs-controls .mejs-time-current::after {
	content: '';
	position: absolute;
	right: -7px;
	top: 50%;
	width: 16px;
	height: 16px;
	transform: translateY(-50%);
	border: 3px solid var(--agfo-primary, #a61e30);
	border-radius: 50%;
	background: #ffffff;
	box-shadow: 0 3px 10px rgba(15, 23, 42, 0.2);
}

body.agfo-media-skin .mejs-audio .mejs-controls .mejs-time-hovered,
body.agfo-media-skin .mejs-audio .mejs-controls .mejs-time-handle,
body.agfo-media-skin .mejs-audio .mejs-controls .mejs-time-float {
	display: none;
}

/* Volume button: custom speaker icon, no MediaElement sprite. */
body.agfo-media-skin .mejs-audio .mejs-controls .mejs-volume-button {
	grid-column: 5;
	width: 42px;
	height: 42px;
	border: 1px solid rgba(15, 23, 42, 0.05);
	border-radius: 13px;
	background: rgba(248, 250, 252, 0.92);
}

body.agfo-media-skin .mejs-audio .mejs-controls .mejs-volume-button > button {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	background: none !important;
	color: #475569;
	font-size: 0;
}

body.agfo-media-skin .mejs-audio .mejs-controls .mejs-volume-button > button::before {
	content: '';
	position: absolute;
	left: 10px;
	top: 11px;
	width: 20px;
	height: 20px;
	background: currentColor;
	clip-path: polygon(0 36%, 30% 36%, 62% 8%, 62% 92%, 30% 64%, 0 64%);
}

body.agfo-media-skin .mejs-audio .mejs-controls .mejs-volume-button.mejs-mute > button::after {
	content: '';
	position: absolute;
	right: 7px;
	top: 12px;
	width: 9px;
	height: 16px;
	border-right: 2px solid currentColor;
	border-radius: 0 100% 100% 0;
}

body.agfo-media-skin .mejs-audio .mejs-controls .mejs-volume-button.mejs-unmute > button::after {
	content: '';
	position: absolute;
	right: 8px;
	top: 11px;
	width: 2px;
	height: 20px;
	border-radius: 2px;
	background: currentColor;
	transform: rotate(-45deg);
}

/* Compact horizontal volume rail. */
body.agfo-media-skin .mejs-audio .mejs-controls .mejs-horizontal-volume-slider {
	position: relative;
	grid-column: 6;
	width: 92px !important;
	height: 48px;
	margin: 0 !important;
}

body.agfo-media-skin .mejs-audio .mejs-controls .mejs-horizontal-volume-total {
	position: absolute;
	top: 50%;
	left: 0;
	width: 92px !important;
	height: 7px;
	margin: 0 !important;
	transform: translateY(-50%);
	border-radius: 999px;
	background: #dce3e8;
	box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.1);
	overflow: visible;
}

body.agfo-media-skin .mejs-audio .mejs-controls .mejs-horizontal-volume-current {
	position: absolute;
	left: 0;
	top: 0;
	height: 100%;
	border-radius: 999px;
	background: var(--agfo-primary, #a61e30);
	overflow: visible;
}

body.agfo-media-skin .mejs-audio .mejs-controls .mejs-horizontal-volume-current::after {
	content: '';
	position: absolute;
	right: -6px;
	top: 50%;
	width: 14px;
	height: 14px;
	transform: translateY(-50%);
	border: 3px solid var(--agfo-primary, #a61e30);
	border-radius: 50%;
	background: #ffffff;
	box-shadow: 0 3px 9px rgba(15, 23, 42, 0.18);
}

body.agfo-media-skin .mejs-audio .mejs-controls .mejs-horizontal-volume-handle {
	display: none;
}

/* ------------------------------------------------------------------
 * Small screens
 * ---------------------------------------------------------------- */

@media (max-width: 780px) {
	.agfo-media-prompt {
		right: 12px;
		bottom: 12px;
		left: 12px;
		max-width: none;
	}

	body.agfo-media-skin .entry-content .wp-audio-shortcode,
	body.agfo-media-skin .entry-content .mejs-audio.mejs-container {
		width: 100% !important;
	}

	body.agfo-media-skin .mejs-audio.mejs-container {
		height: 76px !important;
		border-radius: 18px;
	}

	body.agfo-media-skin .mejs-audio .mejs-controls {
		grid-template-columns: 46px 60px minmax(80px, 1fr) 60px 38px;
		gap: 8px;
		padding: 12px !important;
	}

	body.agfo-media-skin .mejs-audio .mejs-controls .mejs-playpause-button {
		width: 46px;
		height: 46px;
	}

	body.agfo-media-skin .mejs-audio .mejs-controls .mejs-time {
		height: 36px;
		padding: 0 7px;
		font-size: 12px;
	}

	body.agfo-media-skin .mejs-audio .mejs-controls .mejs-volume-button {
		grid-column: 5;
		width: 38px;
		height: 38px;
	}

	body.agfo-media-skin .mejs-audio .mejs-controls .mejs-horizontal-volume-slider {
		display: none;
	}
}

@media (max-width: 500px) {
	body.agfo-media-skin .mejs-audio .mejs-controls {
		grid-template-columns: 44px 54px minmax(70px, 1fr) 54px;
		gap: 7px;
		padding: 10px !important;
	}

	body.agfo-media-skin .mejs-audio .mejs-controls .mejs-volume-button {
		display: none;
	}

	body.agfo-media-skin .mejs-audio .mejs-controls .mejs-time {
		padding: 0 5px;
		font-size: 11.5px;
	}
}


/* HTTPS audio-source failure notice. */
body.agfo-media-skin .agfo-media-security-notice {
	width: min(1120px, calc(100% - 32px));
	margin: 10px auto 1.25rem;
	padding: 10px 14px;
	border: 1px solid color-mix(in srgb, #b91c1c 30%, transparent);
	border-radius: 10px;
	background: #fff7f7;
	color: #7f1d1d;
	font-size: 13px;
	line-height: 1.45;
}
