/**
 * Unlimited Flatsome — Element Pack 10
 * Element: UF Hover Video (.ufl-hv)
 * Hover-to-Play Video Showcase Cards (Lazy MP4 + Live Ken-Burns Motion Preview)
 */

/* ==========================================================================
   1. SCOPED RESET (Chống Flatsome global button / heading overrides)
   ========================================================================== */
.ufl-hv,
.ufl-hv *,
.ufl-hv *::before,
.ufl-hv *::after {
	box-sizing: border-box;
}

.ufl-hv button {
	margin: 0 !important;
	min-height: 0 !important;
	min-width: 0;
	padding: 0;
	line-height: 1;
	text-transform: none;
	letter-spacing: normal;
	box-shadow: none;
	font-family: inherit;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

/* ==========================================================================
   2. ROOT & DESIGN TOKENS (.ufl-hv)
   ========================================================================== */
.ufl-hv {
	--ufl-hv-brand: var(--ufl-hv-accent, var(--ufl-primary, #446084));
	--ufl-hv-brand-soft: color-mix(in srgb, var(--ufl-hv-brand) 14%, transparent);
	--ufl-hv-brand-glow: color-mix(in srgb, var(--ufl-hv-brand) 42%, transparent);
	--ufl-hv-surface: var(--ufl-surface, #ffffff);
	--ufl-hv-border: var(--ufl-border, rgba(15, 23, 42, 0.09));
	--ufl-hv-border-strong: var(--ufl-border-strong, rgba(15, 23, 42, 0.16));
	--ufl-hv-ink: var(--ufl-ink-strong, #0f172a);
	--ufl-hv-muted: var(--ufl-ink-muted, #64748b);
	--ufl-hv-radius: var(--ufl-r-lg, 16px);
	--ufl-hv-gap: 1.35rem;

	position: relative;
	width: 100%;
	max-width: 100%;
	min-width: 0;
}

/* ==========================================================================
   3. GRID LAYOUT & ASPECT RATIOS
   ========================================================================== */
.ufl-hv__grid {
	display: grid;
	grid-template-columns: repeat(var(--ufl-hv-cols, 3), minmax(0, 1fr));
	gap: var(--ufl-hv-gap);
	width: 100%;
	max-width: 100%;
	min-width: 0;
}

.ufl-hv__card {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 100%;
	min-width: 0;
	margin: 0;
	transition:
		transform 280ms cubic-bezier(0.22, 1, 0.36, 1),
		box-shadow 280ms cubic-bezier(0.22, 1, 0.36, 1),
		border-color 240ms ease;
}

.ufl-hv__media {
	position: relative;
	width: 100%;
	max-width: 100%;
	min-width: 0;
	overflow: hidden;
	background: #0f172a;
	aspect-ratio: 16 / 9;
	isolation: isolate;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.ufl-hv__media:focus-visible {
	outline: 2px solid var(--ufl-hv-brand);
	outline-offset: 2px;
}

.ufl-hv--ratio-16-9 .ufl-hv__media {
	aspect-ratio: 16 / 9;
}

.ufl-hv--ratio-4-5 .ufl-hv__media {
	aspect-ratio: 4 / 5;
}

.ufl-hv--ratio-1-1 .ufl-hv__media {
	aspect-ratio: 1 / 1;
}

/* ==========================================================================
   4. POSTER, LAZY VIDEO & LIVE KEN-BURNS MOTION PREVIEW
   ========================================================================== */
.ufl-hv__poster {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	transform: scale(1) translate3d(0, 0, 0);
	transition: transform 650ms cubic-bezier(0.22, 1, 0.36, 1), filter 380ms ease;
	will-change: transform;
	user-select: none;
	pointer-events: none;
}

.ufl-hv__video-slot {
	position: absolute;
	inset: 0;
	z-index: 1;
	pointer-events: none;
}

.ufl-hv__video {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	opacity: 0;
	transition: opacity 280ms ease;
}

.ufl-hv__card.is-playing.has-video-ready .ufl-hv__video {
	opacity: 1;
}

/* Subtle zoom on video card while video buffers */
.ufl-hv__card--video.is-playing:not(.has-video-ready) .ufl-hv__poster {
	transform: scale(1.045);
}

/* Cinematic Ken-Burns Motion Preview (khi không có URL MP4) */
@keyframes ufl-hv-kenburns-1 {
	0% {
		transform: scale(1.02) translate3d(0, 0, 0);
	}
	50% {
		transform: scale(1.13) translate3d(-2.2%, -1.4%, 0);
	}
	100% {
		transform: scale(1.08) translate3d(1.6%, -2%, 0);
	}
}

@keyframes ufl-hv-kenburns-2 {
	0% {
		transform: scale(1.02) translate3d(0, 0, 0);
	}
	50% {
		transform: scale(1.12) translate3d(2%, -1.6%, 0);
	}
	100% {
		transform: scale(1.09) translate3d(-1.5%, 1.4%, 0);
	}
}

@keyframes ufl-hv-kenburns-3 {
	0% {
		transform: scale(1.03) translate3d(0, 0, 0);
	}
	50% {
		transform: scale(1.14) translate3d(-1.4%, 1.6%, 0);
	}
	100% {
		transform: scale(1.07) translate3d(2%, -1.2%, 0);
	}
}

.ufl-hv__card--motion.is-playing .ufl-hv__poster {
	filter: contrast(1.04) saturate(1.08);
}

.ufl-hv__card--motion.ufl-hv__card--pan-1.is-playing .ufl-hv__poster {
	animation: ufl-hv-kenburns-1 11s ease-in-out infinite alternate;
}

.ufl-hv__card--motion.ufl-hv__card--pan-2.is-playing .ufl-hv__poster {
	animation: ufl-hv-kenburns-2 11s ease-in-out infinite alternate;
}

.ufl-hv__card--motion.ufl-hv__card--pan-3.is-playing .ufl-hv__poster {
	animation: ufl-hv-kenburns-3 11s ease-in-out infinite alternate;
}

/* ==========================================================================
   5. SCRIM, TOP BAR, BADGES, PLAY HINT & PROGRESS BAR
   ========================================================================== */
.ufl-hv__scrim {
	position: absolute;
	inset: 0;
	z-index: 2;
	pointer-events: none;
	background: linear-gradient(
		180deg,
		rgba(15, 23, 42, 0.34) 0%,
		rgba(15, 23, 42, 0.04) 36%,
		rgba(15, 23, 42, 0.16) 68%,
		rgba(15, 23, 42, 0.56) 100%
	);
	transition: opacity 280ms ease;
}

.ufl-hv--style-overlay .ufl-hv__scrim {
	background: linear-gradient(
		180deg,
		rgba(15, 23, 42, 0.36) 0%,
		rgba(15, 23, 42, 0.04) 34%,
		rgba(15, 23, 42, 0.42) 64%,
		rgba(15, 23, 42, 0.88) 100%
	);
}

.ufl-hv--style-minimal .ufl-hv__scrim {
	background: linear-gradient(
		180deg,
		rgba(15, 23, 42, 0.24) 0%,
		rgba(15, 23, 42, 0) 32%,
		rgba(15, 23, 42, 0) 72%,
		rgba(15, 23, 42, 0.38) 100%
	);
}

/* Top bar */
.ufl-hv__top {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	z-index: 4;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	padding: 0.85rem;
	pointer-events: none;
}

/* Swappable left slot: category pill <-> live PREVIEWING badge */
.ufl-hv__badges {
	display: grid;
	align-items: center;
	min-width: 0;
	max-width: 68%;
}

.ufl-hv__cat,
.ufl-hv__live {
	grid-area: 1 / 1;
	justify-self: start;
	display: inline-flex;
	align-items: center;
	gap: 0.38rem;
	max-width: 100%;
	padding: 0.3rem 0.65rem;
	border-radius: 9999px;
	font-size: 0.7rem;
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: 0.04em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	transition: opacity 220ms ease, transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.ufl-hv__cat {
	background: rgba(15, 23, 42, 0.54);
	border: 1px solid rgba(255, 255, 255, 0.16);
	color: #f8fafc;
	text-transform: uppercase;
}

.ufl-hv__live {
	background: rgba(15, 23, 42, 0.76);
	border: 1px solid rgba(255, 255, 255, 0.22);
	color: #ffffff;
	letter-spacing: 0.08em;
	opacity: 0;
	transform: translateY(5px) scale(0.96);
}

.ufl-hv__live-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #10b981;
	box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.65);
	flex-shrink: 0;
}

@keyframes ufl-hv-pulse {
	0% {
		box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.65);
	}
	70% {
		box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
	}
	100% {
		box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
	}
}

.ufl-hv__card.is-playing .ufl-hv__cat {
	opacity: 0;
	transform: translateY(-5px) scale(0.96);
}

.ufl-hv__card.is-playing .ufl-hv__live {
	opacity: 1;
	transform: translateY(0) scale(1);
}

.ufl-hv__card.is-playing .ufl-hv__live-dot {
	animation: ufl-hv-pulse 1.5s ease-out infinite;
}

/* Right controls (duration + mute button) */
.ufl-hv__controls {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	flex-shrink: 0;
	pointer-events: auto;
}

.ufl-hv__dur {
	display: inline-flex;
	align-items: center;
	padding: 0.28rem 0.56rem;
	border-radius: 9999px;
	background: rgba(15, 23, 42, 0.62);
	border: 1px solid rgba(255, 255, 255, 0.14);
	color: #f8fafc;
	font-size: 0.72rem;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	line-height: 1.2;
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
}

.ufl-hv__mute {
	display: inline-grid;
	place-items: center;
	width: 30px;
	height: 30px;
	border-radius: 9999px;
	border: 1px solid rgba(255, 255, 255, 0.22) !important;
	background: rgba(15, 23, 42, 0.68) !important;
	color: #ffffff !important;
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	opacity: 0;
	transform: scale(0.9);
	pointer-events: none;
	transition:
		opacity 200ms ease,
		transform 200ms ease,
		background-color 180ms ease,
		border-color 180ms ease;
}

.ufl-hv__card.is-playing .ufl-hv__mute,
.ufl-hv__mute:focus-visible {
	opacity: 1;
	transform: scale(1);
	pointer-events: auto;
}

.ufl-hv__mute:hover {
	background: var(--ufl-hv-brand) !important;
	border-color: var(--ufl-hv-brand) !important;
}

.ufl-hv__mute .ufl-hv__icon-sound {
	display: none;
}

.ufl-hv__mute.is-unmuted .ufl-hv__icon-muted {
	display: none;
}

.ufl-hv__mute.is-unmuted .ufl-hv__icon-sound {
	display: block;
}

/* Center subtle play hint */
.ufl-hv__play-hint {
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 3;
	display: inline-grid;
	place-items: center;
	width: 48px;
	height: 48px;
	border-radius: 9999px;
	background: rgba(15, 23, 42, 0.48);
	border: 1px solid rgba(255, 255, 255, 0.28);
	color: #ffffff;
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	transform: translate(-50%, -50%) scale(1);
	transition:
		opacity 260ms ease,
		transform 260ms cubic-bezier(0.22, 1, 0.36, 1),
		background-color 220ms ease;
	pointer-events: none;
}

.ufl-hv__play-hint svg {
	margin-left: 2px;
}

.ufl-hv__card.is-playing .ufl-hv__play-hint {
	opacity: 0;
	transform: translate(-50%, -50%) scale(0.78);
}

/* Thin progress bar at bottom edge of media */
.ufl-hv__progress {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 6;
	height: 3px;
	background: rgba(255, 255, 255, 0.22);
	opacity: 0;
	transition: opacity 220ms ease;
	pointer-events: none;
}

.ufl-hv--style-minimal .ufl-hv__progress {
	height: 2px;
}

.ufl-hv__card.is-playing .ufl-hv__progress {
	opacity: 1;
}

.ufl-hv__progress-bar {
	display: block;
	width: 100%;
	height: 100%;
	background: var(--ufl-hv-brand);
	box-shadow: 0 0 10px var(--ufl-hv-brand-glow);
	transform: scaleX(var(--ufl-hv-progress, 0));
	transform-origin: left center;
	will-change: transform;
}

/* ==========================================================================
   6. STYLE VARIANTS: OVERLAY / CARD / MINIMAL
   ========================================================================== */

/* --- Style 1: OVERLAY (Chữ phủ đáy trên nền gradient tối) --- */
.ufl-hv--style-overlay .ufl-hv__card {
	border-radius: var(--ufl-hv-radius);
	overflow: hidden;
	box-shadow: 0 10px 28px -14px rgba(15, 23, 42, 0.42);
}

.ufl-hv--style-overlay .ufl-hv__card:hover,
.ufl-hv--style-overlay .ufl-hv__card.is-playing {
	transform: translateY(-4px);
	box-shadow: 0 22px 42px -18px rgba(15, 23, 42, 0.56);
}

.ufl-hv--style-overlay .ufl-hv__media {
	border-radius: var(--ufl-hv-radius);
}

.ufl-hv__overlay {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 4;
	padding: 1.15rem 1.1rem 1.1rem;
	pointer-events: none;
}

.ufl-hv__overlay-row {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 0.75rem;
	min-width: 0;
}

.ufl-hv--style-overlay .ufl-hv__title {
	margin: 0;
	font-size: 1.02rem;
	font-weight: 650;
	line-height: 1.32;
	color: #ffffff;
	letter-spacing: -0.01em;
	text-shadow: 0 2px 10px rgba(15, 23, 42, 0.45);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	pointer-events: auto;
}

.ufl-hv--style-overlay .ufl-hv__title-link {
	color: #ffffff;
	text-decoration: none;
	transition: opacity 180ms ease;
}

.ufl-hv--style-overlay .ufl-hv__title-link:hover {
	opacity: 0.86;
}

.ufl-hv__arrow {
	display: inline-grid;
	place-items: center;
	width: 32px;
	height: 32px;
	flex-shrink: 0;
	border-radius: 9999px;
	background: rgba(255, 255, 255, 0.14);
	border: 1px solid rgba(255, 255, 255, 0.24);
	color: #ffffff;
	text-decoration: none;
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	pointer-events: auto;
	transition:
		background-color 200ms ease,
		border-color 200ms ease,
		transform 200ms ease;
}

.ufl-hv__arrow:hover {
	background: var(--ufl-hv-brand);
	border-color: var(--ufl-hv-brand);
	color: #ffffff;
	transform: translate(1px, -1px);
}

/* --- Style 2: CARD (Thẻ hiện đại chữ gọn dưới ảnh) --- */
.ufl-hv--style-card .ufl-hv__card {
	background: var(--ufl-hv-surface);
	border: 1px solid var(--ufl-hv-border);
	border-radius: var(--ufl-hv-radius);
	overflow: hidden;
	box-shadow: 0 8px 24px -16px rgba(15, 23, 42, 0.22);
}

.ufl-hv--style-card .ufl-hv__card:hover,
.ufl-hv--style-card .ufl-hv__card.is-playing {
	transform: translateY(-4px);
	border-color: var(--ufl-hv-border-strong);
	box-shadow: 0 20px 38px -20px rgba(15, 23, 42, 0.3);
}

.ufl-hv--style-card .ufl-hv__body {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 1rem 1.05rem 1.1rem;
	min-width: 0;
}

.ufl-hv__body-main {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
	min-width: 0;
	flex: 1 1 auto;
}

.ufl-hv--style-card .ufl-hv__body-cat {
	font-size: 0.7rem;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--ufl-hv-brand);
}

.ufl-hv--style-card .ufl-hv__title {
	margin: 0;
	font-size: 1rem;
	font-weight: 650;
	line-height: 1.36;
	color: var(--ufl-hv-ink);
	letter-spacing: -0.01em;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.ufl-hv--style-card .ufl-hv__title-link,
.ufl-hv--style-minimal .ufl-hv__title-link {
	color: inherit;
	text-decoration: none;
	transition: color 180ms ease;
}

.ufl-hv--style-card .ufl-hv__title-link:hover,
.ufl-hv--style-minimal .ufl-hv__title-link:hover {
	color: var(--ufl-hv-brand);
}

.ufl-hv__body-link {
	display: inline-grid;
	place-items: center;
	width: 32px;
	height: 32px;
	flex-shrink: 0;
	border-radius: 9999px;
	border: 1px solid var(--ufl-hv-border-strong);
	color: var(--ufl-hv-ink);
	text-decoration: none;
	transition:
		background-color 180ms ease,
		border-color 180ms ease,
		color 180ms ease,
		transform 180ms ease;
}

.ufl-hv__body-link:hover {
	background: var(--ufl-hv-brand);
	border-color: var(--ufl-hv-brand);
	color: #ffffff;
	transform: translate(1px, -1px);
}

/* --- Style 3: MINIMAL (Khung ảnh trần tối giản) --- */
.ufl-hv--style-minimal .ufl-hv__media {
	border-radius: 10px;
}

.ufl-hv--style-minimal .ufl-hv__top {
	padding: 0.65rem;
}

.ufl-hv--style-minimal .ufl-hv__play-hint {
	width: 40px;
	height: 40px;
}

.ufl-hv--style-minimal .ufl-hv__body {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 0.6rem;
	padding: 0.72rem 0.1rem 0;
	min-width: 0;
}

.ufl-hv--style-minimal .ufl-hv__body-cat {
	font-size: 0.72rem;
	font-weight: 500;
	line-height: 1.2;
	color: var(--ufl-hv-muted);
}

.ufl-hv--style-minimal .ufl-hv__title {
	margin: 0;
	font-size: 0.96rem;
	font-weight: 600;
	line-height: 1.36;
	color: var(--ufl-hv-ink);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.ufl-hv--style-minimal .ufl-hv__body-link {
	width: 28px;
	height: 28px;
	border-color: transparent;
	color: var(--ufl-hv-muted);
}

.ufl-hv--style-minimal .ufl-hv__body-link:hover {
	background: var(--ufl-hv-brand-soft);
	border-color: transparent;
	color: var(--ufl-hv-brand);
}

/* ==========================================================================
   7. RESPONSIVE (Tablet -> 2 cột, Mobile 375px -> 1 cột, 0 tràn ngang)
   ========================================================================== */
@media (max-width: 960px) {
	.ufl-hv--cols-3 .ufl-hv__grid,
	.ufl-hv--cols-4 .ufl-hv__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 639px) {
	.ufl-hv {
		--ufl-hv-gap: 1rem;
	}

	.ufl-hv .ufl-hv__grid {
		grid-template-columns: minmax(0, 1fr);
	}

	.ufl-hv__top {
		padding: 0.7rem;
	}

	.ufl-hv--style-overlay .ufl-hv__overlay {
		padding: 0.95rem 0.9rem 0.9rem;
	}

	.ufl-hv--style-card .ufl-hv__body {
		padding: 0.85rem 0.9rem 0.95rem;
	}
}

/* ==========================================================================
   8. ACCESSIBILITY: REDUCED MOTION
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
	.ufl-hv__card,
	.ufl-hv__poster,
	.ufl-hv__video,
	.ufl-hv__cat,
	.ufl-hv__live,
	.ufl-hv__play-hint,
	.ufl-hv__progress {
		transition-duration: 0.01ms !important;
	}

	.ufl-hv__card--motion.is-playing .ufl-hv__poster,
	.ufl-hv__card.is-playing .ufl-hv__live-dot {
		animation: none !important;
	}
}
