/* ---------------------------------------------------------------
 * Workspace sidebar -- collapse toggle (desktop AND tablet, i.e.
 * anything above 600px) and, below that, the off-canvas drawer + its
 * floating open button. 600px is deliberately the theme's dedicated
 * small-phone breakpoint (THEME-DESIGN-CONTRACT.md §6) rather than
 * its general 782px mobile breakpoint: the drawer is phone-only by
 * design -- a tablet keeps the same collapsible sidebar desktop
 * uses, just possibly pre-collapsed by the learner. The drawer/overlay/button are printed at
 * wp_footer as body-level siblings (render_mobile_drawer() in
 * class-vln-public.php) -- see MOBILE-DRAWER-PATTERN-PROMPT.md,
 * whose exact z-index values (300/301) and mechanics (position:
 * fixed; inset/top+bottom, never a height tied to header; a
 * transform-based .is-open toggle, never display) this file follows.
 * Behavior: public/js/vln-pro-lms-sidebar.js.
 * --------------------------------------------------------------- */

/* ===================================================================
 * DESKTOP: collapse toggle on the inline <aside>
 * =================================================================== */
.vln-pro-lms-workspace-sidebar {
	position: relative;
	transition: width 0.22s ease;
}

.vln-pro-lms-sidebar-collapse-btn {
	position: absolute;
	top: 14px;
	right: -13px;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	padding: 0;
	border-radius: 50%;
	border: 1px solid var(--vln-border);
	background: var(--vln-surface);
	color: var(--vln-text-muted);
	box-shadow: var(--vln-shadow);
	cursor: pointer;
	transition: transform 0.22s ease, color 0.15s ease, border-color 0.15s ease;
}

.vln-pro-lms-sidebar-collapse-btn:hover {
	color: var(--vln-accent-text);
	border-color: color-mix(in srgb, var(--vln-accent) 45%, transparent);
}

.vln-pro-lms-sidebar-collapse-btn .dashicons {
	font-size: 14px;
	width: 14px;
	height: 14px;
}

.vln-pro-lms-workspace-sidebar.is-collapsed {
	width: 68px;
}

.vln-pro-lms-workspace-sidebar.is-collapsed .vln-pro-lms-sidebar-collapse-btn .dashicons {
	transform: rotate(180deg);
}

.vln-pro-lms-workspace-sidebar.is-collapsed .vln-pro-lms-workspace-course-name-text,
.vln-pro-lms-workspace-sidebar.is-collapsed .vln-pro-lms-workspace-nav-label {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
}

.vln-pro-lms-workspace-sidebar.is-collapsed .vln-pro-lms-workspace-course-name {
	justify-content: center;
	padding: 0 0 16px;
}

.vln-pro-lms-workspace-sidebar.is-collapsed .vln-pro-lms-workspace-nav-item {
	justify-content: center;
	padding: 11px 0;
	gap: 0;
}

/* On desktop the sidebar always renders and JS unhides itself instantly
   on DOMContentLoaded, so there's no flash-of-wrong-state to guard
   against here (unlike the theme's own blocking dark/light script,
   which must run before first paint because the WHOLE page's colors
   depend on it) -- this only affects one component's own width. */

/* ===================================================================
 * PHONE ONLY (<= 600px): drawer, overlay, and floating open button.
 * Hidden by default; only shown inside the breakpoint below, so
 * nothing renders or intercepts clicks on desktop or tablet even
 * though the markup is always in the DOM.
 * =================================================================== */
.vln-pro-lms-drawer-overlay,
.vln-pro-lms-drawer,
.vln-pro-lms-drawer-fab {
	display: none;
}

@media (max-width: 600px) {
	.vln-pro-lms-drawer-overlay {
		display: block;
		position: fixed;
		inset: 0;
		z-index: 300;
		background: rgba(0, 0, 0, 0.55);
		opacity: 0;
		pointer-events: none;
		transition: opacity 0.2s ease;
	}

	.vln-pro-lms-drawer-overlay.is-open {
		opacity: 1;
		pointer-events: auto;
	}

	.vln-pro-lms-drawer {
		display: block;
		position: fixed;
		top: 0;
		left: 0;
		bottom: 0;
		width: 80%;
		max-width: 300px;
		z-index: 301;
		overflow-y: auto;
		background: var(--vln-surface);
		border-right: 1px solid var(--vln-border);
		box-shadow: var(--vln-shadow);
		padding: 20px 0;
		transform: translateX(-105%);
		transition: transform 0.28s ease;
	}

	.vln-pro-lms-drawer.is-open {
		transform: translateX(0);
	}

	.vln-pro-lms-drawer-close {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 30px;
		height: 30px;
		margin: 0 0 8px 16px;
		padding: 0;
		border-radius: 50%;
		border: 1px solid var(--vln-border);
		background: transparent;
		color: var(--vln-text-muted);
		cursor: pointer;
	}

	.vln-pro-lms-drawer .vln-pro-lms-workspace-course-name {
		padding: 0 20px 16px;
	}

	.vln-pro-lms-drawer-fab {
		display: flex;
		align-items: center;
		justify-content: center;
		position: fixed;
		z-index: 250;
		width: 52px;
		height: 52px;
		padding: 0;
		border-radius: 50%;
		border: none;
		background: var(--vln-accent);
		color: var(--vln-on-accent);
		box-shadow: var(--vln-shadow);
		cursor: pointer;
	}

	.vln-pro-lms-drawer-fab .dashicons {
		font-size: 22px;
		width: 22px;
		height: 22px;
	}

	body.has-drawer-open {
		overflow: hidden;
	}
}

@media (prefers-reduced-motion: reduce) {
	.vln-pro-lms-workspace-sidebar,
	.vln-pro-lms-sidebar-collapse-btn .dashicons,
	.vln-pro-lms-drawer-overlay,
	.vln-pro-lms-drawer {
		transition: none;
	}
}
