/* =========================================================
   Shop của Tui - Video Slider
   Khung slide video 9:16, desktop 6 / mobile 2
   ========================================================= */

.svs-slider {
	--svs-desktop: 6;
	--svs-mobile: 2;
	--svs-gap: 12px;
	position: relative;
	width: 100%;
	max-width: 1200px;
	margin: 0 auto 24px;
	padding: 0 44px; /* chừa chỗ cho nút trái/phải */
	box-sizing: border-box;
}

.svs-viewport {
	overflow: hidden;
	width: 100%;
}

.svs-track {
	display: flex;
	gap: var(--svs-gap);
	will-change: transform;
	transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mỗi ô: chia đều theo số video/khung của desktop */
.svs-slide {
	flex: 0 0 calc((100% - (var(--svs-desktop) - 1) * var(--svs-gap)) / var(--svs-desktop));
	max-width: calc((100% - (var(--svs-desktop) - 1) * var(--svs-gap)) / var(--svs-desktop));
	box-sizing: border-box;
}

/* Thẻ video */
.svs-card {
	position: relative;
	width: 100%;
	border-radius: 12px;
	overflow: hidden;
	background: #000;
	box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}

/* Khung tỉ lệ 9:16 */
.svs-thumb {
	position: relative;
	width: 100%;
	aspect-ratio: 9 / 16;
	background-size: cover;
	background-position: center;
	background-color: #e9e9e9;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* Nền placeholder cho Facebook Reel khi chưa đặt thumbnail */
.svs-thumb--fb {
	background: linear-gradient(160deg, #1877f2, #0a2342);
}
.svs-thumb--fb::after {
	content: "Facebook Reel";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 16px;
	text-align: center;
	color: #fff;
	font-size: 12px;
	opacity: 0.9;
	pointer-events: none;
}

/* Nền placeholder cho TikTok khi chưa đặt thumbnail */
.svs-thumb--tt {
	background: linear-gradient(160deg, #25F4EE 0%, #000 55%, #FE2C55 100%);
}
.svs-thumb--tt::after {
	content: "TikTok";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 16px;
	text-align: center;
	color: #fff;
	font-size: 12px;
	opacity: 0.9;
	pointer-events: none;
}

/* Trình dự phòng cho trình duyệt không hỗ trợ aspect-ratio */
@supports not (aspect-ratio: 9 / 16) {
	.svs-thumb::before {
		content: "";
		display: block;
		padding-top: 177.78%; /* 16/9 */
	}
}

/* Ảnh bìa lấy từ frame đầu của video Media */
.svs-poster {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	background: #000;
	z-index: 1;
	pointer-events: none;
}

/* Nút play */
.svs-play {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 3;
	width: 54px;
	height: 54px;
	border-radius: 50%;
	border: none;
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s, transform 0.2s;
}
.svs-play:hover {
	background: #e53935;
	transform: translate(-50%, -50%) scale(1.08);
}
.svs-play-icon {
	font-size: 20px;
	line-height: 1;
	margin-left: 3px;
}

/* Iframe / video khi đã phát */
.svs-card iframe,
.svs-card video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	object-fit: cover;
	background: #000;
	z-index: 2;
}

/* Video poster vẫn nằm dưới (z-index 1) khi chưa phát */
.svs-card .svs-poster {
	z-index: 1;
}

/* Khi đang phát: ẩn nút play và ảnh bìa poster */
.svs-card[data-playing="1"] .svs-play,
.svs-card[data-playing="1"] .svs-poster {
	display: none;
}

/* Tiêu đề dưới video (tuỳ chọn) */
.svs-title {
	font-size: 13px;
	line-height: 1.35;
	color: #333;
	padding: 8px 6px 4px;
	background: #fff;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* Nút điều hướng trái / phải */
.svs-nav {
	position: absolute;
	top: 45%;
	transform: translateY(-50%);
	width: 36px;
	height: 36px;
	border-radius: 50%;
	border: none;
	background: #fff;
	color: #333;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
	cursor: pointer;
	font-size: 16px;
	z-index: 5;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s, color 0.2s;
}
.svs-nav:hover {
	background: #e53935;
	color: #fff;
}
.svs-prev { left: 2px; }
.svs-next { right: 2px; }

/* ===================== MOBILE ===================== */
@media (max-width: 768px) {
	.svs-slider {
		padding: 0 34px;
		--svs-gap: 8px;
	}
	.svs-slide {
		flex: 0 0 calc((100% - (var(--svs-mobile) - 1) * var(--svs-gap)) / var(--svs-mobile));
		max-width: calc((100% - (var(--svs-mobile) - 1) * var(--svs-gap)) / var(--svs-mobile));
	}
	.svs-play {
		width: 44px;
		height: 44px;
	}
	.svs-nav {
		width: 30px;
		height: 30px;
	}
}

/* =========================================================
   TRÌNH XEM REEL TOÀN MÀN HÌNH (lightbox)
   ========================================================= */
body.svs-noscroll { overflow: hidden; }

.svs-viewer {
	position: fixed;
	inset: 0;
	z-index: 99999;
	background: rgba(0, 0, 0, 0.92);
	display: flex;
	align-items: center;
	justify-content: center;
}

.svs-viewer-stage {
	position: relative;
	height: 90vh;
	aspect-ratio: 9 / 16;
	max-width: 96vw;
	background: #000;
	border-radius: 14px;
	overflow: hidden;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
@supports not (aspect-ratio: 9 / 16) {
	.svs-viewer-stage { width: 50.625vh; } /* 90vh * 9/16 */
}

.svs-viewer-stage iframe,
.svs-viewer-stage video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	object-fit: cover;
	background: #000;
	z-index: 1;
}

/* Khung chứa video: định vị để làm gốc cho hiệu ứng trượt + video con */
.svs-viewer-media {
	position: absolute;
	inset: 0;
	z-index: 1;
	overflow: hidden;
}

/* Ép video/Reel Facebook (dựng qua JS SDK) lấp đầy khung 9:16 */
.svs-viewer-media .fb-video,
.svs-viewer-media .fb-video > span,
.svs-viewer-media .fb-video iframe {
	position: absolute !important;
	inset: 0 !important;
	width: 100% !important;
	height: 100% !important;
	border: 0 !important;
}

/* Hiệu ứng video mới trượt vào (kiểu Reels) theo hướng vuốt/cuộn */
@keyframes svsEnterUp {
	from { transform: translateY(100%); opacity: 0.35; }
	to   { transform: translateY(0);    opacity: 1; }
}
@keyframes svsEnterDown {
	from { transform: translateY(-100%); opacity: 0.35; }
	to   { transform: translateY(0);     opacity: 1; }
}
.svs-viewer-media.svs-enter-up   { animation: svsEnterUp 0.28s ease; }
.svs-viewer-media.svs-enter-down { animation: svsEnterDown 0.28s ease; }

/* Lớp chạm/vuốt phủ TRÊN video (bắt cử chỉ cho mọi nguồn, kể cả iframe) */
.svs-viewer-tap {
	position: absolute;
	inset: 0;
	z-index: 3;
	cursor: pointer;
	touch-action: none; /* để bắt vuốt dọc, không cho trang nền cuộn */
}

/* Với video Facebook: chừa hở dải đáy để bấm được thanh điều khiển gốc của FB
   (nút loa/phát THẬT nằm trong iframe — cách duy nhất bật tiếng ổn định). */
.svs-viewer-tap.svs-tap-fb {
	bottom: 56px;
}

/* Biểu tượng play/pause ở giữa (chỉ hiện khi tạm dừng) */
.svs-viewer-playpause {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 74px;
	height: 74px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 26px;
	z-index: 4;
	opacity: 0;
	transition: opacity 0.2s;
	pointer-events: none;
}
.svs-viewer-stage.is-paused .svs-viewer-playpause { opacity: 1; }

/* Nút loa nằm TRONG rail bên phải: viền tròn CAM, icon loa 🔊.
   Khi TẮT tiếng: hiện 2 gạch chéo ĐỎ (dấu ✕) trên loa. */
.svs-viewer-mute .svs-ic {
	position: relative;
	border: 2px solid #FE5621;
	box-sizing: border-box;
}
.svs-viewer-mute.is-muted .svs-ic::before,
.svs-viewer-mute.is-muted .svs-ic::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	width: 26px;
	height: 3px;
	border-radius: 2px;
	background: #ff2b2b;
	pointer-events: none;
	transform: translate(-50%, -50%) rotate(45deg);
}
.svs-viewer-mute.is-muted .svs-ic::after {
	transform: translate(-50%, -50%) rotate(-45deg);
}

/* ---- Chế độ FACEBOOK: vòng loa cam "căn" đè lên nút loa gốc của FB ----
   Phần tử này là CON TRỰC TIẾP của khung video (.svs-viewer-stage) nên
   right/bottom tính theo KHUNG VIDEO (không phải theo thanh nút bên phải).
   Nó XUYÊN CLICK (pointer-events:none) -> chạm vào = chạm nút loa THẬT của FB.
   Chỉnh vị trí bằng 4 biến dưới (Giao diện > Tùy chỉnh > CSS bổ sung):
     --svs-fbmute-right  : máy tính, TĂNG = dịch sang TRÁI
     --svs-fbmute-bottom : máy tính, TĂNG = dịch LÊN TRÊN
     --svs-fbmute-right-m / --svs-fbmute-bottom-m : cho điện thoại */
.svs-viewer-fbmute {
	position: absolute;
	right: var(--svs-fbmute-right, 25%);
	bottom: var(--svs-fbmute-bottom, 22px);
	z-index: 9;
	pointer-events: none;
	flex-direction: column;
	align-items: center;
	gap: 6px;
}
.svs-fbmute-ring {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	border: 2px solid #FE5621;
	box-shadow: 0 0 0 3px rgba(254, 86, 33, 0.35);
	animation: svsFbMutePulse 1.6s ease-in-out infinite;
}
.svs-fbmute-label {
	background: #FE5621;
	color: #fff;
	font-weight: 700;
	font-size: 12px;
	line-height: 1;
	padding: 4px 8px;
	border-radius: 8px;
	white-space: nowrap;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
@keyframes svsFbMutePulse {
	0%, 100% { box-shadow: 0 0 0 3px rgba(254, 86, 33, 0.35); }
	50%      { box-shadow: 0 0 0 7px rgba(254, 86, 33, 0.12); }
}
@media (max-width: 768px) {
	.svs-viewer-fbmute {
		right: var(--svs-fbmute-right-m, 23%);
		bottom: var(--svs-fbmute-bottom-m, 12px);
	}
}

/* Caption dưới video */
.svs-viewer-caption {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 40px 16px 16px;
	background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
	color: #fff;
	font-size: 14px;
	line-height: 1.4;
	z-index: 4;
	pointer-events: none;
}

/* Thanh tiến trình (video Media) */
.svs-viewer-progress {
	position: absolute;
	top: 0;
	left: 0;
	height: 3px;
	width: 0;
	background: #e53935;
	z-index: 5;
	transition: width 0.1s linear;
}

/* Nút đóng (X) */
.svs-viewer-close {
	position: absolute;
	top: 18px;
	right: 22px;
	width: 28px !important;
	height: 28px !important;
	min-width: 0 !important;
	min-height: 0 !important;
	padding: 0 !important;
	margin: 0 !important;
	border: none !important;
	border-radius: 50% !important;
	background: #FE5621 !important;
	background-color: #FE5621 !important;
	color: #FEFDFD !important;
	font-size: 24px;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
	z-index: 10;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
	box-sizing: border-box;
}
.svs-viewer-close:hover { background: #e04a17 !important; background-color: #e04a17 !important; }

/* Mũi tên chuyển video (desktop) */
.svs-viewer-nav {
	position: absolute;
	right: 28px;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	border: none;
	background: rgba(255, 255, 255, 0.15);
	color: #fff;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	z-index: 10;
	display: flex;
	align-items: center;
	justify-content: center;
}
.svs-viewer-nav:hover { background: rgba(255, 255, 255, 0.32); }
.svs-viewer-up   { top: calc(50% - 62px); transform: rotate(90deg); }
.svs-viewer-down { top: calc(50% + 14px); transform: rotate(90deg); }

/* ===================== MOBILE: full màn hình ===================== */
@media (max-width: 768px) {
	.svs-viewer-stage {
		height: 100vh;
		height: 100dvh;
		width: 100vw;
		max-width: 100vw;
		border-radius: 0;
		aspect-ratio: auto;
	}
	.svs-viewer-nav { display: none; } /* dùng vuốt thay cho mũi tên */
	.svs-viewer-close { top: 12px; right: 12px; }
}

/* =========================================================
   THANH NÚT THÍCH / CHIA SẺ (bên phải khung video)
   ========================================================= */
.svs-viewer-rail {
	position: absolute;
	right: 6px;
	bottom: 84px;
	z-index: 7;
	display: flex;
	flex-direction: column;
	gap: 16px;
	align-items: center;
}
.svs-viewer-rail button {
	border: none;
	background: transparent;
	color: #fff;
	cursor: pointer;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	font-size: 12px;
	line-height: 1;
	padding: 0;
}
.svs-viewer-rail .svs-ic {
	width: 46px;
	height: 46px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.5);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 22px;
	transition: transform 0.15s, background 0.2s;
}
.svs-viewer-rail button:hover .svs-ic { background: rgba(0, 0, 0, 0.75); }
/* Thu nhẹ cỡ chữ nhãn để khi rail sát mép phải, chữ không bị cắt */
.svs-viewer-rail .svs-rail-label { font-size: 11px; }
.svs-viewer-like.is-liked .svs-ic-heart { color: #ff2d55; }
.svs-viewer-like.pop .svs-ic { transform: scale(1.25); }

/* Nút Chia sẻ: nền cam, mũi tên trắng */
.svs-viewer-share .svs-ic { background: #FE5621; color: #fff; }
.svs-viewer-share:hover .svs-ic { background: #e04a17; }

/* Thông báo mở trình duyệt ngoài: chỉ JS bật khi đang ở Zalo WebView. */
.svs-zalo-browser {
	position: absolute;
	left: 18px;
	right: 82px;
	bottom: 82px;
	z-index: 10;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 7px;
	padding: 0;
	background: transparent;
	color: #fff;
	cursor: pointer;
}
.svs-zalo-browser-text {
	display: block;
	width: 100%;
	box-sizing: border-box;
	padding: 11px 14px 12px;
	border-radius: 42px;
	background: rgba(76, 74, 68, 0.91);
	box-shadow: 0 3px 14px rgba(0, 0, 0, 0.32);
	font-size: clamp(14px, 4.2vw, 19px);
	font-weight: 800;
	line-height: 1.18;
	text-align: center;
	text-transform: uppercase;
}
.svs-zalo-browser-text span {
	display: block;
	white-space: nowrap;
}
.svs-zalo-browser-button {
	width: auto;
	min-width: 58%;
	margin: 0 !important;
	padding: 11px 18px !important;
	border: 2px solid #fff !important;
	border-radius: 4px !important;
	background: #FE5621 !important;
	color: #fff !important;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
	font-size: clamp(16px, 4.5vw, 21px) !important;
	font-weight: 800 !important;
	line-height: 1.1 !important;
	white-space: nowrap;
	cursor: pointer;
}
.svs-zalo-browser-button:hover,
.svs-zalo-browser-button:focus { background: #cf3f10 !important; }

@media (max-width: 380px) {
	.svs-zalo-browser { left: 10px; right: 72px; }
	.svs-zalo-browser-text { padding: 10px 6px 11px; font-size: 14px; }
	.svs-zalo-browser-button { min-width: 66%; padding: 10px 12px !important; font-size: 15px !important; }
}

/* =========================================================
   Ô SỐ 4 — KHUNG ẢNH SẢN PHẨM (góc dưới-trái), bấm mở trang SP
   ========================================================= */
.svs-viewer-product {
	position: absolute;
	left: 12px;
	bottom: 90px;
	z-index: 8;
	width: 92px;
	border-radius: 12px;
	overflow: hidden;
	background: #000;
	border: 2px solid #fff;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
	text-decoration: none;
	cursor: pointer;
	transition: transform 0.15s;
}
.svs-viewer-product:hover { transform: scale(1.05); }
.svs-viewer-product-img {
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1; /* ảnh sản phẩm tỷ lệ 1:1 */
	object-fit: cover;
	background: #222;
}
@supports not (aspect-ratio: 1 / 1) {
	.svs-viewer-product-img { height: 86px; }
}
.svs-viewer-product-tag {
	display: block;
	text-align: center;
	background: #FE5621;
	color: #fff;
	font-size: 13px;
	font-weight: 700;
	line-height: 1;
	padding: 6px 2px;
}

/* =========================================================
   BẢNG CHIA SẺ
   ========================================================= */
.svs-share {
	position: absolute;
	inset: 0;
	z-index: 20;
	background: rgba(0, 0, 0, 0.55);
	display: flex;
	align-items: flex-end;
	justify-content: center;
}
.svs-share-sheet {
	width: 100%;
	max-width: 480px;
	background: #fff;
	border-radius: 18px 18px 0 0;
	padding: 12px 18px 20px;
	box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.3);
}
@media (min-width: 769px) {
	.svs-share { align-items: center; }
	.svs-share-sheet { border-radius: 18px; }
}
.svs-share-grip {
	width: 42px;
	height: 5px;
	border-radius: 3px;
	background: #d0d0d0;
	margin: 4px auto 12px;
}
.svs-share-head {
	font-size: 18px;
	font-weight: 700;
	color: #1a1a1a;
	margin-bottom: 16px;
}

/* Hàng icon ứng dụng */
.svs-share-apps {
	display: flex;
	gap: 6px;
	margin-bottom: 14px;
}
.svs-app {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	background: none;
	border: none;
	cursor: pointer;
	text-decoration: none;
	padding: 4px 0;
}
.svs-app-ic {
	width: 56px;
	height: 56px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	font-size: 24px;
	font-weight: 700;
	font-family: Georgia, "Times New Roman", serif;
}
.svs-app-lbl {
	font-size: 12px;
	color: #333;
	text-align: center;
	line-height: 1.2;
}
.svs-app-fb   .svs-app-ic { background: #1877f2; }
.svs-app-zalo .svs-app-ic { background: #0068ff; font-family: Arial, sans-serif; }
.svs-app-mess .svs-app-ic { background: radial-gradient(circle at 30% 20%, #00b2ff, #006aff 40%, #a033ff 70%, #ff5280); }
.svs-app-ig   .svs-app-ic { background: radial-gradient(circle at 30% 105%, #ffd600, #ff7a00 25%, #ff0069 50%, #d300c5 75%, #7638fa); font-size: 18px; }
.svs-app:hover .svs-app-ic { filter: brightness(1.08); }

/* Khi admin upload logo riêng: ảnh lấp đầy vòng tròn, bỏ nền màu mặc định */
.svs-app-ic.has-img { background: none !important; overflow: hidden; }
.svs-app-ic .svs-app-ic-img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }

.svs-share-divider {
	height: 1px;
	background: #eee;
	margin: 6px 0 14px;
}

/* Nút Copy link + Đóng */
.svs-share-copy {
	width: 100%;
	display: flex;
	align-items: center;
	gap: 12px;
	border: none;
	background: #f2f3f5;
	color: #1a1a1a;
	padding: 14px 16px;
	border-radius: 12px;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	margin-bottom: 10px;
}
.svs-share-copy:hover { background: #e6e8eb; }
.svs-copy-ic {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: #d9dce1;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 16px;
}
.svs-share-x {
	width: 100%;
	border: none;
	background: #fff;
	color: #777;
	padding: 10px;
	border-radius: 10px;
	cursor: pointer;
	font-size: 14px;
}
.svs-share-x:hover { background: #f5f5f5; }

/* Thông báo nhỏ (đã sao chép) */
.svs-toast {
	position: absolute;
	left: 50%;
	bottom: 40px;
	transform: translateX(-50%);
	background: rgba(0, 0, 0, 0.85);
	color: #fff;
	padding: 10px 18px;
	border-radius: 20px;
	font-size: 14px;
	z-index: 30;
}
