/* ================================================================
   SNERA BASE — thay thế phần nền tảng của Flatsome
   (reset nhẹ, container, flex utilities, header, mobile menu)
   Nạp TRƯỚC style.css chính của theme.
   ================================================================ */

:root {
	--snera-site-width: 1280px;   /* JS template đọc từ .container → đồng bộ tự động */
	--header-height: 90px;
}

/* ---------- Reset nhẹ ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	font-family: var(--font-body, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif);
	font-weight: 300;
	font-size: 16px;
	line-height: 1.6;
	color: #333;
	background: #fff;
}
img { max-width: 100%; height: auto; border: 0; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--color-gold, #B18F4F); }
ul.nav, ul.nav ul { list-style: none; margin: 0; padding: 0; }
button { font: inherit; cursor: pointer; }
h1, h2, h3, h4, h5, h6 { line-height: 1.3; margin: 0 0 0.5em; }
p { margin: 0; }

/* ---------- Container / grid tối thiểu ---------- */
.container {
	width: 100%;
	max-width: var(--snera-site-width, 1280px);
	margin-left: auto;
	margin-right: auto;
	padding-left: 15px;
	padding-right: 15px;
}
.fill { position: absolute; top: 0; right: 0; bottom: 0; left: 0; }
.row { display: flex; flex-wrap: wrap; margin-left: -15px; margin-right: -15px; }
.row .col { padding: 0 15px 30px; width: 100%; }
.col-inner { position: relative; }
@media (min-width: 850px) {
	.row .col.large-3 { width: 25%; }
	.row .col.large-9 { width: 75%; }
	.row .col.large-12 { width: 100%; }
}
.text-center { text-align: center; }

/* ---------- Flex utilities (markup header kiểu Flatsome) ---------- */
.flex-row { display: flex; align-items: center; width: 100%; }
.flex-col { display: flex; align-items: center; min-height: 0; }
.flex-grow { flex: 1 1 auto; }
.flex-left { margin-right: auto; }
.flex-right { margin-left: auto; }
.flex-center { margin: 0 auto; }

/* Breakpoint hiển thị: khớp 768px mà style.css đang dùng */
@media (max-width: 768px) {
	.hide-for-medium { display: none !important; }
}
@media (min-width: 769px) {
	.show-for-medium { display: none !important; }
}

/* ---------- Header khung ---------- */
#header { position: relative; z-index: 30; width: 100%; }
.header-wrapper { position: relative; width: 100%; }
.header-main { position: relative; z-index: 1; }
.header-inner {
	position: relative;
	z-index: 2;
	min-height: var(--header-height, 90px);
}
.header-bg-container { z-index: 0; overflow: hidden; }
.header-bg-color { background-color: #fff; transition: background-color 0.3s ease; }
.header-bg-image { background-position: 50% 0; background-repeat: repeat-x; }

#logo { line-height: 1; }
#logo a { display: block; }
#logo img { display: block; max-height: 56px; width: auto; }
@media (max-width: 768px) {
	#logo img { max-height: 42px; }
}

/* Trạng thái transparent (các template full-scroll)
   Lưu ý: theo yêu cầu, ở section hero header VẪN GIỮ lớp nền trắng
   (.header-bg-color) giống trạng thái sau khi cuộn — chỉ bỏ nền của chính
   phần tử #header để lớp bg-color/bg-image đảm nhiệm. Trạng thái rời hero
   vẫn do CSS trong từng template quyết định (mục 3 spec, dùng !important). */
#header.transparent {
	position: absolute;
	top: 0; left: 0; right: 0;
	background: transparent;
}

/* ---------- Căn phải menu desktop (MMM lẫn fallback) ---------- */
@media (min-width: 769px) {
	.header-inner > .flex-col.hide-for-medium.flex-right { justify-content: flex-end; }
	.header-inner > .flex-col.hide-for-medium.flex-right > * { margin-left: auto; }
	/* Max Mega Menu: dàn item về phía phải kể cả khi wrap chiếm full width */
	#header #mega-menu-wrap-primary #mega-menu-primary {
		display: flex;
		flex-wrap: wrap;
		justify-content: flex-end;
		align-items: center;
	}
	.nav-right { justify-content: flex-end; }
}

/* ---------- Nav fallback (khi không dùng Max Mega Menu) ---------- */
.header-nav-main { display: flex; align-items: center; flex-wrap: wrap; }
.header-nav-main > li { position: relative; }
.header-nav-main > li > a {
	display: block;
	padding: 10px 14px;
	font-weight: 500;
	color: var(--color-forest, #152B1C);
}
.header-nav-main > li > ul.sub-menu {
	position: absolute;
	top: 100%; left: 0;
	min-width: 200px;
	background: #fff;
	border-radius: var(--radius-sm, 8px);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
	padding: 8px 0;
	opacity: 0; visibility: hidden;
	transform: translateY(6px);
	transition: 0.2s ease;
	z-index: 40;
}
.header-nav-main > li:hover > ul.sub-menu { opacity: 1; visibility: visible; transform: none; }
.header-nav-main ul.sub-menu a { display: block; padding: 8px 16px; }

/* ---------- Hamburger icon ---------- */
.nav-icon > a {
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--color-forest, #152B1C);
}
/* 3 vạch tường minh: vạch giữa = chính phần tử, vạch trên/dưới = ::before/::after
   (không dùng box-shadow — một số trình duyệt/rule khác từng làm mất vạch). */
i.icon-menu {
	position: relative;
	display: inline-block;
	width: 18px; height: 2px;
	background: currentColor;
	transition: background 0.2s ease;
}
i.icon-menu::before,
i.icon-menu::after {
	content: '';
	position: absolute;
	left: 0;
	width: 18px; height: 2px;
	background: currentColor;
	transition: transform 0.2s ease, top 0.2s ease;
}
i.icon-menu::before { top: -6px; }
i.icon-menu::after  { top: 6px; }

/* Trạng thái mở: biến thành dấu X */
body.snera-menu-open i.icon-menu { background: transparent; }
body.snera-menu-open i.icon-menu::before { top: 0; transform: rotate(45deg); }
body.snera-menu-open i.icon-menu::after  { top: 0; transform: rotate(-45deg); }

/* ---------- Mobile menu (off-canvas dropdown dưới header) ---------- */
.nav-overlay-bg {
	position: fixed;
	top: var(--header-height, 90px); left: 0; right: 0; bottom: 0;
	background: rgba(0, 0, 0, 0.25);
	opacity: 0; visibility: hidden;
	transition: opacity 0.25s ease, visibility 0.25s ease;
	z-index: 1050;
}
body.snera-menu-open .nav-overlay-bg { opacity: 1; visibility: visible; }

#main-menu {
	position: fixed;
	top: var(--header-height, 90px); left: 0; right: 0;
	height: calc(100dvh - var(--header-height, 90px));
	background: #fff;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	opacity: 0; visibility: hidden;
	transform: translateY(-10px);
	transition: opacity 0.28s ease, visibility 0.28s ease, transform 0.28s ease;
	z-index: 1060;
}
body.snera-menu-open #main-menu { opacity: 1; visibility: visible; transform: none; }
body.snera-menu-open { overflow: hidden; }

#main-menu .sidebar-menu { padding: 8px 0 40px; }
#main-menu .nav-vertical { display: block; }
#main-menu .nav li > ul.sub-menu { display: none; }
#main-menu .nav li.snera-sub-open > ul.sub-menu { display: block; }

/* Nút mở submenu (JS chèn vào li.menu-item-has-children) */
#main-menu .nav li > button.toggle { color: var(--color-forest, #152B1C); }
#main-menu .nav li > button.toggle::before {
	content: '';
	display: block;
	width: 8px; height: 8px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
	transition: transform 0.2s ease;
	margin-top: -4px;
}
#main-menu .nav li.snera-sub-open > button.toggle::before {
	transform: rotate(225deg);
	margin-top: 4px;
}
.no-scrollbar { scrollbar-width: none; }
.no-scrollbar::-webkit-scrollbar { display: none; }

/* ---------- Admin bar (khi đăng nhập) ---------- */
body.admin-bar #header { top: var(--wp-admin--admin-bar--height, 32px); }
body.admin-bar .snera-scroll-root { height: calc(100dvh - var(--wp-admin--admin-bar--height, 32px)); }
body.admin-bar .nav-overlay-bg,
body.admin-bar #main-menu { top: calc(var(--header-height, 90px) + var(--wp-admin--admin-bar--height, 32px)); }
body.admin-bar #main-menu { height: calc(100dvh - var(--header-height, 90px) - var(--wp-admin--admin-bar--height, 32px)); }

/* ---------- Grid Flatsome-tương-đương cho markup section/row/col
   (plugin [snera_contact] và các shortcode cũ dùng) ---------- */
.section { position: relative; width: 100%; padding-top: 30px; padding-bottom: 30px; }
.section .section-bg { overflow: hidden; }
.absolute { position: absolute; }
.relative { position: relative; }
.bg-fill, .section-bg { background-position: 50% 50%; background-size: cover; background-repeat: no-repeat; }
.section-content { position: relative; z-index: 1; width: 100%; max-width: var(--snera-site-width, 1280px); margin: 0 auto; padding-left: 15px; padding-right: 15px; }
.row.align-center { justify-content: center; }
.row.align-middle { align-items: center; }
.text-left { text-align: left; }
@media (min-width: 550px) {
	.row .col.medium-3 { width: 25%; }
	.row .col.medium-4 { width: 33.3333%; }
	.row .col.medium-6 { width: 50%; }
	.row .col.medium-8 { width: 66.6667%; }
	.row .col.medium-12 { width: 100%; }
}
@media (min-width: 850px) {
	.row .col.large-4 { width: 33.3333%; }
	.row .col.large-6 { width: 50%; }
	.row .col.large-8 { width: 66.6667%; }
}

/* ---------- Nội dung trang chuẩn (blog, page, single) ---------- */
.snera-page-content { padding: 40px 0 60px; }
.pagination { display: flex; justify-content: center; }
.pagination .nav-links { display: flex; gap: 6px; flex-wrap: wrap; }
.pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 36px; height: 36px;
	padding: 0 10px;
	border: 1px solid var(--color-border, #dedede);
	border-radius: var(--radius-sm, 8px);
}
.pagination .page-numbers.current {
	background: var(--color-forest, #152B1C);
	color: #fff;
	border-color: var(--color-forest, #152B1C);
}

/* ================================================================
   HEADER PHIÊN BẢN TRANSPARENT
   Áp cho template có "Transparent" trong tên file/Template Name
   (theme tự gắn class .snera-transparent-hero + .snera-at-hero).
   Đầu trang: không nền, menu + logo trắng. Cuộn khỏi hero: các rule
   :not(.snera-at-hero) của template (spec mục 3) tiếp quản → như header thường.
   ================================================================ */

/* Nền trong suốt ở hero */
#header.snera-transparent-hero.snera-at-hero,
#header.snera-transparent-hero.snera-at-hero .header-wrapper,
#header.snera-transparent-hero.snera-at-hero .header-bg-color,
#header.snera-transparent-hero.snera-at-hero .header-bg-image {
	background: transparent !important;
	background-color: transparent !important;
	box-shadow: none !important;
}

/* Logo: dùng bản trắng (option snera_logo_white của plugin Site Info Footer) */
#header.snera-transparent-hero.snera-at-hero #logo .header-logo-white { display: inline-block !important; }
#header.snera-transparent-hero.snera-at-hero #logo .header-logo-sticky,
#header.snera-transparent-hero.snera-at-hero #logo .header_logo,
#header.snera-transparent-hero.snera-at-hero #logo .header-logo-dark { display: none !important; }

/* Menu trắng: Max Mega Menu (item cấp 1 + mũi tên) và nav fallback */
#header.snera-transparent-hero.snera-at-hero #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > a.mega-menu-link,
#header.snera-transparent-hero.snera-at-hero #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > a.mega-menu-link:hover {
	color: #fff !important;
}
#header.snera-transparent-hero.snera-at-hero #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > a.mega-menu-link .mega-indicator,
#header.snera-transparent-hero.snera-at-hero #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > a.mega-menu-link .mega-indicator::before,
#header.snera-transparent-hero.snera-at-hero #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > a.mega-menu-link .mega-indicator::after {
	color: #fff !important;
	border-top-color: #fff !important;
}
#header.snera-transparent-hero.snera-at-hero .header-nav-main.nav > li > a { color: #fff !important; }

/* Mobile: hamburger trắng ở hero (chỉ đổi color — KHÔNG đè background lên <i>,
   vạch giữa hamburger vẽ bằng background:currentColor) */
@media (max-width: 768px) {
	#header.snera-transparent-hero.snera-at-hero.has-transparent.transparent .show-for-medium.flex-left .nav-icon > a,
	#header.snera-transparent-hero.snera-at-hero .show-for-medium.flex-left .nav-icon > a {
		color: #fff !important;
		background: transparent !important;
	}
	#header.snera-transparent-hero.snera-at-hero.has-transparent.transparent .show-for-medium.flex-left .nav-icon > a i,
	#header.snera-transparent-hero.snera-at-hero .show-for-medium.flex-left .nav-icon > a i {
		color: #fff !important;
	}
}
