/**
 * [product_video] — floating red icon (default) or inline embed (mode="inline").
 *
 * @package NexuWcProductCdn
 */

/* —— Floating button (default): icon only, bottom-left —— */
.nwpc-product-video-fab {
	position: fixed;
	left: 16px;
	right: auto;
	bottom: 82px;
	top: auto;
	/* Below video modal, above typical sticky header / mini-cart */
	z-index: 2147483646;
	display: flex;
	align-items: center;
	justify-content: center;
	width: auto;
	min-width: 0;
	max-width: none;
	height: auto;
	box-sizing: border-box;
	flex-shrink: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	box-shadow: none;
	text-decoration: none;
	cursor: pointer;
	transform: none;
	transition: transform 0.2s ease;
}

.nwpc-product-video-fab:hover,
.nwpc-product-video-fab:focus-visible {
	transform: scale(1.06);
	box-shadow: none;
	outline: none;
}

.nwpc-product-video-fab,
.nwpc-product-video-fab__icon {
	overflow: visible;
}

/* Icon + “signal” rings (ripple + rotating highlight) */
.nwpc-product-video-fab__icon {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	line-height: 0;
}

.nwpc-product-video-fab__icon::before {
	content: '';
	position: absolute;
	left: 50%;
	top: 50%;
	width: 56px;
	height: 56px;
	margin: -28px 0 0 -28px;
	border-radius: 50%;
	border: 2px solid rgba(220, 38, 38, 0.55);
	animation: nwpc-pv-signal-ripple 2.2s cubic-bezier(0, 0, 0.2, 1) infinite;
	pointer-events: none;
	transition: opacity 0.45s ease;
}

.nwpc-product-video-fab__icon::after {
	content: '';
	position: absolute;
	left: 50%;
	top: 50%;
	width: 72px;
	height: 72px;
	margin: -36px 0 0 -36px;
	border-radius: 50%;
	border: 2px solid rgba(220, 38, 38, 0.35);
	border-top-color: #dc2626;
	border-right-color: rgba(220, 38, 38, 0.15);
	animation: nwpc-pv-signal-spin 1.35s linear infinite;
	pointer-events: none;
	transition: opacity 0.45s ease;
}

/* Signal rings stop after 6s (class added via product-video-shortcode.js). */
.nwpc-product-video-fab--signal-ended .nwpc-product-video-fab__icon::before,
.nwpc-product-video-fab--signal-ended .nwpc-product-video-fab__icon::after {
	animation: none;
	opacity: 0;
}

.nwpc-product-video-fab__icon svg {
	position: relative;
	z-index: 1;
	display: block;
	width: 56px;
	height: 56px;
	filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.12));
}

@keyframes nwpc-pv-signal-ripple {
	0% {
		transform: scale(0.88);
		opacity: 0.75;
	}
	70% {
		opacity: 0.15;
	}
	100% {
		transform: scale(1.75);
		opacity: 0;
	}
}

@keyframes nwpc-pv-signal-spin {
	to {
		transform: rotate(360deg);
	}
}

[dir="rtl"] .nwpc-product-video-fab {
	left: auto;
	right: 16px;
}

/* —— Modal —— */
#nwpc-pv-modal {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 2147483647;
	align-items: center;
	justify-content: center;
	padding: 24px;
	box-sizing: border-box;
	background: rgba(2, 6, 23, 0.82);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
}

#nwpc-pv-modal.is-open {
	display: flex;
}

#nwpc-pv-modal .nwpc-pv-modal__backdrop {
	position: absolute;
	inset: 0;
	z-index: 1;
}

#nwpc-pv-modal .nwpc-pv-modal__inner {
	position: relative;
	z-index: 2;
	width: min(96vw, 960px);
	max-height: 90vh;
	aspect-ratio: 16 / 9;
	background: #000;
	border-radius: 14px;
	overflow: hidden;
	box-shadow: 0 25px 60px rgba(0, 0, 0, 0.55);
}

#nwpc-pv-modal-iframe {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
}

#nwpc-pv-modal-video.nwpc-pv-modal__video {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	background: #000;
}

#nwpc-pv-modal-close {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 3;
	width: 40px;
	height: 40px;
	margin: 0;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s ease;
}

#nwpc-pv-modal-close:hover,
#nwpc-pv-modal-close:focus-visible {
	background: rgba(220, 38, 38, 0.75);
	outline: none;
}

[dir="rtl"] #nwpc-pv-modal-close {
	right: auto;
	left: 12px;
}

/* —— Inline mode (mode="inline") ——
   Do not target .nwpc-product-video-fab: default shortcode class is also
   nwpc-product-video; a later rule was forcing width:100% on the FAB link. */
.nwpc-product-video:not(.nwpc-product-video-fab) {
	width: 100%;
	max-width: 100%;
}

.nwpc-product-video:not(.nwpc-product-video-fab) .wp-block-embed,
.nwpc-product-video:not(.nwpc-product-video-fab) .wp-block-embed__wrapper {
	width: 100%;
	max-width: 100%;
}

.nwpc-product-video:not(.nwpc-product-video-fab) iframe {
	max-width: 100%;
}

.nwpc-product-video:not(.nwpc-product-video-fab) .nwpc-product-video-inline {
	display: block;
	width: 100%;
	max-width: 100%;
	height: auto;
}

@media (prefers-reduced-motion: reduce) {
	.nwpc-product-video-fab,
	.nwpc-product-video-fab:hover,
	.nwpc-product-video-fab:focus-visible {
		transition: none;
		transform: none;
	}

	.nwpc-product-video-fab__icon::before,
	.nwpc-product-video-fab__icon::after {
		animation: none;
		opacity: 0.35;
	}

	.nwpc-product-video-fab__icon::after {
		transform: rotate(0deg);
	}
}
