/* ==========================================================================
   MTC Design Library - Shell Layout
   Fixed sidebar + sticky header + scrollable main content area.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Layout Containers
   -------------------------------------------------------------------------- */
.dl-shell {
	display: flex;
	min-height: 100vh;
}

/* --------------------------------------------------------------------------
   Sidebar
   -------------------------------------------------------------------------- */
.dl-sidebar {
	position: fixed;
	top: 0;
	left: 0;
	bottom: 0;
	width: 16rem;
	display: flex;
	flex-direction: column;
	background-color: var(--sidebar);
	border-right: 1px solid var(--sidebar-border);
	color: var(--sidebar-foreground);
	z-index: 100;
	transition:
		width 0.2s ease,
		transform 0.2s ease;
	overflow: hidden;
}

.dl-sidebar.collapsed {
	width: 3rem;
}

/* Sidebar logo area */
.dl-sidebar-logo {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0 0.75rem;
	height: 3.5rem;
	flex-shrink: 0;
	border-bottom: 1px solid var(--sidebar-border);
	text-decoration: none;
	color: inherit;
}

.dl-sidebar-logo svg {
	width: 1.75rem;
	height: auto;
	flex-shrink: 0;
}

.dl-sidebar-logo-text {
	font-family: var(--font-syne);
	font-weight: 700;
	font-size: 0.875rem;
	letter-spacing: -0.01em;
	white-space: nowrap;
	opacity: 1;
	transition: opacity 0.15s ease;
}

.collapsed .dl-sidebar-logo-text {
	opacity: 0;
	pointer-events: none;
}

/* Sidebar navigation scroll area */
.dl-sidebar-nav {
	flex: 1;
	overflow-y: auto;
	overflow-x: hidden;
	padding: 0.5rem;
	scrollbar-width: thin;
	scrollbar-color: var(--muted) transparent;
}

.dl-sidebar-nav::-webkit-scrollbar {
	width: 4px;
}

.dl-sidebar-nav::-webkit-scrollbar-thumb {
	background-color: var(--muted);
	border-radius: 9999px;
}

.dl-sidebar-nav::-webkit-scrollbar-track {
	background: transparent;
}

/* Section groups */
.dl-nav-section {
	margin-bottom: 0.25rem;
}

.dl-nav-section-title {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.375rem 0.5rem;
	font-size: 0.6875rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--muted-foreground);
	cursor: pointer;
	user-select: none;
	border-radius: var(--radius-md);
	transition: background-color 0.15s ease;
	white-space: nowrap;
}

.dl-nav-section-title:hover {
	background-color: var(--sidebar-accent);
}

.dl-nav-section-title .chevron {
	width: 0.75rem;
	height: 0.75rem;
	flex-shrink: 0;
	transition: transform 0.2s ease;
}

.dl-nav-section.is-collapsed .chevron {
	transform: rotate(-90deg);
}

.dl-nav-section-title .section-label {
	opacity: 1;
	transition: opacity 0.15s ease;
}

.collapsed .dl-nav-section-title .section-label {
	opacity: 0;
	pointer-events: none;
}

/* Section items list */
.dl-nav-items {
	list-style: none;
	margin: 0;
	padding: 0 0 0.25rem 0;
	overflow: hidden;
	transition: max-height 0.25s ease;
	max-height: 60rem; /* large enough for any section */
}

.dl-nav-section.is-collapsed .dl-nav-items {
	max-height: 0;
	padding-bottom: 0;
}

.collapsed .dl-nav-items {
	max-height: 0;
	padding-bottom: 0;
}

/* Nav item links */
.dl-nav-item a {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.375rem 0.5rem 0.375rem 1.25rem;
	font-size: 0.8125rem;
	color: var(--sidebar-foreground);
	text-decoration: none;
	border-radius: var(--radius-md);
	transition:
		background-color 0.15s ease,
		color 0.15s ease;
	white-space: nowrap;
}

.dl-nav-item a:hover {
	background-color: var(--sidebar-accent);
	color: var(--sidebar-accent-foreground);
}

.dl-nav-item a.active {
	background-color: var(--sidebar-primary);
	color: var(--sidebar-primary-foreground);
	font-weight: 500;
}

/* Status dots */
.dl-status-dot {
	width: 0.4375rem;
	height: 0.4375rem;
	border-radius: 9999px;
	flex-shrink: 0;
}

.dl-status-dot.done {
	background-color: oklch(0.65 0.2 145); /* green */
}

.dl-status-dot.in-progress {
	background-color: oklch(0.75 0.18 85); /* amber */
}

.dl-status-dot.planned {
	background-color: var(--muted-foreground);
	opacity: 0.4;
}

.dl-nav-item-label {
	flex: 1;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Collapse toggle button */
.dl-sidebar-footer {
	flex-shrink: 0;
	padding: 0.5rem;
	border-top: 1px solid var(--sidebar-border);
}

.dl-collapse-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 2rem;
	background: none;
	border: none;
	border-radius: var(--radius-md);
	color: var(--muted-foreground);
	cursor: pointer;
	transition:
		background-color 0.15s ease,
		color 0.15s ease;
}

.dl-collapse-btn:hover {
	background-color: var(--sidebar-accent);
	color: var(--sidebar-accent-foreground);
}

.dl-collapse-btn svg {
	width: 1rem;
	height: 1rem;
	transition: transform 0.2s ease;
}

.collapsed .dl-collapse-btn svg {
	transform: rotate(180deg);
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.dl-header {
	position: sticky;
	top: 0;
	height: 3.5rem;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 1.5rem;
	background-color: var(--background);
	border-bottom: 1px solid var(--border);
	z-index: 50;
}

/* Main wrapper — takes remaining space after sidebar */
.dl-main-wrapper {
	flex: 1;
	margin-left: 16rem;
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	transition: margin-left 0.2s ease;
}

.dl-sidebar.collapsed ~ .dl-main-wrapper {
	margin-left: 3rem;
}

/* Breadcrumbs */
.dl-breadcrumbs {
	display: flex;
	align-items: center;
	gap: 0.375rem;
	font-size: 0.8125rem;
	color: var(--muted-foreground);
	min-width: 0;
}

.dl-breadcrumbs a {
	color: var(--muted-foreground);
	text-decoration: none;
	transition: color 0.15s ease;
}

.dl-breadcrumbs a:hover {
	color: var(--foreground);
}

.dl-breadcrumbs .separator {
	color: var(--muted-foreground);
	opacity: 0.5;
	font-size: 0.75rem;
}

.dl-breadcrumbs .current {
	color: var(--foreground);
	font-weight: 500;
}

/* Header controls */
.dl-header-controls {
	display: flex;
	align-items: center;
	gap: 0.25rem;
}

/* Theme toggle group */
.dl-theme-toggle {
	display: flex;
	align-items: center;
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	overflow: hidden;
}

.dl-theme-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 1.75rem;
	background: none;
	border: none;
	color: var(--muted-foreground);
	cursor: pointer;
	transition:
		background-color 0.15s ease,
		color 0.15s ease;
}

.dl-theme-btn:hover {
	color: var(--foreground);
}

.dl-theme-btn.active {
	background-color: var(--accent);
	color: var(--accent-foreground);
}

.dl-theme-btn svg {
	width: 0.875rem;
	height: 0.875rem;
}

/* Mobile hamburger */
.dl-hamburger {
	display: none;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	background: none;
	border: none;
	color: var(--foreground);
	cursor: pointer;
	margin-right: 0.75rem;
	border-radius: var(--radius-md);
}

.dl-hamburger:hover {
	background-color: var(--accent);
}

.dl-hamburger svg {
	width: 1.25rem;
	height: 1.25rem;
}

/* --------------------------------------------------------------------------
   Main Content
   -------------------------------------------------------------------------- */
.dl-content {
	flex: 1;
	padding: 2rem 2rem 4rem;
	max-width: 100%;
	overflow-x: hidden;
}

/* --------------------------------------------------------------------------
   Mobile Overlay
   -------------------------------------------------------------------------- */
.dl-sidebar-overlay {
	display: none;
	position: fixed;
	inset: 0;
	background-color: oklch(0 0 0 / 50%);
	z-index: 90;
	opacity: 0;
	transition: opacity 0.2s ease;
}

.dl-sidebar-overlay.visible {
	display: block;
	opacity: 1;
}

/* --------------------------------------------------------------------------
   Responsive: Mobile < 768px
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
	.dl-sidebar {
		transform: translateX(-100%);
		width: 16rem !important;
		z-index: 110;
	}

	.dl-sidebar.mobile-open {
		transform: translateX(0);
	}

	/* Never apply collapsed width on mobile */
	.dl-sidebar.collapsed {
		width: 16rem !important;
		transform: translateX(-100%);
	}

	.dl-sidebar.collapsed.mobile-open {
		transform: translateX(0);
	}

	.dl-main-wrapper {
		margin-left: 0 !important;
	}

	.dl-hamburger {
		display: flex;
	}

	.dl-content {
		padding: 1.25rem 1rem 3rem;
	}

	.dl-sidebar-overlay.visible {
		display: block;
	}

	/* Restore collapsed items on mobile */
	.collapsed .dl-nav-items {
		max-height: 60rem;
		padding-bottom: 0.25rem;
	}

	.collapsed .dl-nav-section-title .section-label,
	.collapsed .dl-sidebar-logo-text {
		opacity: 1;
		pointer-events: auto;
	}
}
