/**
 * Custom Header & Footer Styles
 *
 * Thiết kế dựa trên guides-3d.css
 *
 * @package    ComLink
 * @subpackage Theme/CSS
 * @since      1.0.0
 */

/* ==========================================
   CSS VARIABLES
   ========================================== */

:root {
	--comlink-primary-green: #00ff88;
	--comlink-cyan: #00d4ff;
	--comlink-purple: #a855f7;
	--comlink-dark-bg: #0a0a1a;
	--comlink-gradient: linear-gradient(90deg, #00ff88, #00d4ff);
	--comlink-header-height: 80px;
	--comlink-header-height-scrolled: 70px;
}

/* ==========================================
   AURORA COLOR ANIMATION
   ========================================== */

@keyframes auroraColor {
	0%, 100% {
		background-color: #0a0a1a;
		color: #ffffff;
	}
	25% {
		background-color: #fff8e1;
		color: #1a1a1a;
	}
	50% {
		background-color: #ddeeff;
		color: #00357b;
	}
	75% {
		background-color: #e8d5f2;
		color: #1a1a1a;
	}
}

@keyframes auroraColorNav {
	0%, 100% {
		color: #ffffff;
		font-weight: 500;
	}
	25% {
		color: #1a1a1a;
		font-weight: 700;
	}
	50% {
		color: #00357b;
		font-weight: 700;
	}
	75% {
		color: #1a1a1a;
		font-weight: 700;
	}
}

@keyframes auroraStroke {
	0%, 100% {
		stroke: #ffffff;
	}
	25% {
		stroke: #1a1a1a;
	}
	50% {
		stroke: #00357b;
	}
	75% {
		stroke: #1a1a1a;
	}
}

/* ==========================================
   HIDE FLATSOME DEFAULT HEADER
   ========================================== */

/* Ẩn các thành phần header mặc định của Flatsome */
.header-top,
.header-main,
.header-bottom,
.header-bg-container,
.top-divider {
	display: none !important;
}

/* ==========================================
   CUSTOM HEADER
   ========================================== */

.comlink-header {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 9999;
	padding: 15px 40px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	background-color: #0a0a1a;
	animation: auroraColor 12s ease infinite;
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	border-bottom: 1px solid rgba(255, 255, 255, 0.1);
	transition: padding 0.4s ease, height 0.4s ease, border 0.4s ease;
	height: var(--comlink-header-height);
	box-sizing: border-box;
}

.comlink-header.scrolled {
	padding: 10px 40px;
	background-color: #0a0a1a;
	animation: auroraColor 12s ease infinite;
	backdrop-filter: blur(20px);
	-webkit-backdrop-filter: blur(20px);
	border-bottom: 1px solid rgba(255, 255, 255, 0.15);
	height: var(--comlink-header-height-scrolled);
}

/* Logo */
.comlink-header .header-logo {
	display: flex;
	align-items: center;
	text-decoration: none;
}

.comlink-header .header-logo img {
	height: 60px;
	width: auto;
	transition: all 0.3s ease;
}

.comlink-header.scrolled .header-logo img {
	height: 50px;
}

/* Navigation */
.comlink-header .header-nav {
	display: flex;
	align-items: center;
	gap: 35px;
	margin-left: auto;
	margin-right: 20px;
}

.comlink-header .header-nav a {
	color: white;
	text-decoration: none;
	font-size: 15px;
	font-weight: 500;
	position: relative;
	padding: 8px 0;
	animation: auroraColorNav 12s ease infinite;
	transition: all 0.3s ease;
}

.comlink-header .header-nav a::after {
	content: '';
	position: absolute;
	bottom: 0;
	left: 0;
	width: 0;
	height: 2px;
	background: var(--comlink-gradient);
	transition: width 0.3s ease;
}

.comlink-header .header-nav a:hover {
	color: var(--comlink-primary-green);
}

.comlink-header .header-nav a:hover::after {
	width: 100%;
}

.comlink-header .header-nav a.active {
	color: var(--comlink-primary-green);
}

.comlink-header .header-nav a.active::after {
	width: 100%;
}

/* Search */
.header-search {
	display: flex;
	align-items: center;
	position: relative;
	z-index: 1;
}

.search-toggle {
	display: flex !important;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	background: transparent;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	color: #e65100;
	transition: all 0.3s ease;
	position: relative;
	z-index: 2;
	padding: 0;
}

.search-toggle:hover {
	transform: scale(1.1);
}

.search-toggle:hover svg {
	stroke: #ff6d00;
}

.search-toggle svg {
	width: 18px;
	height: 18px;
	stroke: #e65100;
	display: block;
}

.search-toggle svg circle,
.search-toggle svg path {
	stroke: #e65100;
	stroke-width: 2.5;
}

.search-form {
	position: absolute;
	right: 0;
	top: calc(100% + 10px);
	display: flex;
	align-items: center;
	background: rgba(10, 10, 26, 0.95);
	backdrop-filter: blur(20px);
	-webkit-backdrop-filter: blur(20px);
	border: 1px solid rgba(255, 255, 255, 0.15);
	border-radius: 8px;
	padding: 8px;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-10px);
	transition: all 0.3s ease;
	min-width: 280px;
	pointer-events: none;
	z-index: 1;
}

.search-form.active {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
	pointer-events: auto;
}

.search-input {
	flex: 1;
	background: transparent;
	border: none;
	color: white;
	font-size: 14px;
	padding: 10px 15px;
	outline: none;
}

.search-input::placeholder {
	color: rgba(255, 255, 255, 0.5);
}

.search-submit {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	background: var(--comlink-gradient);
	border: none;
	border-radius: 6px;
	cursor: pointer;
	color: var(--comlink-dark-bg);
	transition: all 0.3s ease;
}

.search-submit:hover {
	opacity: 0.9;
	transform: scale(1.05);
}

.search-submit svg {
	width: 16px;
	height: 16px;
}

/* Mobile Menu Button */
.mobile-menu-btn {
	display: none;
	flex-direction: column;
	gap: 5px;
	cursor: pointer;
	padding: 10px;
	background: none;
	border: none;
	z-index: 10001;
}

.mobile-menu-btn span {
	width: 22px;
	height: 2px;
	background: white;
	transition: all 0.3s ease;
	display: block;
	animation: auroraMenuBar 12s ease infinite;
}

@keyframes auroraMenuBar {
	0%, 100% {
		background: #ffffff;
	}
	25% {
		background: #1a1a1a;
	}
	50% {
		background: #00357b;
	}
	75% {
		background: #1a1a1a;
	}
}

.mobile-menu-btn.active span:nth-child(1) {
	transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active span:nth-child(2) {
	opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
	transform: rotate(-45deg) translate(5px, -5px);
}

/* ==========================================
   BODY PADDING (để content không bị header che)
   ========================================== */

body {
	padding-top: var(--comlink-header-height) !important;
}

body.scrolled-header {
	padding-top: var(--comlink-header-height-scrolled) !important;
}

/* ==========================================
   CUSTOM FOOTER
   ========================================== */

/* Ẩn footer mặc định của Flatsome */
.footer-widgets.footer-1,
.footer-widgets.footer-2 {
	display: none !important;
}

.comlink-footer {
	padding: 60px 40px 30px;
	border-top: 1px solid rgba(255, 255, 255, 0.1);
	background: var(--comlink-dark-bg);
	color: white;
}

.footer-content {
	max-width: 1200px;
	margin: 0 auto;
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 40px;
}

.footer-section .office-icon {
	width: 32px;
	height: 32px;
	margin-bottom: 10px;
	color: var(--comlink-purple);
}

.footer-section .office-icon svg {
	width: 100%;
	height: 100%;
}

.footer-section h4 {
	font-size: 16px;
	margin-bottom: 15px;
	color: var(--comlink-primary-green);
	font-weight: 600;
}

.footer-section p,
.footer-section a {
	font-size: 14px;
	line-height: 1.8;
	opacity: 0.8;
	color: white;
	text-decoration: none;
	display: block;
	margin: 0;
}

.footer-section a:hover {
	color: var(--comlink-primary-green);
	opacity: 1;
}

.footer-bottom {
	max-width: 1200px;
	margin: 40px auto 0;
	padding-top: 30px;
	border-top: 1px solid rgba(255, 255, 255, 0.1);
	text-align: center;
}

.footer-social {
	display: flex;
	justify-content: center;
	gap: 15px;
	margin-bottom: 20px;
}

.footer-social a {
	width: 40px;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 50%;
	color: white;
	text-decoration: none;
	transition: all 0.3s ease;
}

.footer-social a:hover {
	background: rgba(0, 255, 136, 0.2);
	border-color: rgba(0, 255, 136, 0.5);
	transform: translateY(-3px);
}

.footer-social a svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
}

.footer-bottom p {
	font-size: 14px;
	opacity: 0.6;
	margin: 0;
}

/* ==========================================
   RESPONSIVE - TABLET
   ========================================== */

@media (max-width: 900px) {
	.comlink-header {
		padding: 15px 20px;
		justify-content: space-between;
	}

	/* Reorder: Menu (left) | Logo (center) | Search (right) */
	.comlink-header .mobile-menu-btn {
		order: 1;
		display: flex;
		margin-right: auto;
	}

	.comlink-header .header-logo {
		order: 2;
		position: absolute;
		left: 50%;
		transform: translateX(-50%);
	}

	.comlink-header .header-search {
		order: 3;
		margin-left: auto;
		margin-right: 0;
	}

	.comlink-header .header-nav {
		order: 4;
		position: fixed;
		top: var(--comlink-header-height);
		left: 0;
		right: 0;
		background: rgba(10, 10, 26, 0.98);
		backdrop-filter: blur(20px);
		-webkit-backdrop-filter: blur(20px);
		flex-direction: column;
		padding: 30px;
		gap: 20px;
		transform: translateY(-150%);
		opacity: 0;
		transition: all 0.3s ease;
		z-index: 9998;
	}

	.comlink-header .header-nav.active {
		transform: translateY(0);
		opacity: 1;
	}

	/* Override aurora animation for mobile menu - always white text on dark bg */
	.comlink-header .header-nav a {
		color: #ffffff !important;
		animation: none !important;
		font-weight: 500;
		font-size: 18px;
	}

	.comlink-header .header-nav a:hover,
	.comlink-header .header-nav a.active {
		color: var(--comlink-primary-green) !important;
	}

	.comlink-header.scrolled .header-nav {
		top: var(--comlink-header-height-scrolled);
	}

	.comlink-header.scrolled .header-logo {
		/* Keep centered when scrolled */
	}

	.search-form {
		position: fixed;
		top: var(--comlink-header-height);
		left: 20px;
		right: 20px;
		min-width: auto;
	}

	.comlink-header.scrolled + .search-form,
	.comlink-header.scrolled .search-form {
		top: var(--comlink-header-height-scrolled);
	}
}

/* ==========================================
   RESPONSIVE - MOBILE
   ========================================== */

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

	.comlink-footer {
		padding: 40px 20px 20px;
	}

	.footer-section {
		text-align: center;
	}

	.footer-section .office-icon {
		margin: 0 auto 10px;
	}
}

@media (max-width: 600px) {
	.comlink-header {
		padding: 10px 15px;
	}

	.comlink-header .header-logo img {
		height: 50px;
	}

	.comlink-header.scrolled .header-logo img {
		height: 45px;
	}

	.mobile-menu-btn {
		padding: 8px;
	}

	.mobile-menu-btn span {
		width: 20px;
	}
}

/* ==========================================
   ACCESSIBILITY
   ========================================== */

@media (prefers-reduced-motion: reduce) {
	.comlink-header,
	.comlink-header .header-nav,
	.search-form,
	.mobile-menu-btn span {
		transition: none;
	}
}

/* Focus states for accessibility */
.comlink-header .header-nav a:focus,
.search-toggle:focus,
.search-submit:focus,
.mobile-menu-btn:focus,
.footer-social a:focus {
	outline: 2px solid var(--comlink-primary-green);
	outline-offset: 2px;
}

/* ==========================================
   SPECIAL PAGES COMPATIBILITY
   ========================================== */

/* Trang sử dụng template 3D đã có header/footer riêng */
.comlink-guides-3d .comlink-header,
.comlink-guides-3d .comlink-footer,
.comlink-products-3d .comlink-header,
.comlink-products-3d .comlink-footer,
.comlink-solutions-3d .comlink-header,
.comlink-solutions-3d .comlink-footer,
.comlink-news-3d .comlink-header,
.comlink-news-3d .comlink-footer,
.comlink-contact-3d .comlink-header,
.comlink-contact-3d .comlink-footer {
	display: none !important;
}

/* Reset body padding cho trang 3D */
.comlink-guides-3d,
.comlink-products-3d,
.comlink-solutions-3d,
.comlink-news-3d,
.comlink-contact-3d {
	padding-top: 0 !important;
}
