/* ==========================================================================
   BĂNG CHUYỀN TIN TỨC & TUYỂN SINH MỚI NHẤT (NEWS & ADMISSIONS TICKER)
   Tệp tin: css/news_ticker.css
   - Vị trí: Ngay dưới hàng Danh Mục, Logo VIAexpo và Nút Ngôn Ngữ
   - Sử dụng 100% màu biến var từ css/theme.css
   - Tự động ẩn hoàn toàn khi bấm Danh Mục hoặc mở bất kỳ Menu / Modal nào
   ========================================================================== */

/* ==========================================================================
   ⭐ [BẢNG TÙY CHỈNH CHIỀU CAO & VỊ TRÍ ĐỨNG - BẠN TỰ CANH CHỈNH TẠI ĐÂY] ⭐
   - Vị trí cách đỉnh màn hình (top): Có thể điền % (ví dụ: 10%, 12%, 15%) HOẶC px (ví dụ: 160px, 185px, 200px)
   - Chiều cao thanh (height): Có thể điền px (ví dụ: 38px, 42px)
   ========================================================================== */
:root {
	/* 🖥️ 1. MÁY TÍNH ĐỂ BÀN / LAPTOP (DESKTOP) */
	--ticker-top-desktop: 150px;      /* [VỊ TRÍ TOP] Thoáng đãng dưới Logo VIAexpo trên máy tính (hoặc chỉnh % / px tùy ý) */
	--ticker-height-desktop: 38px;    /* [CHIỀU CAO] Bề dày của thanh băng chuyền trên máy tính */

	/* 📱 2. MÁY TÍNH BẢNG (TABLET / IPAD: 769px - 1024px) */
	--ticker-top-tablet: 120px;       /* [VỊ TRÍ TOP] Hạ thấp xuống 120px trên Tablet để không dính Logo */
	--ticker-height-tablet: 38px;     /* [CHIỀU CAO] Bề dày thanh trên Tablet */

	/* 📱 3. ĐIỆN THOẠI DI ĐỘNG (SMARTPHONE: <= 768px) */
	--ticker-top-mobile: 92px;        /* [VỊ TRÍ TOP] Hạ thấp xuống 92px trên Điện thoại, tạo khoảng trống (warp ra) thông thoáng dưới nút Danh Mục & Logo */
	--ticker-height-mobile: 36px;     /* [CHIỀU CAO] Bề dày thanh trên Điện thoại */

	/* 📱 4. ĐIỆN THOẠI MÀN HÌNH NHỎ (<= 400px) */
	--ticker-top-small: 86px;         /* [VỊ TRÍ TOP] Hạ thấp xuống 86px trên màn hình nhỏ */
	--ticker-height-small: 34px;      /* [CHIỀU CAO] Bề dày thanh trên màn hình nhỏ */
}

/* 1. KHUNG CHỨA TOÀN DẢI BĂNG CHUYỀN TIN TỨC */
.news-ticker-container {
	position: fixed;

	/* 👇 [VỊ TRÍ CÁCH ĐỈNH TRÊN DESKTOP] - Hạ thấp 150px tạo khoảng cách warp ra thông thoáng */
	top: var(--ticker-top-desktop, 150px);

	/* 👇 [CHIỀU CAO / ĐỘ DÀY THANH TRÊN DESKTOP] - Mặc định 38px theo biến --ticker-height-desktop */
	height: var(--ticker-height-desktop, 38px);

	left: 0;
	right: 0;
	width: 100%;
	z-index: 2147483590;
	/* Dưới nút Danh mục và Logo để không che các nút bấm */
	background: var(--index-menu-left-bg, linear-gradient(165deg, hsla(111, 15%, 46%, 0.88) 0%, hsla(111, 15%, 38%, 0.92) 100%));
	-webkit-backdrop-filter: blur(16px);
	backdrop-filter: blur(16px);
	border-top: 1px solid var(--header-border-bottom, rgba(255, 255, 255, 0.22));
	border-bottom: 1.5px solid var(--secondary, hsl(106, 100%, 37%));
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45), 0 0 16px var(--index-hotspot-glow, hsla(106, 100%, 37%, 0.35));
	display: flex;
	align-items: center;
	box-sizing: border-box;
	user-select: none;
	-webkit-user-select: none;
	contain: layout style;
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
	transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
		transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
		visibility 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Đảm bảo hiển thị chuẩn trong chế độ Fullscreen */
:fullscreen .news-ticker-container,
:-webkit-full-screen .news-ticker-container,
:-moz-full-screen .news-ticker-container,
:-ms-fullscreen .news-ticker-container {
	position: fixed !important;
	top: var(--ticker-top-desktop, 150px) !important;
	z-index: 2147483590 !important;
}

/* ==========================================================================
   2. TỰ ĐỘNG ẨN HOÀN TOÀN BĂNG CHUYỀN KHI MỞ BẤT KỲ MENU NÀO HOẶC BAN CỐ VẤN
   ========================================================================== */
body.menu-trai-open .news-ticker-container,
body.hotspot-modal-open .news-ticker-container,
body.ar-modal-open .news-ticker-container,
body.popup-open-mobile .news-ticker-container,
body.ai-chat-is-active .news-ticker-container,
body.bancovan-modal-open .news-ticker-container,
body.menu-phai-open .news-ticker-container,
body.menu-top-right-open .news-ticker-container,
body.lang-modal-open .news-ticker-container,
body.modal-open .news-ticker-container,
.news-ticker-container.is-hidden {
	opacity: 0 !important;
	visibility: hidden !important;
	pointer-events: none !important;
	transform: translateY(-12px) !important;
	transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease !important;
}

/* 3. KHUNG BÊN TRONG CỦA BĂNG CHUYỀN */
.news-ticker-inner {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	position: relative;
	overflow: hidden;
}

/* 4. NHÃN BẢN TIN CỐ ĐỊNH BÊN TRÁI (BADGE LIVE) */
.news-ticker-label {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 4px 12px;
	margin-left: 16px;
	background: var(--btn-cta-bg, linear-gradient(135deg, #c53030 0%, #9b2c2c 100%));
	border: 1px solid var(--btn-cta-border, rgba(220, 38, 38, 0.40));
	color: var(--text, #ffffff);
	font-size: 0.72rem;
	font-weight: 800;
	letter-spacing: 0.5px;
	border-radius: 999px;
	flex-shrink: 0;
	z-index: 5;
	box-shadow: var(--btn-cta-glow, 0 4px 14px rgba(185, 28, 28, 0.28));
	cursor: pointer;
	text-decoration: none;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.news-ticker-label:hover {
	transform: scale(1.05);
}

.ticker-pulse-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #ffffff;
	box-shadow: 0 0 8px #ffffff;
	animation: tickerPulseDot 1.4s infinite ease-in-out;
}

@keyframes tickerPulseDot {

	0%,
	100% {
		transform: scale(0.9);
		opacity: 0.7;
	}

	50% {
		transform: scale(1.3);
		opacity: 1;
		box-shadow: 0 0 12px #ffffff;
	}
}

.ticker-label-icon {
	font-size: 0.82rem;
}

.ticker-label-text {
	text-transform: uppercase;
}

/* 5. VÙNG VIEWPORT CUỘN TIN TỨC */
.news-ticker-viewport {
	flex: 1;
	height: 100%;
	display: flex;
	align-items: center;
	overflow: hidden;
	position: relative;
	mask-image: linear-gradient(90deg, transparent 0%, black 20px, black calc(100% - 20px), transparent 100%);
	-webkit-mask-image: linear-gradient(90deg, transparent 0%, black 20px, black calc(100% - 20px), transparent 100%);
}

/* Dải chạy liên tục (Track) - Tăng tốc GPU Hardware Acceleration cho iOS & Android mượt 60fps/120fps */
.news-ticker-track {
	display: inline-flex;
	align-items: center;
	gap: 28px;
	white-space: nowrap;
	will-change: transform;
	-webkit-backface-visibility: hidden;
	backface-visibility: hidden;
	-webkit-perspective: 1000px;
	perspective: 1000px;
	-webkit-transform: translate3d(0, 0, 0);
	transform: translate3d(0, 0, 0);
	animation: newsTickerMarquee 42s linear infinite;
}

/* Tạm dừng chuyển động khi rê chuột để người dùng dễ đọc và bấm */
.news-ticker-viewport:hover .news-ticker-track,
.news-ticker-container:hover .news-ticker-track {
	animation-play-state: paused;
}

@keyframes newsTickerMarquee {
	0% {
		-webkit-transform: translate3d(0, 0, 0);
		transform: translate3d(0, 0, 0);
	}

	100% {
		-webkit-transform: translate3d(-50%, 0, 0);
		transform: translate3d(-50%, 0, 0);
	}
}

/* 6. MỖI THẺ BÀI VIẾT TRONG BĂNG CHUYỀN */
.news-ticker-item {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	color: var(--text, #ffffff);
	font-size: 0.8rem;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	padding: 4px 8px;
	border-radius: 6px;
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
	transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
	flex-shrink: 0;
}

.news-ticker-item:hover {
	background: rgba(255, 255, 255, 0.08);
	color: var(--ar-border-glow, #4ade80);
	transform: translateY(-1px);
}

/* Huy hiệu loại tin (Tuyển sinh / Tin tức) */
.ticker-item-badge {
	font-size: 0.65rem;
	font-weight: 800;
	padding: 2px 7px;
	border-radius: 4px;
	text-transform: uppercase;
	letter-spacing: 0.3px;
	flex-shrink: 0;
}

.ticker-item-badge.badge-tuyensinh {
	background: var(--btn-cta-bg, linear-gradient(135deg, #c53030 0%, #9b2c2c 100%));
	border: 1px solid var(--btn-cta-border, rgba(220, 38, 38, 0.40));
	color: var(--text, #ffffff);
	box-shadow: var(--btn-cta-glow, 0 2px 8px rgba(197, 48, 48, 0.35));
}

.ticker-item-badge.badge-tintuc {
	background: linear-gradient(135deg, hsl(106, 100%, 32%), hsl(111, 28%, 24%));
	border: 1px solid var(--secondary, hsl(106, 100%, 37%));
	color: var(--text, #ffffff);
	box-shadow: 0 0 8px hsla(106, 100%, 37%, 0.35);
}

.ticker-item-title {
	color: var(--text, #ffffff);
	transition: color 0.2s ease;
	max-width: 380px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.news-ticker-item:hover .ticker-item-title {
	color: var(--ar-border-glow, #4ade80);
	text-decoration: underline;
}

.ticker-item-date {
	font-size: 0.72rem;
	color: var(--ar-badge-text, #4ade80);
	opacity: 0.85;
}

.ticker-item-arrow {
	font-size: 0.74rem;
	color: var(--secondary, #4ade80);
	opacity: 0.85;
}

.ticker-item-sep {
	color: var(--header-border-bottom, rgba(255, 255, 255, 0.35));
	font-size: 10px;
	margin-left: 12px;
}

/* 7. NÚT XEM TẤT CẢ Ở CUỐI BĂNG CHUYỀN (NÚT BẤM NHẠY, CHUẨN NATIVE BUTTON) */
.news-ticker-all-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 5px 14px;
	margin-right: 14px;
	margin-left: 10px;
	background: var(--btn-cta-bg, linear-gradient(135deg, #c53030 0%, #9b2c2c 100%));
	border: 1.5px solid var(--btn-cta-border, rgba(220, 38, 38, 0.50));
	border-radius: 999px;
	color: #ffffff;
	font-size: 0.74rem;
	font-weight: 800;
	letter-spacing: 0.3px;
	text-decoration: none;
	flex-shrink: 0;
	cursor: pointer !important;
	pointer-events: auto !important;
	touch-action: manipulation !important;
	z-index: 100 !important;
	box-shadow: var(--btn-cta-glow, 0 2px 10px rgba(197, 48, 48, 0.45));
	outline: none;
	user-select: none;
	-webkit-user-select: none;
	transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.news-ticker-all-btn:hover {
	background: var(--btn-cta-hover, linear-gradient(135deg, #dc2626 0%, #b91c1c 100%));
	border-color: rgba(255, 255, 255, 0.6);
	box-shadow: 0 4px 16px rgba(220, 38, 38, 0.6);
	transform: scale(1.06);
	color: #ffffff;
}

.news-ticker-all-btn:active {
	transform: scale(0.94);
}

/* ==========================================================================
   8. RESPONSIVE ĐIỆN THOẠI & TABLET (CÂN ĐỐI HOÀN HẢO DƯỚI NÚT DANH MỤC & LOGO)
   ========================================================================== */

/* Tablet & Màn hình trung bình (769px - 1024px) */
@media screen and (min-width: 769px) and (max-width: 1024px) {
	.news-ticker-container {
		/* 👇 [VỊ TRÍ CÁCH ĐỈNH TRÊN TABLET] - Hạ thấp 120px thông thoáng dưới Logo */
		top: var(--ticker-top-tablet, 120px);

		/* 👇 [CHIỀU CAO / ĐỘ DÀY THANH TRÊN TABLET] - Chỉnh tại đây hoặc chỉnh biến --ticker-height-tablet */
		height: var(--ticker-height-tablet, 38px);
	}

	:fullscreen .news-ticker-container,
	:-webkit-full-screen .news-ticker-container,
	:-moz-full-screen .news-ticker-container,
	:-ms-fullscreen .news-ticker-container {
		top: var(--ticker-top-tablet, 120px) !important;
	}
}

/* Smartphone & Điện thoại di động (<= 768px) */
@media screen and (max-width: 768px) {
	.news-ticker-container {
		/* 👇 [VỊ TRÍ CÁCH ĐỈNH TRÊN ĐIỆN THOẠI] - Hạ thấp 92px + safe-area, giãn rộng (warp ra) cách biệt hoàn toàn nút Danh Mục & Logo */
		top: calc(var(--ticker-top-mobile, 92px) + env(safe-area-inset-top, 0px));

		/* 👇 [CHIỀU CAO / ĐỘ DÀY THANH TRÊN ĐIỆN THOẠI] - Chỉnh tại đây hoặc chỉnh biến --ticker-height-mobile */
		height: var(--ticker-height-mobile, 36px);

		box-shadow: 0 3px 14px rgba(0, 0, 0, 0.5), 0 0 12px var(--glow-green, rgba(34, 197, 94, 0.2));

		/* Tối ưu hóa GPU di động: Tắt blur nặng nề đè lên Canvas 3D WebGL, đảm bảo 60fps/120fps mượt mà */
		-webkit-backdrop-filter: none !important;
		backdrop-filter: none !important;
		background: hsla(111, 15%, 38%, 0.95) !important;
	}

	/* Tắt gradient mask trên điện thoại để loại bỏ offscreen composite pass liên tục */
	.news-ticker-viewport {
		-webkit-mask-image: none !important;
		mask-image: none !important;
	}

	:fullscreen .news-ticker-container,
	:-webkit-full-screen .news-ticker-container,
	:-moz-full-screen .news-ticker-container,
	:-ms-fullscreen .news-ticker-container {
		top: calc(var(--ticker-top-mobile, 92px) + env(safe-area-inset-top, 0px)) !important;
	}

	.news-ticker-label {
		padding: 3px 8px;
		margin-left: 8px;
		font-size: 0.65rem;
		gap: 4px;
	}

	.ticker-label-text {
		font-size: 0.65rem;
	}

	.news-ticker-track {
		gap: 18px;
	}

	.news-ticker-item {
		font-size: 0.72rem;
		gap: 5px;
	}

	.ticker-item-badge {
		font-size: 0.58rem;
		padding: 1px 5px;
	}

	.ticker-item-title {
		max-width: 220px;
	}

	.ticker-item-date {
		font-size: 0.66rem;
	}

	.news-ticker-all-btn {
		padding: 4px 10px !important;
		font-size: 0.68rem !important;
		margin-right: 8px !important;
		z-index: 100 !important;
		cursor: pointer !important;
		pointer-events: auto !important;
	}
}

/* Màn hình cực nhỏ (< 400px) */
@media screen and (max-width: 400px) {
	.news-ticker-container {
		/* 👇 [VỊ TRÍ CÁCH ĐỈNH TRÊN MÀN HÌNH NHỎ] - Hạ thấp 86px + safe-area */
		top: calc(var(--ticker-top-small, 86px) + env(safe-area-inset-top, 0px));

		/* 👇 [CHIỀU CAO / ĐỘ DÀY THANH TRÊN MÀN HÌNH NHỎ] - Chỉnh tại đây hoặc chỉnh biến --ticker-height-small */
		height: var(--ticker-height-small, 34px);
	}

	:fullscreen .news-ticker-container,
	:-webkit-full-screen .news-ticker-container,
	:-moz-full-screen .news-ticker-container,
	:-ms-fullscreen .news-ticker-container {
		top: calc(var(--ticker-top-small, 86px) + env(safe-area-inset-top, 0px)) !important;
	}

	.ticker-label-text {
		display: none;
		/* Chỉ hiển thị icon và chấm phát sáng */
	}

	.ticker-item-title {
		max-width: 170px;
	}

	.ticker-item-date {
		display: none;
		/* Ẩn ngày trên màn hình cực nhỏ để ưu tiên tiêu đề */
	}

	.news-ticker-all-btn {
		padding: 3px 8px !important;
		font-size: 0.64rem !important;
	}
}