/**
 * Web3s News Main Stylesheet
 * Responsive, Newspaper Layout with Premium Aesthetics
 */

/* ==========================================
   1. VARIABLES & RESET
   ========================================== */
:root {
	/* Default colors - overridden by inline functions.php style tag */
	--primary-color: #0B3C5D;
	--secondary-color: #D9B310;
	--link-color: #0B3C5D;
	--link-hover-color: #D9B310;
	--btn-bg: #0B3C5D;
	--btn-text: #ffffff;
	--btn-hover-bg: #D9B310;
	--btn-hover-text: #ffffff;
	
	--bg-light: #F5F7FA;
	--bg-card: #ffffff;
	--text-color: #2D3748;
	--text-muted: #718096;
	--border-color: #E2E8F0;
	--shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
	--shadow-md: 0 4px 6px rgba(0,0,0,0.05);
	--radius: 8px;
	--transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark-mode {
	--bg-light: #0d131e;
	--bg-card: #1a202c;
	--text-color: #e2e8f0;
	--text-muted: #a0aec0;
	--border-color: #2d3748;
}

* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

body {
	background-color: var(--bg-light);
	color: var(--text-color);
	line-height: 1.6;
	transition: background-color 0.3s, color 0.3s;
}

a {
	color: var(--link-color);
	text-decoration: none;
	transition: var(--transition);
}

a:hover {
	color: var(--link-hover-color);
}

img {
	max-width: 100%;
	height: auto;
	display: block;
}

.container {
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 20px;
}

/* ==========================================
   2. HEADER & NAVIGATION
   ========================================== */
header {
	background-color: var(--bg-card);
	border-bottom: 1px solid var(--border-color);
	position: sticky;
	top: 0;
	z-index: 100;
	backdrop-filter: blur(8px);
	background-color: rgba(255, 255, 255, 0.95);
	transition: var(--transition);
}

body.dark-mode header {
	background-color: rgba(26, 32, 44, 0.95);
}

.header-container {
	display: flex;
	justify-content: space-between;
	align-items: center;
	height: 70px;
}

.logo a {
	font-size: 24px;
	font-weight: 800;
	letter-spacing: -0.5px;
	color: var(--primary-color);
}

.nav-menu ul {
	display: flex;
	list-style: none;
	gap: 20px;
	align-items: center;
	margin: 0;
}

.nav-menu li {
	position: relative;
}

.nav-menu a {
	font-weight: 600;
	font-size: 15px;
	color: var(--text-color);
	display: inline-block;
	padding: 10px 0;
}

.nav-menu a:hover,
.nav-menu .current-menu-item > a {
	color: var(--secondary-color);
}

/* Dropdown Menu (Submenu) Desktop */
.nav-menu .sub-menu,
.nav-menu .children {
	position: absolute;
	top: 100%;
	left: 0;
	background-color: var(--bg-card);
	border: 1px solid var(--border-color);
	border-radius: 4px;
	min-width: 200px;
	box-shadow: var(--shadow-md);
	display: flex;
	flex-direction: column;
	gap: 0;
	padding: 10px 0;
	z-index: 999;
	opacity: 0;
	visibility: hidden;
	transform: translateY(10px);
	transition: all 0.2s ease;
}

.nav-menu li:hover > .sub-menu,
.nav-menu li:hover > .children {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.nav-menu .sub-menu li,
.nav-menu .children li {
	width: 100%;
}

.nav-menu .sub-menu a,
.nav-menu .children a {
	padding: 8px 20px;
	display: block;
	width: 100%;
	font-size: 14px;
	font-weight: 500;
}

.nav-menu .sub-menu a:hover,
.nav-menu .children a:hover {
	background-color: rgba(0,0,0,0.02);
	color: var(--secondary-color);
}

body.dark-mode .nav-menu .sub-menu a:hover,
body.dark-mode .nav-menu .children a:hover {
	background-color: rgba(255,255,255,0.03);
}

/* Nút ẩn mũi tên chỉ hiện ở Mobile */
.submenu-toggle-arrow {
	display: none;
}

/* Nút Hamburger ẩn ở Desktop */
.mobile-menu-toggle {
	display: none;
	background: none;
	border: none;
	font-size: 20px;
	color: var(--text-color);
	cursor: pointer;
	padding: 5px;
}

.header-actions {
	display: flex;
	align-items: center;
	gap: 15px;
}

.theme-switch {
	background: none;
	border: none;
	cursor: pointer;
	color: var(--text-color);
	font-size: 18px;
}

/* Flags translation selector */
.lang-selector {
	display: flex;
	gap: 8px;
	align-items: center;
}

.lang-flag {
	width: 24px;
	height: 16px;
	cursor: pointer;
	opacity: 0.7;
	transition: var(--transition);
	border: 1px solid var(--border-color);
	border-radius: 2px;
	object-fit: cover;
}

.lang-flag:hover, .lang-flag.active {
	opacity: 1;
	transform: scale(1.1);
	border-color: var(--secondary-color);
}

/* ==========================================
   3. HERO & MAGAZINE LAYOUT (HOME)
   ========================================== */
.magazine-grid {
	display: grid;
	grid-template-columns: 2fr 1fr;
	gap: 30px;
	margin: 40px 0;
}

@media (max-width: 992px) {
	.magazine-grid {
		grid-template-columns: 1fr;
	}
}

.featured-slider {
	position: relative;
	border-radius: var(--radius);
	overflow: hidden;
	height: 400px;
	margin-bottom: 30px;
}

.slider-item {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
}

.slider-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.slider-overlay {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
	padding: 30px;
	color: #fff;
}

.slider-overlay h2 a {
	color: #fff;
	font-size: 24px;
}

/* Category Blocks */
.category-block {
	margin-bottom: 40px;
}

.block-title {
	border-bottom: 2px solid var(--primary-color);
	padding-bottom: 8px;
	margin-bottom: 20px;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.block-title h3 {
	font-size: 18px;
	text-transform: uppercase;
	color: var(--primary-color);
	margin: 0;
}

.news-list {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 20px;
}

@media (max-width: 768px) {
	.news-list {
		grid-template-columns: 1fr;
	}
}

.card-item {
	background: var(--bg-card);
	border: 1px solid var(--border-color);
	border-radius: var(--radius);
	overflow: hidden;
	transition: var(--transition);
}

.card-item:hover {
	transform: translateY(-3px);
	box-shadow: var(--shadow-md);
}

.card-img-wrapper {
	height: 180px;
	overflow: hidden;
}

.card-img-wrapper img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: var(--transition);
}

.card-item:hover .card-img-wrapper img {
	transform: scale(1.05);
}

.card-content {
	padding: 15px;
}

.card-meta {
	font-size: 12px;
	color: var(--text-muted);
	margin-bottom: 8px;
}

.card-title {
	font-size: 16px;
	font-weight: 600;
	margin-bottom: 10px;
}

.card-title a {
	color: var(--text-color);
}

.card-title a:hover {
	color: var(--link-hover-color);
}

/* ==========================================
   4. SINGLE POST PAGE (CTA FORM, RELATED)
   ========================================== */
.post-layout {
	display: grid;
	grid-template-columns: 2.5fr 1fr;
	gap: 30px;
	margin: 40px 0;
}

@media (max-width: 992px) {
	.post-layout {
		grid-template-columns: 1fr;
	}
}

.post-header {
	margin-bottom: 25px;
}

.post-title-main {
	font-size: 32px;
	line-height: 1.3;
	margin-bottom: 15px;
}

.post-entry-content {
	font-size: 17px;
	line-height: 1.8;
}

.post-entry-content p {
	margin-bottom: 20px;
}

/* CTA conversion form in post detail */
.post-cta-box {
	background: linear-gradient(135deg, var(--primary-color), #165685);
	color: #fff;
	padding: 25px;
	border-radius: var(--radius);
	margin: 35px 0;
	box-shadow: var(--shadow-md);
}

.post-cta-box h3 {
	margin-bottom: 10px;
	font-size: 20px;
}

.post-cta-box p {
	font-size: 14px;
	opacity: 0.9;
	margin-bottom: 15px;
}

.post-cta-btn {
	display: inline-block;
	background-color: var(--secondary-color);
	color: var(--btn-text);
	padding: 10px 20px;
	border-radius: 4px;
	font-weight: 600;
	transition: var(--transition);
}

.post-cta-btn:hover {
	transform: scale(1.03);
	color: #fff;
}

/* ==========================================
   5. FOOTER NEWSPAPER STYLE
   ========================================== */
footer {
	background-color: #1a202c;
	color: #a0aec0;
	padding: 50px 0 20px 0;
	border-top: 5px solid var(--primary-color);
	margin-top: 50px;
}

.footer-grid {
	display: grid;
	grid-template-columns: 1.5fr 1fr 1fr 1fr;
	gap: 30px;
	margin-bottom: 40px;
}

@media (max-width: 768px) {
	.footer-grid {
		grid-template-columns: 1fr;
	}
}

.footer-col h4 {
	color: #fff;
	margin-bottom: 20px;
	font-size: 16px;
	text-transform: uppercase;
	position: relative;
	padding-bottom: 8px;
}

.footer-col h4::after {
	content: '';
	position: absolute;
	bottom: 0;
	left: 0;
	width: 40px;
	height: 2px;
	background-color: var(--secondary-color);
}

.footer-col ul {
	list-style: none;
}

.footer-col ul li {
	margin-bottom: 10px;
}

.footer-col ul a {
	color: #a0aec0;
}

.footer-col ul a:hover {
	color: #fff;
	padding-left: 5px;
}

.social-icons {
	display: flex;
	gap: 12px;
	margin-top: 15px;
}

.social-icon {
	width: 32px;
	height: 32px;
	background-color: #2d3748;
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	transition: var(--transition);
}

.social-icon:hover {
	background-color: var(--secondary-color);
	color: #fff;
}

.footer-bottom {
	border-top: 1px solid #2d3748;
	padding-top: 20px;
	text-align: center;
	font-size: 13px;
}

/* ==========================================
   6. PAGINATION & LOADER
   ========================================== */
.pagination {
	display: flex;
	justify-content: center;
	gap: 8px;
	margin: 30px 0;
}

.page-numbers {
	padding: 8px 14px;
	border: 1px solid var(--border-color);
	background: var(--bg-card);
	border-radius: 4px;
	font-weight: 500;
}

.page-numbers.current, .page-numbers:hover {
	background-color: var(--primary-color);
	color: #fff;
	border-color: var(--primary-color);
}

.load-more-container {
	text-align: center;
	margin: 30px 0;
}

.load-more-btn {
	background-color: var(--btn-bg);
	color: var(--btn-text);
	border: none;
	padding: 10px 24px;
	font-weight: 600;
	border-radius: var(--radius);
	cursor: pointer;
	transition: var(--transition);
}

.load-more-btn:hover {
	background-color: var(--btn-hover-bg);
	color: var(--btn-hover-text);
}

/* No Image Fallback Styles */
.no-image-wrapper {
	background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	position: relative;
	height: 180px;
	width: 100%;
}

.no-image-wrapper a {
	display: flex;
	width: 100%;
	height: 100%;
	align-items: center;
	justify-content: center;
}

body.dark-mode .no-image-wrapper {
	background: linear-gradient(135deg, #1e293b, #334155);
}

.no-image-overlay {
	color: var(--text-muted);
	font-weight: 600;
	font-size: 13.5px;
	padding: 20px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
}

body.dark-mode .no-image-overlay {
	color: #94a3b8;
}

/* ==========================================
   7. RESPONSIVE OPTIMIZATIONS (MOBILE & TABLET)
   ========================================== */
@media (max-width: 768px) {
	/* Kích hoạt nút Hamburger và ẩn thanh menu ngang mặc định */
	.mobile-menu-toggle {
		display: block;
	}

	.nav-menu {
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		background-color: var(--bg-card);
		border-bottom: 2px solid var(--primary-color);
		max-height: 0;
		overflow: hidden;
		transition: max-height 0.35s ease;
		box-shadow: var(--shadow-md);
	}

	.nav-menu.active {
		max-height: 400px;
		overflow-y: auto;
	}

	.nav-menu ul {
		flex-direction: column;
		align-items: flex-start;
		gap: 0;
		padding: 15px 20px;
		width: 100%;
	}

	.nav-menu li {
		width: 100%;
		border-bottom: 1px solid var(--border-color);
	}

	.nav-menu li:last-child {
		border-bottom: none;
	}

	.nav-menu a {
		padding: 12px 0;
		width: 100%;
	}

	/* CSS cho Submenu trên Mobile (Accordion) */
	.nav-menu .sub-menu,
	.nav-menu .children {
		position: static;
		box-shadow: none;
		border: none;
		border-left: 2px solid var(--secondary-color);
		padding: 5px 0 10px 15px;
		margin-left: 10px;
		display: none; /* Điều khiển bởi JS */
		opacity: 1;
		visibility: visible;
		transform: none;
		min-width: unset;
		width: 100%;
	}

	/* Nút mũi tên Toggle Submenu di động */
	.submenu-toggle-arrow {
		display: inline-flex;
		position: absolute;
		right: 0;
		top: 8px;
		width: 36px;
		height: 36px;
		align-items: center;
		justify-content: center;
		cursor: pointer;
		color: var(--text-color);
		background-color: rgba(0,0,0,0.02);
		border-radius: 4px;
		transition: var(--transition);
	}

	body.dark-mode .submenu-toggle-arrow {
		background-color: rgba(255,255,255,0.03);
	}

	.submenu-toggle-arrow.expanded i {
		transform: rotate(180deg);
	}

	.submenu-toggle-arrow i {
		transition: transform 0.2s ease;
	}

	/* Căn chỉnh lại lưới nội dung bài viết và sidebar */
	.magazine-grid, .post-layout {
		grid-template-columns: 1fr;
		gap: 20px;
	}

	.featured-slider {
		height: 280px;
	}

	.slider-overlay h2 a {
		font-size: 18px;
	}

	/* Footer báo chí co dãn mobile */
	.footer-grid {
		grid-template-columns: 1fr;
		gap: 25px;
		text-align: left;
	}

	.footer-col h4::after {
		left: 0;
		transform: none;
	}

	.post-title-main {
		font-size: 24px;
	}

	.post-entry-content {
		font-size: 15.5px;
	}

	.lp-hero h1 {
		font-size: 28px;
	}

	.lp-hero p {
		font-size: 15px;
	}

	.lp-services-grid {
		grid-template-columns: 1fr;
	}

	.lp-contact-section {
		padding: 25px;
	}
}

/* ==========================================
   8. MEGA MENU & HIERARCHICAL SUB-MENUS
   ========================================== */
@media (min-width: 769px) {
	header .header-container {
		position: relative;
	}

	.nav-menu .mega-menu-item {
		position: static !important;
	}

	.nav-menu .mega-menu-item > .mega-menu-wrapper {
		left: 0;
		right: 0;
		width: 100%;
		max-width: 1200px;
		margin: 0 auto;
		position: absolute;
		top: 100%;
		opacity: 0;
		visibility: hidden;
		pointer-events: none;
		transform: translateY(10px);
		display: grid !important;
		grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
		align-items: start !important;
		gap: 20px;
		padding: 25px 30px;
		border-radius: var(--radius);
		box-shadow: 0 10px 30px rgba(0,0,0,0.08);
		background-color: var(--bg-card);
		border: 1px solid var(--border-color);
		z-index: 999;
		transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
	}

	.nav-menu .mega-menu-item:hover > .mega-menu-wrapper {
		opacity: 1;
		visibility: visible;
		pointer-events: auto;
		transform: translateY(0);
	}

	.nav-menu .mega-menu-wrapper > li {
		width: auto !important;
		border-bottom: none !important;
	}

	.nav-menu .mega-menu-wrapper > li > a {
		font-weight: 700 !important;
		color: var(--primary-color) !important;
		border-bottom: 2px solid var(--border-color);
		padding: 0 0 8px 0 !important;
		margin-bottom: 12px;
		display: block;
		font-size: 15px;
	}

	body.dark-mode .nav-menu .mega-menu-wrapper > li > a {
		color: var(--secondary-color) !important;
	}

	.nav-menu .mega-menu-wrapper > li .sub-menu,
	.nav-menu .mega-menu-wrapper > li .children {
		position: static !important;
		opacity: 1 !important;
		visibility: visible !important;
		transform: none !important;
		box-shadow: none !important;
		border: none !important;
		padding: 0 !important;
		background: none !important;
		display: flex !important;
		flex-direction: column !important;
		gap: 6px !important;
	}

	.nav-menu .mega-menu-wrapper > li .sub-menu a,
	.nav-menu .mega-menu-wrapper > li .children a {
		padding: 4px 0 !important;
		font-size: 13.5px !important;
		color: var(--text-color) !important;
		font-weight: 500 !important;
	}

	.nav-menu .mega-menu-wrapper > li .sub-menu a:hover,
	.nav-menu .mega-menu-wrapper > li .children a:hover {
		color: var(--secondary-color) !important;
		background: none !important;
		padding-left: 3px !important;
	}
}

@media (max-width: 768px) {
	.nav-menu .sub-menu .sub-menu,
	.nav-menu .children .children {
		margin-left: 15px !important;
		border-left: 1px dashed var(--border-color) !important;
		padding-left: 10px !important;
		margin-top: 5px;
		margin-bottom: 5px;
		display: none;
	}
}


