/* ==========================================================================
   Protoola — Layout
   Navigation, mega-menu, header search, page headers, footer.
   Replaces the ~370 lines of CSS the original main.js injected at runtime.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Navbar
   -------------------------------------------------------------------------- */
.navbar {
	position: fixed;
	top: 0;
	left: 0;
	z-index: 999;
	width: 100%;
	margin: 0;
	background: var(--nav-bg);
	backdrop-filter: blur(16px);
	-webkit-backdrop-filter: blur(16px);
	border-bottom: 1px solid var(--card-border-soft);
	transition: background 0.3s;
}

.navbar .container {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: var(--nav-height);
}

.logo {
	font-size: 1.6rem;
	font-weight: 700;
	letter-spacing: -0.5px;
	line-height: 1;
}

.logo a {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	color: inherit;
}

.logo span {
	background: var(--protoola-gradient);
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
	color: transparent;
	font-weight: 700;
}

.logo img {
	max-height: 40px;
	width: auto;
}

/* Primary links */
.nav-links {
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: 24px;
	font-size: 0.95rem;
	font-weight: 500;
}

.nav-links li {
	display: flex;
	align-items: center;
}

.nav-links a {
	color: var(--text-nav);
	transition: color 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active,
.nav-links .current-menu-item > a,
.nav-links .current-menu-parent > a {
	color: var(--link-hover);
}

/* Actions cluster */
.nav-actions {
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: 18px;
}

.nav-actions button,
.nav-actions .protoola-icon {
	color: var(--text-nav);
	transition: color 0.2s ease, transform 0.2s ease;
}

.nav-actions button:hover .protoola-icon,
.nav-actions button:hover {
	color: var(--link-hover);
	transform: scale(1.1);
}

.theme-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 6px;
	font-size: 1.15rem;
	line-height: 1;
}

.login-btn {
	padding: 6px 16px;
	border: 1.5px solid var(--protoola-brand);
	border-radius: 40px;
	color: var(--protoola-brand);
	font-weight: 600;
	font-size: 0.9rem;
	background: transparent;
	transition: background 0.2s, color 0.2s;
}

.login-btn:hover {
	background: var(--protoola-brand);
	color: #fff;
}

.hamburger {
	display: none;
	font-size: 1.3rem;
	line-height: 1;
	color: var(--text-nav);
}

/* --------------------------------------------------------------------------
   Mega menu
   -------------------------------------------------------------------------- */
.nav-links li.dropdown {
	position: static;
}

.nav-links li.dropdown .dropdown-toggle {
	display: flex;
	align-items: center;
	gap: 6px;
	color: var(--text-nav);
	font-weight: 500;
	cursor: pointer;
}

.nav-links li.dropdown .dropdown-toggle .protoola-icon {
	font-size: 0.75rem;
	transition: transform 0.25s ease;
}

.nav-links li.dropdown:hover .dropdown-toggle .protoola-icon,
.nav-links li.dropdown.open .dropdown-toggle .protoola-icon {
	transform: rotate(180deg);
}

.mega-menu {
	position: absolute;
	top: calc(100% + 4px);
	right: 0;
	left: 0;
	z-index: 1000;
	display: none;
	width: 100%;
	padding: 20px 18px;
	background: var(--card-solid);
	border: 1px solid var(--card-border);
	border-radius: var(--radius-md);
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.2s ease, visibility 0.2s ease;
}

body.dark .mega-menu {
	background: #0d1527;
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
}

/* Hover bridge so the menu survives the 4px gap */
.mega-menu::before {
	content: '';
	position: absolute;
	top: -16px;
	left: 0;
	width: 100%;
	height: 16px;
}

.mega-column {
	display: flex;
	flex-direction: column;
	gap: 5px;
	min-width: 0;
	overflow: hidden;
}

.mega-category-title {
	display: flex;
	align-items: center;
	gap: 4px;
	margin-bottom: 4px;
	padding-bottom: 6px;
	border-bottom: 2px solid rgba(63, 94, 251, 0.15);
	color: var(--protoola-brand);
	font-size: 0.8rem;
	font-weight: 700;
	letter-spacing: 0.3px;
	text-transform: uppercase;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	transition: color 0.2s;
}

body.dark .mega-category-title {
	color: #818cf8;
	border-bottom-color: rgba(129, 140, 248, 0.25);
}

.mega-category-title:hover {
	color: var(--protoola-brand-2);
}

.mega-link {
	display: flex;
	align-items: center;
	gap: 5px;
	padding: 4px 6px;
	border-radius: 6px;
	color: var(--text-nav);
	font-size: 0.78rem;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	transition: background 0.15s, color 0.15s;
}

.mega-link:hover {
	background: var(--protoola-brand-soft);
	color: var(--protoola-brand);
}

body.dark .mega-link:hover {
	background: rgba(99, 102, 241, 0.25);
	color: #818cf8;
}

@media (min-width: 1200px) {
	.mega-menu {
		grid-template-columns: repeat(7, minmax(0, 1fr));
		gap: 10px;
	}
}

@media (min-width: 992px) and (max-width: 1199px) {
	.mega-menu {
		grid-template-columns: repeat(4, minmax(0, 1fr));
		gap: 14px;
	}
}

@media (min-width: 992px) {
	.nav-links li.dropdown:hover .mega-menu,
	.nav-links li.dropdown.open .mega-menu {
		display: grid;
		opacity: 1;
		visibility: visible;
		pointer-events: auto;
	}
}

/* --------------------------------------------------------------------------
   Header search
   -------------------------------------------------------------------------- */
.nav-search-wrapper {
	position: relative;
	display: flex;
	align-items: center;
}

.nav-search-icon {
	display: inline-flex;
	padding: 6px;
	font-size: 1.15rem;
	line-height: 1;
	color: var(--text-nav);
	transition: color 0.2s, transform 0.2s;
}

.nav-search-icon:hover {
	color: var(--protoola-brand);
	transform: scale(1.1);
}

.nav-search-input-box {
	position: absolute;
	top: 50%;
	right: 0;
	z-index: 1005;
	display: none;
	align-items: center;
	width: 250px;
	padding: 4px 10px;
	background: var(--card-solid);
	border: 1.5px solid rgba(63, 94, 251, 0.6);
	border-radius: 20px;
	box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
	transform: translateY(-50%);
}

body.dark .nav-search-input-box {
	border-color: rgba(129, 140, 248, 0.6);
	box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
}

.nav-search-input-box.active {
	display: flex;
	animation: protoolaPopIn 0.2s ease-out;
}

.nav-search-input-box input {
	width: 100%;
	padding: 4px 8px;
	border: none;
	outline: none;
	background: transparent;
	color: var(--text-primary);
	font-size: 0.88rem;
}

.nav-search-close {
	flex-shrink: 0;
	padding: 4px;
	font-size: 0.85rem;
	line-height: 1;
	color: var(--text-muted);
	transition: color 0.2s;
}

.nav-search-close:hover {
	color: #ef4444;
}

.nav-search-results {
	position: absolute;
	top: calc(100% + 12px);
	right: 0;
	z-index: 1006;
	display: none;
	width: 330px;
	max-height: 380px;
	padding: 6px 0;
	overflow-y: auto;
	background: var(--card-solid);
	border: 1px solid var(--card-border);
	border-radius: var(--radius-sm);
	box-shadow: var(--shadow-pop);
}

body.dark .nav-search-results {
	background: var(--bg-surface-alt);
}

.nav-search-results.active {
	display: block;
	animation: protoolaPopIn 0.2s ease-out;
}

.search-result-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 14px;
	border-bottom: 1px solid var(--card-border);
	color: var(--text-primary);
	transition: background 0.15s ease;
}

.search-result-item:last-child {
	border-bottom: none;
}

.search-result-item:hover,
.search-result-item.selected {
	background: var(--protoola-brand-soft);
}

body.dark .search-result-item:hover,
body.dark .search-result-item.selected {
	background: rgba(99, 102, 241, 0.25);
}

.search-result-icon {
	flex-shrink: 0;
	font-size: 1.2rem;
}

.search-result-details {
	display: flex;
	flex-direction: column;
	gap: 2px;
	overflow: hidden;
}

.search-result-title {
	font-size: 0.88rem;
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.search-result-title mark {
	background: none;
	color: var(--protoola-brand);
	font-weight: 700;
	text-decoration: underline;
}

body.dark .search-result-title mark {
	color: #818cf8;
}

.search-result-meta {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 0.75rem;
	color: var(--text-muted);
}

.search-result-meta > span:last-child {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.search-result-badge {
	flex-shrink: 0;
	padding: 1px 6px;
	border-radius: 4px;
	background: rgba(63, 94, 251, 0.12);
	color: var(--protoola-brand);
	font-size: 0.7rem;
	font-weight: 500;
}

body.dark .search-result-badge {
	background: rgba(99, 102, 241, 0.3);
	color: #a5b4fc;
}

.search-no-results {
	padding: 16px;
	color: var(--text-muted);
	font-size: 0.88rem;
	text-align: center;
}

/* --------------------------------------------------------------------------
   Page header
   -------------------------------------------------------------------------- */
.page-header {
	position: relative;
	padding: 40px 0 30px;
	overflow: hidden;
	background: linear-gradient(135deg, rgba(63, 94, 251, 0.06), rgba(252, 70, 107, 0.04));
	border-bottom: 1px solid var(--card-border);
	text-align: center;
}

.page-header h1 {
	margin-bottom: 10px;
	font-size: clamp(1.9rem, 5vw, 2.6rem);
	font-weight: 700;
}

.page-header p {
	max-width: 680px;
	margin: 0 auto;
	color: var(--text-secondary);
	font-size: 1.1rem;
}

.protoola-breadcrumbs {
	margin-top: 12px;
	font-size: 0.85rem;
	color: var(--text-muted);
}

.protoola-breadcrumbs a:hover {
	color: var(--protoola-brand);
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.site-footer {
	margin-top: 60px;
	padding: 48px 0 24px;
	background: var(--protoola-gradient);
	color: #fff;
}

.footer-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 32px;
	margin-bottom: 32px;
}

.footer-grid h5 {
	margin-bottom: 14px;
	font-size: 1.1rem;
	font-weight: 600;
	color: #fff;
}

.footer-grid ul li {
	margin-bottom: 8px;
	font-size: 0.9rem;
	color: rgba(255, 255, 255, 0.85);
	transition: color 0.2s, transform 0.2s;
}

.footer-grid ul li:hover {
	color: #fff;
	transform: translateX(4px);
}

.footer-logo {
	margin-bottom: 12px;
	font-size: 1.6rem;
	font-weight: 700;
	letter-spacing: -0.5px;
}

.footer-logo a {
	color: #fff;
}

.footer-about {
	margin-bottom: 12px;
	font-size: 0.85rem;
	line-height: 1.5;
	color: rgba(255, 255, 255, 0.85);
}

.footer-bottom {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 16px;
	padding-top: 24px;
	border-top: 1px solid rgba(255, 255, 255, 0.2);
	font-size: 0.9rem;
	color: rgba(255, 255, 255, 0.8);
}

.social-icons {
	display: flex;
	align-items: center;
	gap: 14px;
}

.social-icons a {
	color: #fff;
	font-size: 1.2rem;
	line-height: 1;
	transition: transform 0.3s;
}

.social-icons a:hover {
	transform: scale(1.2) rotate(-5deg);
}

/* --------------------------------------------------------------------------
   Responsive navigation
   -------------------------------------------------------------------------- */
@media (max-width: 991px) {
	.navbar .container {
		flex-wrap: wrap;
		height: auto;
		min-height: var(--nav-height);
		padding-top: 12px;
		padding-bottom: 12px;
	}

	.hamburger {
		display: inline-flex;
	}

	.navbar .nav-links {
		display: none;
		flex-direction: column;
		align-items: flex-start;
		gap: 16px;
		order: 3;
		width: 100%;
		margin-top: 12px;
		padding: 16px 20px;
		background: var(--card-solid);
		border-radius: var(--radius-sm);
		box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
	}

	body.dark .navbar .nav-links {
		box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
	}

	.navbar .nav-links.active {
		display: flex;
	}

	.nav-links li {
		width: 100%;
	}

	.mega-menu {
		position: static;
		display: none;
		width: 100%;
		padding: 10px 0 0 12px;
		background: transparent;
		border: none;
		box-shadow: none;
		opacity: 1;
		visibility: visible;
		pointer-events: auto;
	}

	.nav-links li.dropdown.open .mega-menu {
		display: flex;
		flex-direction: column;
		gap: 12px;
	}
}

@media (max-width: 600px) {
	.nav-search-input-box {
		width: 200px;
	}

	.nav-search-results {
		right: -10px;
		width: calc(100vw - 32px);
		max-height: 320px;
	}
}
