/* ==========================================================================
   X3SALES Home Video — UX Builder element
   Tái tạo khối ".home-video" của nahaki.com.vn (1 video nổi bật + danh sách video).
   TẤT CẢ CSS được scope dưới .vhm-home-video để KHÔNG ảnh hưởng Flatsome/Woo.
   ========================================================================== */

.vhm-home-video {
	/* Biến mặc định, có thể override qua inline style từ field colorpicker. */
	--vhm-video-title-color: #ffffff;
	--vhm-video-border: #c2c2c2;
	--vhm-video-rows: 5;

	padding: 30px 0 60px;
	overflow: hidden;
}

.vhm-home-video__container {
	width: 100%;
	max-width: 1230px;
	margin: 0 auto;
	padding: 0 15px;
	box-sizing: border-box;
}

/* --- Khung bao có nền trang trí bên phải + viền bo góc --- */
.vhm-home-video__wrap {
	position: relative;
	border-radius: 30px;
	border: 2px solid var(--vhm-video-border);
	background: url("../img/bg-video.png") right center / 47% 100% no-repeat;
}

/* --- Huy hiệu tiêu đề: nổi giữa cạnh trên khung --- */
.vhm-home-video__title {
	position: absolute;
	z-index: 9;
	top: -16px;
	left: 50%;
	transform: translateX(-50%);
	width: 310px;
	min-height: 63px;
	margin: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	text-transform: uppercase;
	color: var(--vhm-video-title-color);
	background: url("../img/bg-title.svg") center center / contain no-repeat;
}

.vhm-home-video__title h2 {
	width: 77%;
	margin: 0 auto;
	font-family: 'UTM Helve', UTMHelve, sans-serif;
	font-size: 20px;
	font-weight: 700;
	line-height: 1.2;
	color: inherit;
}

/* --- Lưới: cột trái 59% (video nổi bật), cột phải 41% (danh sách) --- */
.vhm-home-video__list {
	display: grid;
	grid-template-columns: 59% 41%;
	grid-template-rows: repeat(var(--vhm-video-rows, 5), auto);
	border-radius: 30px;
	overflow: hidden;
}

/* Video đầu tiên = video nổi bật: chiếm trọn cột trái. */
.vhm-home-video__list > a:first-child {
	grid-column: 1;
	grid-row: 1 / -1;
	display: block;
}

.vhm-home-video__item {
	text-decoration: none;
	color: inherit;
}

/* --- Một dòng video (cột phải) --- */
.vhm-home-video__img {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 15px 30px;
	transition: box-shadow 0.5s ease;
}

.vhm-home-video__img:hover {
	box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.15);
}

.vhm-home-video__thumb {
	width: 80px;
	object-fit: contain;
	background: #eee;
}

.vhm-home-video__name {
	width: calc(100% - 168px);
	margin: 0;
	font-size: 14px;
	font-weight: 700;
	color: #000;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
}

/* Nút play nhỏ (cột phải): hiện khi hover. */
.vhm-home-video__play {
	flex: 0 0 auto;
	opacity: 0;
	content: url("../img/play.svg");
	transition: opacity 0.5s ease;
}

.vhm-home-video__img:hover .vhm-home-video__play {
	opacity: 1;
}

/* --- Video nổi bật (cột trái): ảnh lớn + lớp phủ + nút play to --- */
.vhm-home-video__list > a:first-child .vhm-home-video__img {
	position: relative;
	height: 100%;
	padding: 0;
	border-radius: 30px 0 0 30px;
}

.vhm-home-video__list > a:first-child .vhm-home-video__thumb {
	width: 100%;
	height: 470px;
	padding: 20px 0;
}

.vhm-home-video__list > a:first-child .vhm-home-video__name {
	display: none;
}

.vhm-home-video__list > a:first-child .vhm-home-video__play {
	content: "";
	position: absolute;
	inset: 0;
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 1;
	background-color: rgba(0, 0, 0, 0.1);
	border-radius: 30px 0 0 30px;
}

.vhm-home-video__list > a:first-child .vhm-home-video__play::after {
	content: url("../img/play-2.svg");
	transition: transform 0.5s ease;
}

.vhm-home-video__list > a:first-child:hover .vhm-home-video__play::after {
	transform: scale(1.05);
}

/* --- Nút "Xem thêm video" (cuối cột phải) --- */
.vhm-home-video__more {
	display: flex;
	align-items: center;
	gap: 6px;
	padding-left: 30px;
	padding-bottom: 20px;
	font-size: 16px;
	text-transform: uppercase;
	color: #1d1d1d;
	text-decoration: none;
	transition: color 0.3s ease;
}

.vhm-home-video__more:hover {
	color: var(--fs-color-secondary);
}

.vhm-home-video__more svg {
	transition: opacity 0.5s ease;
}

.vhm-home-video__more:hover svg {
	opacity: 0;
}

/* --- Lightbox YouTube (scope riêng, gắn vào <body> khi mở) --- */
.vhm-home-video__modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba(0, 0, 0, 0.85);
	opacity: 0;
	transition: opacity 0.25s ease;
}

.vhm-home-video__modal.is-open {
	opacity: 1;
}

.vhm-home-video__modal-inner {
	position: relative;
	width: 100%;
	max-width: 960px;
	aspect-ratio: 16 / 9;
}

.vhm-home-video__modal-inner iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	border-radius: 8px;
}

.vhm-home-video__close {
	position: absolute;
	top: -42px;
	right: 0;
	width: 36px;
	height: 36px;
	padding: 0;
	cursor: pointer;
	background: transparent;
	border: 0;
	color: #fff;
	font-size: 30px;
	line-height: 36px;
}

.vhm-home-video__close:hover {
	color: var(--fs-color-secondary);
}

/* ------------------------------- Responsive ------------------------------- */
@media (max-width: 991px) {
	/* Xếp dọc 1 cột để dễ xem/bấm trên mobile (bản gốc giữ 2 cột — đây là cải thiện UX). */
	.vhm-home-video__list {
		grid-template-columns: 1fr;
		grid-template-rows: none;
	}
	.vhm-home-video__list > a:first-child {
		grid-column: auto;
		grid-row: auto;
		padding-top: 40px;
	}
	.vhm-home-video__list > a:first-child .vhm-home-video__img,
	.vhm-home-video__list > a:first-child .vhm-home-video__play {
		border-radius: 0;
	}
	.vhm-home-video__list > a:first-child .vhm-home-video__thumb {
		height: auto;
		max-height: 320px;
		padding: 0;
	}
	/* Mobile không hover -> luôn hiện nút play nhỏ. */
	.vhm-home-video__play {
		opacity: 1;
	}
}

@media (max-width: 575px) {
	.vhm-home-video__wrap {
		background-size: cover;
		border-radius: 16px;
	}
	.vhm-home-video__img {
		padding: 12px 15px;
	}
	.vhm-home-video__name {
		width: calc(100% - 130px);
	}
	.vhm-home-video__title {
		width: 260px;
	}
	.vhm-home-video__title h2 {
		font-size: 16px;
	}
}
