/* Arándano Product Videos — frontend
 * Prefijo apv-, sin resets globales. Variables: --apv-accent (inyectada en línea).
 */

:root {
	--apv-radius: 14px;
	--apv-shadow: 0 18px 40px -12px rgba( 17, 12, 46, 0.35 );
}

/* ---------------------------------------------------------------------------
 * Hover en la tienda
 * ------------------------------------------------------------------------- */
.apv-hover-overlay {
	position: absolute;
	inset: 0;
	overflow: hidden;
	border-radius: inherit;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.45s ease;
	z-index: 2;
}

.apv-hover-overlay video {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transform: scale( 1.02 );
	transition: transform 0.6s ease;
}

.apv-hover-overlay.is-playing {
	opacity: 1;
}

.apv-hover-overlay.is-playing video {
	transform: scale( 1 );
}

/* Indicador de video en mobile (badge) */
.apv-has-badge {
	position: relative;
}

.apv-has-badge > a::after,
.apv-has-badge::after {
	content: "▶";
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 3;
	width: 30px;
	height: 30px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	color: #fff;
	background: rgba( 0, 0, 0, 0.55 );
	backdrop-filter: blur( 4px );
	border-radius: 50%;
	pointer-events: none;
}

/* ---------------------------------------------------------------------------
 * PiP flotante en el producto
 * ------------------------------------------------------------------------- */
.apv-pip {
	position: fixed;
	right: max( 20px, env( safe-area-inset-right ) );
	bottom: max( 20px, env( safe-area-inset-bottom ) );
	width: 280px;
	max-width: calc( 100vw - 32px );
	z-index: 99990;
	border-radius: var( --apv-radius );
	background: #0d0d12;
	box-shadow: var( --apv-shadow );
	overflow: hidden;
	transform: translateY( 130% );
	opacity: 0;
	visibility: hidden;
	transition: transform 0.5s cubic-bezier( 0.22, 1, 0.36, 1 ), opacity 0.4s ease, visibility 0s linear 0.5s;
}

.apv-pip[data-state="visible"] {
	transform: translateY( 0 );
	opacity: 1;
	visibility: visible;
	transition: transform 0.5s cubic-bezier( 0.22, 1, 0.36, 1 ), opacity 0.4s ease;
}

.apv-pip__inner {
	position: relative;
}

.apv-pip__media {
	position: relative;
	aspect-ratio: 16 / 10;
	background: #000;
}

.apv-pip__video {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.apv-pip__close {
	position: absolute;
	top: 8px;
	right: 8px;
	z-index: 4;
	width: 28px;
	height: 28px;
	border: 0;
	border-radius: 50%;
	background: rgba( 0, 0, 0, 0.55 );
	backdrop-filter: blur( 4px );
	color: #fff;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	transition: background 0.2s ease, transform 0.2s ease;
}

.apv-pip__close:hover {
	background: rgba( 0, 0, 0, 0.8 );
	transform: scale( 1.08 );
}

.apv-pip__sound {
	position: absolute;
	bottom: 8px;
	left: 8px;
	z-index: 4;
	width: 30px;
	height: 30px;
	border: 0;
	border-radius: 50%;
	background: rgba( 0, 0, 0, 0.55 );
	backdrop-filter: blur( 4px );
	color: #fff;
	font-size: 14px;
	cursor: pointer;
}

.apv-pip__body {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 10px 12px;
}

.apv-pip__title {
	margin: 0;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.3;
	color: #fff;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.apv-pip__cta {
	flex: 0 0 auto;
	display: inline-block;
	padding: 8px 14px;
	font-size: 12px;
	font-weight: 700;
	text-decoration: none;
	color: #fff;
	background: var( --apv-accent, #6d28d9 );
	border-radius: 999px;
	white-space: nowrap;
	transition: filter 0.2s ease, transform 0.2s ease;
}

.apv-pip__cta:hover {
	filter: brightness( 1.12 );
	transform: translateY( -1px );
	color: #fff;
}

/* Mobile: barra inferior centrada, más compacta */
@media ( max-width: 600px ) {
	.apv-pip {
		right: 12px;
		left: 12px;
		bottom: max( 12px, env( safe-area-inset-bottom ) );
		width: auto;
		max-width: none;
	}

	.apv-pip__media {
		aspect-ratio: 16 / 9;
	}
}

/* Accesibilidad: sin animaciones agresivas */
@media ( prefers-reduced-motion: reduce ) {
	.apv-hover-overlay,
	.apv-hover-overlay video,
	.apv-pip,
	.apv-pip__cta,
	.apv-pip__close {
		transition: none !important;
	}

	.apv-pip {
		transform: none;
	}
}
