/* header (_nav_top.php) — ทับสไตล์เมนูเดิมของธีม/custom.css */

/* แถบเมนูติดด้านบนจอ: เลื่อนลงแล้วแถบบนสุดเลื่อนพ้นจอ เหลือแถบเมนู (--topbar-h ตั้งค่าจากสคริปต์ใน _nav_top.php) */
html #header.site-header {
	position: -webkit-sticky;
	position: sticky;
	top: calc(var(--topbar-h, 40px) * -1);
	z-index: 1030;
}

html #header.site-header .header-body {
	border-top: 0;
	border-bottom: 1px solid rgba(0, 0, 0, .06);
	background: rgba(255, 255, 255, .96);
	-webkit-backdrop-filter: saturate(160%) blur(10px);
	backdrop-filter: saturate(160%) blur(10px);
	box-shadow: 0 4px 18px rgba(0, 0, 0, .04);
	transition: box-shadow .25s ease;
}

html #header.site-header.is-scrolled .header-body { box-shadow: 0 10px 30px rgba(0, 0, 0, .1); }

/* กดลิงก์ไปยังส่วนในหน้า (#...) แล้วหัวข้อไม่ถูกแถบเมนูบัง */
html { scroll-padding-top: 90px; }

/* ---------- แถบบนสุด ---------- */
.site-topbar {
	background: linear-gradient(120deg, #8D0104 0%, #CE0001 100%);
	color: #FFF;
	font-size: 15px;
}

.site-topbar .container {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	min-height: 42px;
	padding-top: 4px;
	padding-bottom: 4px;
}

.site-topbar-title {
	min-width: 0;
	overflow: hidden;
	font-weight: 600;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.site-topbar-title i {
	margin-right: 6px;
	opacity: .9;
}

.site-topbar-links {
	display: flex;
	flex: none;
	gap: 8px;
}

.site-topbar-links a {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 4px 13px;
	border-radius: 999px;
	background: rgba(255, 255, 255, .14);
	color: #FFF !important;
	font-weight: 600;
	text-decoration: none !important;
	transition: background .2s ease;
}

.site-topbar-links a:hover { background: rgba(255, 255, 255, .28); }

/* ---------- แถบเมนู ---------- */
html #header.site-header .header-container {
	min-height: 86px;
	transition: min-height .25s ease;
}

html #header.site-header.is-scrolled .header-container { min-height: 68px; }

#header.site-header .site-logo {
	height: 60px;
	width: auto;
	transition: height .25s ease;
}

#header.site-header.is-scrolled .site-logo { height: 46px; }

#header.site-header .header-logo a { display: block; }

.nav-ic {
	margin-right: 6px;
	font-size: 14px;
	opacity: .55;
}

/* ปุ่มโทรมุมขวา (จอคอม) */
.header-cta {
	align-items: center;
	gap: 10px;
	margin-left: 14px;
	padding: 7px 18px 7px 8px;
	border-radius: 999px;
	background: linear-gradient(120deg, #CE0001 0%, #8D0104 100%);
	color: #FFF !important;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.15;
	white-space: nowrap;
	text-decoration: none !important;
	box-shadow: 0 8px 20px rgba(206, 0, 1, .25);
	transition: transform .2s ease, box-shadow .2s ease;
}

.header-cta:hover {
	transform: translateY(-2px);
	box-shadow: 0 12px 26px rgba(206, 0, 1, .32);
}

.header-cta i {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .2);
	font-size: 15px;
	animation: cbtn-ring 2.6s ease-in-out infinite; /* keyframes อยู่ใน contact-buttons.css */
}

.header-cta small {
	display: block;
	font-size: 11px;
	font-weight: 500;
	opacity: .85;
}

/* ---------- เมนู จอคอม ---------- */
@media (min-width: 992px) {
	html #header.site-header .header-nav-main nav > ul > li > a {
		position: relative;
		padding: 10px 16px;
		margin: 0 2px;
		border-radius: 12px;
		background: transparent !important;
		color: #333 !important;
		font-size: 16px;
		font-weight: 600;
		text-transform: none;
		transition: background .2s ease, color .2s ease;
	}

	/* เส้นใต้เลื่อนออกตอนชี้ / หน้าปัจจุบัน */
	html #header.site-header .header-nav-main nav > ul > li:not(.nav-admin) > a::after {
		content: "";
		position: absolute;
		left: 16px;
		right: 16px;
		bottom: 4px;
		height: 3px;
		border-radius: 3px;
		background: #CE0001;
		transform: scaleX(0);
		transform-origin: left;
		transition: transform .25s ease;
	}

	html #header.site-header .header-nav-main nav > ul > li:not(.nav-admin) > a:hover,
	html #header.site-header .header-nav-main nav > ul > li:not(.nav-admin) > a.active {
		background: #fdf1f1 !important;
		color: #CE0001 !important;
	}

	html #header.site-header .header-nav-main nav > ul > li > a:hover .nav-ic,
	html #header.site-header .header-nav-main nav > ul > li > a.active .nav-ic { opacity: 1; }

	html #header.site-header .header-nav-main nav > ul > li:not(.nav-admin) > a:hover::after,
	html #header.site-header .header-nav-main nav > ul > li:not(.nav-admin) > a.active::after { transform: scaleX(1); }

	/* เมนูแอดมิน (สีอยู่ใน site-addons.css) */
	html #header.site-header .header-nav-main nav > ul > li.nav-admin > a { color: #CE0001 !important; background: #fdecec !important; }
	html #header.site-header .header-nav-main nav > ul > li.nav-admin > a:hover,
	html #header.site-header .header-nav-main nav > ul > li.nav-admin > a.active {
		color: #FFF !important;
		background: linear-gradient(120deg, #CE0001 0%, #8D0104 100%) !important;
	}

	html #header.site-header .header-nav-main nav > ul > li.dropdown .dropdown-menu {
		border-radius: 14px;
		box-shadow: 0 18px 40px rgba(0, 0, 0, .12);
		overflow: hidden;
	}
}

/* ---------- เมนู มือถือ / แท็บเล็ต ---------- */
@media (max-width: 991px) {
	html #header.site-header .header-btn-collapse-nav {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 46px;
		height: 46px;
		margin: 0;
		padding: 0;
		border: 0;
		border-radius: 14px;
		background: linear-gradient(120deg, #CE0001 0%, #8D0104 100%) !important;
		color: #FFF;
		font-size: 19px;
		box-shadow: 0 6px 16px rgba(206, 0, 1, .3);
	}

	html #header.site-header .header-nav-main nav {
		margin: 0 0 12px;
		padding: 8px;
		border-radius: 16px;
		background: #FFF;
		box-shadow: 0 14px 34px rgba(0, 0, 0, .1);
	}

	html #header.site-header .header-nav-main:not(.header-nav-main-mobile-dark) nav > ul > li > a {
		padding: 12px 14px;
		border-radius: 12px;
		color: #333 !important;
		font-size: 17px;
		font-weight: 600;
	}

	html #header.site-header .header-nav-main:not(.header-nav-main-mobile-dark) nav > ul > li:not(.nav-admin) > a.active {
		background: #fdecec !important;
		color: #CE0001 !important;
	}

	html #header.site-header .header-nav-main:not(.header-nav-main-mobile-dark) nav > ul > li.nav-admin > a {
		color: #FFF !important;
		background: linear-gradient(120deg, #CE0001 0%, #8D0104 100%) !important;
	}

	html #header.site-header .header-container { min-height: 74px; }
	#header.site-header .site-logo { height: 50px; }
	#header.site-header.is-scrolled .site-logo { height: 42px; }
}

@media (max-width: 575px) {
	.site-topbar { font-size: 14px; }
	.site-topbar-title { display: none; }
	.site-topbar .container { justify-content: center; }
	.site-topbar-links { width: 100%; }
	.site-topbar-links a { flex: 1 1 0; justify-content: center; min-width: 0; }
	#header.site-header .site-logo { height: auto; max-width: 220px; max-height: 50px; }
	#header.site-header.is-scrolled .site-logo { max-height: 42px; }
}

@media (prefers-reduced-motion: reduce) {
	.header-cta i { animation: none; }
	.header-cta, #header.site-header .site-logo { transition: none; }
}
