/**
 * AIO Product Videos — Estilos del frontend.
 *
 * El plugin renderiza su propia sección independiente ANTES de la galería
 * del tema (prioridad 5), compatible con Flatsome y cualquier otro tema.
 *
 * Estructura:
 *  1. Contenedor general
 *  2. Video destacado (primero, grande)
 *  3. Fila de videos adicionales
 *  4. Overlay de play (compartido)
 *  5. Placeholder Vimeo (compartido)
 *  6. Modal / Lightbox
 *  7. Loader / error
 *  8. Responsive (mobile-first)
 *  9. Reducción de movimiento
 */

/* =============================================================================
   1. Contenedor general
   ============================================================================= */

.aio-pv-wrap {
	margin-bottom: 1.5rem;
	position: relative;
	width: 100%;
	z-index: 10; /* por encima de overlays internos de Flatsome */
}

/* Forzar que los botones sean siempre clickeables */
.aio-pv-featured-btn,
.aio-pv-extra-btn {
	position: relative;
	z-index: 11;
	pointer-events: all !important;
}

/* =============================================================================
   2. Video destacado — grande, ocupa todo el ancho disponible
   ============================================================================= */

.aio-pv-featured {
	width: 100%;
}

/* Reset completo del botón para no heredar estilos del tema. */
.aio-pv-featured-btn {
	appearance: none;
	background: none;
	border: none;
	cursor: pointer;
	display: block;
	margin: 0;
	padding: 0;
	text-align: left;
	width: 100%;
}

.aio-pv-featured-btn:focus-visible {
	outline: 3px solid #0073aa;
	outline-offset: 3px;
}

.aio-pv-featured-inner {
	aspect-ratio: 16 / 9;
	background-color: #111;
	border-radius: 4px;
	overflow: hidden;
	position: relative;
	width: 100%;
}

.aio-pv-featured-img {
	display: block;
	height: 100%;
	object-fit: cover;
	width: 100%;
}

.aio-pv-featured-title {
	color: inherit;
	display: block;
	font-size: 0.9rem;
	line-height: 1.4;
	margin-top: 0.5rem;
}

/* =============================================================================
   3. Fila de videos adicionales (thumbnails pequeños debajo del destacado)
   ============================================================================= */

.aio-pv-extra-row {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 8px;
}

.aio-pv-extra-item {
	flex: 0 0 auto;
	width: calc(25% - 6px); /* 4 por fila con gap de 8px */
}

/* Reset del botón. */
.aio-pv-extra-btn {
	appearance: none;
	background: none;
	border: none;
	cursor: pointer;
	display: block;
	margin: 0;
	padding: 0;
	width: 100%;
}

.aio-pv-extra-btn:focus-visible {
	outline: 3px solid #0073aa;
	outline-offset: 2px;
}

.aio-pv-extra-inner {
	aspect-ratio: 16 / 9;
	background-color: #111;
	border-radius: 3px;
	overflow: hidden;
	position: relative;
	width: 100%;
}

.aio-pv-extra-img {
	display: block;
	height: 100%;
	object-fit: cover;
	width: 100%;
}

/* =============================================================================
   4. Overlay de play (compartido por featured y extra)
   ============================================================================= */

.aio-pv-play-overlay {
	align-items: center;
	display: flex;
	inset: 0;
	justify-content: center;
	position: absolute;
	transition: background-color 0.18s ease;
	z-index: 2;
}

.aio-pv-featured-btn:hover .aio-pv-play-overlay,
.aio-pv-featured-btn:focus-visible .aio-pv-play-overlay,
.aio-pv-extra-btn:hover .aio-pv-play-overlay,
.aio-pv-extra-btn:focus-visible .aio-pv-play-overlay {
	background-color: rgba(0, 0, 0, 0.22);
}

.aio-pv-play-icon {
	filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.55));
	height: auto;
	transition: transform 0.18s ease;
	width: 46px;
}

/* Versión grande para el video destacado. */
.aio-pv-play-icon--large {
	width: 80px;
}

.aio-pv-featured-btn:hover .aio-pv-play-icon,
.aio-pv-featured-btn:focus-visible .aio-pv-play-icon,
.aio-pv-extra-btn:hover .aio-pv-play-icon,
.aio-pv-extra-btn:focus-visible .aio-pv-play-icon {
	transform: scale(1.1);
}

/* Fondo rojo del ícono YouTube. */
.aio-pv-play-bg {
	fill: #ff0000;
	fill-opacity: 0.92;
}

/* Flecha blanca. */
.aio-pv-play-arrow {
	fill: #fff;
}

/* =============================================================================
   5. Placeholder Vimeo (compartido)
   ============================================================================= */

.aio-pv-thumb-placeholder {
	align-items: center;
	background: linear-gradient(135deg, #1ab7ea 0%, #0d6fa8 100%);
	display: flex;
	height: 100%;
	justify-content: center;
	width: 100%;
}

.aio-pv-vimeo-logo {
	fill: #fff;
	height: auto;
	opacity: 0.9;
	width: 40px;
}

/* =============================================================================
   6. Modal / Lightbox
   ============================================================================= */

.aio-pv-modal {
	align-items: center;
	display: flex !important; /* !important evita que Flatsome lo oculte con su propio CSS */
	inset: 0;
	justify-content: center;
	position: fixed;
	z-index: 999999;
}

/* JS maneja display via style="" — este selector es el fallback. */
.aio-pv-modal[hidden] {
	display: none !important;
}

.aio-pv-modal-overlay {
	background-color: rgba(0, 0, 0, 0.86);
	cursor: pointer;
	inset: 0;
	position: absolute;
}

.aio-pv-modal-content {
	max-width: 960px;
	position: relative;
	width: calc(100% - 2rem);
	z-index: 1;
}

.aio-pv-modal-close {
	align-items: center;
	appearance: none;
	background: rgba(0, 0, 0, 0.65);
	border: 2px solid rgba(255, 255, 255, 0.85);
	border-radius: 50%;
	color: #fff;
	cursor: pointer;
	display: flex;
	height: 40px;
	justify-content: center;
	padding: 0;
	position: absolute;
	right: -16px;
	top: -16px;
	transition: background-color 0.18s ease, transform 0.18s ease;
	width: 40px;
	z-index: 2;
}

.aio-pv-modal-close:hover,
.aio-pv-modal-close:focus-visible {
	background: rgba(0, 0, 0, 0.92);
	transform: scale(1.1);
}

.aio-pv-modal-close:focus-visible {
	outline: 3px solid #fff;
	outline-offset: 2px;
}

.aio-pv-modal-close svg {
	fill: #fff;
	height: 24px;
	pointer-events: none;
	width: 24px;
}

.aio-pv-modal-player {
	aspect-ratio: 16 / 9;
	background-color: #000;
	border-radius: 4px;
	overflow: hidden;
	position: relative;
	width: 100%;
}

.aio-pv-iframe {
	border: none;
	display: block;
	height: 100%;
	left: 0;
	position: absolute;
	top: 0;
	width: 100%;
}

/* =============================================================================
   7. Loader y mensaje de error
   ============================================================================= */

.aio-pv-loader {
	align-items: center;
	color: #fff;
	display: flex;
	font-size: 0.9rem;
	height: 100%;
	justify-content: center;
	left: 0;
	position: absolute;
	top: 0;
	width: 100%;
}

.aio-pv-loader.is-hidden {
	display: none;
}

.aio-pv-error {
	color: #fff;
	font-size: 0.9rem;
	margin: 0;
	padding: 1.5rem;
	text-align: center;
}

/* =============================================================================
   8. Responsive (mobile-first)
   ============================================================================= */

/* En móviles: thumbnails extras en 3 columnas. */
@media (max-width: 480px) {
	.aio-pv-extra-item {
		width: calc(33.333% - 6px);
	}

	.aio-pv-modal-close {
		right: 0;
		top: -44px;
	}
}

/* En tablets: 4 columnas (por defecto). */
@media (min-width: 481px) and (max-width: 768px) {
	.aio-pv-extra-item {
		width: calc(25% - 6px);
	}
}

/* =============================================================================
   9. Reducción de movimiento
   ============================================================================= */

@media (prefers-reduced-motion: reduce) {
	.aio-pv-play-icon,
	.aio-pv-play-overlay,
	.aio-pv-modal-close {
		transition: none;
	}

	.aio-pv-featured-btn:hover .aio-pv-play-icon,
	.aio-pv-extra-btn:hover .aio-pv-play-icon,
	.aio-pv-modal-close:hover {
		transform: none;
	}
}
