/**
 * KB Navigation Styles
 * 
 * Hierarchical sidebar navigation, breadcrumbs, and article navigation.
 * 
 * @package Devora_KB_Hub
 * @since 1.0.0
 */

/* ===========================
   Layout Wrapper with Sidebar
   =========================== */

.devora-kb-single-article-wrapper {
	max-width: 1400px;
	margin: 0 auto;
	padding: 20px;
}

.devora-kb-with-sidebar {
	display: grid;
	grid-template-columns: 300px 1fr;
	gap: 40px;
	align-items: start;
}

.devora-kb-main-content {
	min-width: 0; /* Prevent grid blowout */
}

/* ===========================
   Breadcrumbs
   =========================== */

.kb-breadcrumbs {
	margin: 20px 0;
	padding: 12px 0;
	font-size: 14px;
}

.kb-breadcrumbs__list {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	list-style: none;
	margin: 0;
	padding: 0;
}

.kb-breadcrumbs__item {
	display: flex;
	align-items: center;
	gap: 8px;
}

.kb-breadcrumbs__item a {
	color: #0073aa;
	text-decoration: none;
	transition: color 0.2s ease;
}

.kb-breadcrumbs__item a:hover {
	color: #005a87;
	text-decoration: underline;
}

.kb-breadcrumbs__item--current {
	color: #646970;
	font-weight: 600;
}

.kb-breadcrumbs__separator {
	color: #999;
	user-select: none;
}

/* ===========================
   Sidebar Navigation
   =========================== */

.kb-sidebar-nav {
	background: white;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	padding: 20px;
	position: sticky;
	top: 20px;
	max-height: calc(100vh - 40px);
	overflow-y: auto;
}

.kb-sidebar-nav__inner {
	min-width: 250px;
}

/* Navigation Levels */
.kb-nav-level {
	list-style: none;
	margin: 0;
	padding: 0;
}

.kb-nav-level--0 {
	/* Top level sections */
}

.kb-nav-level--1 {
	/* Subsections */
	padding-left: 20px;
}

.kb-nav-level--2 {
	/* Third level */
	padding-left: 20px;
}

/* Navigation Items */
.kb-nav-item {
	margin: 4px 0;
}

.kb-nav-category {
	display: flex;
	align-items: center;
	gap: 8px;
}

.kb-nav-toggle {
	flex-shrink: 0;
	width: 24px;
	height: 24px;
	padding: 0;
	background: none;
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 4px;
	transition: all 0.2s ease;
}

.kb-nav-toggle:hover {
	background: #f0f0f0;
}

.kb-nav-toggle:focus {
	outline: 2px solid #0073aa;
	outline-offset: 2px;
}

.kb-nav-toggle-icon {
	font-size: 18px;
	font-weight: bold;
	color: #646970;
	transition: transform 0.3s ease;
}

.kb-nav-toggle[aria-expanded="true"] .kb-nav-toggle-icon {
	transform: rotate(90deg);
}

.kb-nav-category-link {
	flex: 1;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 12px;
	border-radius: 6px;
	color: #1a1a1a;
	text-decoration: none;
	transition: all 0.2s ease;
}

.kb-nav-category-link:hover {
	background: #f8f9fa;
	color: #0073aa;
}

.kb-nav-item--active > .kb-nav-category > .kb-nav-category-link {
	background: #e7f5ff;
	color: #0073aa;
	font-weight: 600;
}

/* Navigation Icons */
.kb-nav-icon {
	flex-shrink: 0;
	font-size: 20px;
}

.kb-nav-icon--emoji {
	font-size: 20px;
}

.kb-nav-icon--svg {
	width: 20px;
	height: 20px;
	object-fit: contain;
}

.kb-nav-icon--class {
	font-size: 18px;
	color: #0073aa;
}

/* Category Name and Count */
.kb-nav-category-name {
	flex: 1;
	font-size: 15px;
	font-weight: 500;
}

.kb-nav-count {
	flex-shrink: 0;
	padding: 2px 8px;
	background: #f0f0f0;
	color: #646970;
	font-size: 12px;
	font-weight: 600;
	border-radius: 10px;
}

/* Articles List */
.kb-nav-articles {
	list-style: none;
	margin: 8px 0 8px 32px;
	padding: 0;
}

.kb-nav-article {
	margin: 2px 0;
}

.kb-nav-article a {
	display: block;
	padding: 6px 12px;
	color: #646970;
	text-decoration: none;
	font-size: 14px;
	border-radius: 4px;
	transition: all 0.2s ease;
}

.kb-nav-article a:hover {
	background: #f8f9fa;
	color: #0073aa;
	padding-left: 16px;
}

.kb-nav-article--current a {
	background: #0073aa;
	color: white;
	font-weight: 600;
}

.kb-nav-article--current a:hover {
	background: #005a87;
}

/* Children Container */
.kb-nav-children {
	overflow: hidden;
	transition: max-height 0.3s ease-out;
}

/* ===========================
   Article Navigation (Prev/Next)
   =========================== */

.kb-article-navigation {
	margin: 40px 0;
	padding: 30px 0;
	border-top: 2px solid #f0f0f0;
}

.kb-article-navigation__inner {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 20px;
}

.kb-article-nav-link {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 20px;
	background: white;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	text-decoration: none;
	transition: all 0.3s ease;
}

.kb-article-nav-link:hover {
	border-color: #0073aa;
	box-shadow: 0 4px 12px rgba(0, 115, 170, 0.1);
	transform: translateY(-2px);
}

.kb-article-nav-link--prev {
	text-align: left;
}

.kb-article-nav-link--next {
	text-align: right;
}

.kb-article-nav-link--prev::before {
	content: '←';
	font-size: 24px;
	color: #0073aa;
	margin-bottom: 8px;
}

.kb-article-nav-link--next::after {
	content: '→';
	font-size: 24px;
	color: #0073aa;
	margin-bottom: 8px;
}

.kb-article-nav-label {
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: #999;
}

.kb-article-nav-title {
	font-size: 16px;
	font-weight: 600;
	color: #1a1a1a;
}

.kb-article-nav-link:hover .kb-article-nav-title {
	color: #0073aa;
}

/* ===========================
   Responsive Design
   =========================== */

@media (max-width: 992px) {
	.devora-kb-with-sidebar {
		grid-template-columns: 1fr;
	}

	.kb-sidebar-nav {
		position: static;
		margin-bottom: 30px;
		max-height: 400px;
	}

	.kb-nav-level--1,
	.kb-nav-level--2 {
		padding-left: 16px;
	}
}

@media (max-width: 768px) {
	.kb-article-navigation__inner {
		grid-template-columns: 1fr;
		gap: 12px;
	}

	.kb-article-nav-link--next {
		text-align: left;
	}

	.kb-article-nav-link--next::after {
		content: '→';
	}

	.kb-breadcrumbs__list {
		font-size: 13px;
	}

	.kb-sidebar-nav {
		max-height: none;
		overflow-y: visible;
	}
}

@media (max-width: 480px) {
	.kb-breadcrumbs__item {
		font-size: 12px;
	}

	.kb-breadcrumbs__separator {
		font-size: 10px;
	}

	.kb-nav-category-name {
		font-size: 14px;
	}
}

/* ===========================
   Accessibility
   =========================== */

.kb-nav-toggle:focus-visible {
	outline: 2px solid #0073aa;
	outline-offset: 2px;
}

.kb-nav-category-link:focus-visible {
	outline: 2px solid #0073aa;
	outline-offset: -2px;
}

.kb-nav-article a:focus-visible {
	outline: 2px solid #0073aa;
	outline-offset: -2px;
}

/* ===========================
   Print Styles
   =========================== */

@media print {
	.kb-sidebar-nav {
		display: none;
	}

	.kb-article-navigation {
		display: none;
	}

	.kb-breadcrumbs {
		border-bottom: 1px solid #ddd;
		padding-bottom: 10px;
	}
}

/* ===========================
   Dark Mode Support
   =========================== */

@media (prefers-color-scheme: dark) {
	.kb-sidebar-nav {
		background: #2a2a2a;
		border-color: #444;
	}

	.kb-nav-category-link {
		color: #e0e0e0;
	}

	.kb-nav-category-link:hover {
		background: #3a3a3a;
		color: #4a9eff;
	}

	.kb-nav-item--active > .kb-nav-category > .kb-nav-category-link {
		background: #1a3a52;
		color: #4a9eff;
	}

	.kb-nav-article a {
		color: #c0c0c0;
	}

	.kb-nav-article a:hover {
		background: #3a3a3a;
		color: #4a9eff;
	}

	.kb-nav-article--current a {
		background: #0073aa;
		color: white;
	}

	.kb-article-nav-link {
		background: #2a2a2a;
		border-color: #444;
		color: #e0e0e0;
	}

	.kb-article-nav-title {
		color: #e0e0e0;
	}
}

