/**
 * MentorKit LMS Pro — Cmd+K command palette (Beta).
 *
 * Tokens follow design.md (admin blue system). Loaded on every admin screen
 * except the block editor, so it must be fully self-contained — it cannot
 * rely on admin-styles.css being present.
 */

.mklms-cmdk {
	--mklms-cmdk-ink: #1a2330;
	--mklms-cmdk-muted: #5b6b7b;
	--mklms-cmdk-grey: #6b7787;
	--mklms-cmdk-hair: #eef0f3;
	--mklms-cmdk-card-border: #e6e8ee;
	--mklms-cmdk-blue: #2f6fb3;
	--mklms-cmdk-blue-d: #255c97;
	--mklms-cmdk-tint: #f4f8fd;
	--mklms-cmdk-ring: #cfe0f2;
	/* Type accents + tile tints (design.md admin blue set + type map). */
	--mklms-cmdk-accent-action: #0a6b2a;
	--mklms-cmdk-tint-action: #e7f5ee;
	--mklms-cmdk-accent-neutral: #5b6b7b;
	--mklms-cmdk-tint-neutral: #eceef1;
	--mklms-cmdk-accent-course: #255c97;
	--mklms-cmdk-tint-course: #e8effb;
	--mklms-cmdk-accent-group: #0f6e78;
	--mklms-cmdk-tint-group: #e4f6f8;
	--mklms-cmdk-accent-user: #c44518;
	--mklms-cmdk-tint-user: #fff0eb;
	--mklms-cmdk-accent-certificate: #8a6512;
	--mklms-cmdk-tint-certificate: #fbf3e2;
	position: fixed;
	inset: 0;
	z-index: 100200; /* above admin bar (99999) and most modals */
}

.mklms-cmdk[hidden] {
	display: none;
}

.mklms-cmdk__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(16, 24, 40, 0.4);
}

.mklms-cmdk__panel {
	position: relative;
	margin: 13vh auto 0;
	width: min(640px, calc(100vw - 32px));
	background: #fff;
	border: 1px solid var(--mklms-cmdk-card-border);
	border-radius: 16px;
	box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 24px 60px rgba(16, 24, 40, 0.22);
	overflow: hidden;
	font-size: 15px;
	color: var(--mklms-cmdk-ink);
}

.mklms-cmdk__input-wrap {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 6px 18px;
	border-bottom: 1px solid var(--mklms-cmdk-hair);
}

.mklms-cmdk__icon {
	width: 20px;
	height: 20px;
	flex: 0 0 auto;
	color: var(--mklms-cmdk-blue);
}

.mklms-cmdk .mklms-cmdk__input,
.mklms-cmdk .mklms-cmdk__input:focus {
	flex: 1 1 auto;
	min-height: 48px;
	border: 0;
	outline: 0;
	box-shadow: none;
	background: transparent;
	font-size: 16px;
	color: var(--mklms-cmdk-ink);
	padding: 0;
}

.mklms-cmdk .mklms-cmdk__input::placeholder {
	color: var(--mklms-cmdk-grey);
}

.mklms-cmdk__scope-chip {
	flex: 0 0 auto;
	font-size: 11px;
	padding: 3px 7px;
	border-radius: 5px;
	border: 1px solid var(--mklms-cmdk-card-border);
	background: #f7f8fa;
	color: var(--mklms-cmdk-muted);
	white-space: nowrap;
}

.mklms-cmdk__results {
	max-height: min(52vh, 440px);
	overflow-y: auto;
	padding: 8px;
}

.mklms-cmdk__group-header {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 11px 10px 5px;
}

.mklms-cmdk__group-dot {
	flex: 0 0 auto;
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--mklms-cmdk-accent-neutral);
}

.mklms-cmdk__group-dot--action {
	background: var(--mklms-cmdk-accent-action);
}

.mklms-cmdk__group-dot--course {
	background: var(--mklms-cmdk-accent-course);
}

.mklms-cmdk__group-dot--group {
	background: var(--mklms-cmdk-accent-group);
}

.mklms-cmdk__group-dot--user {
	background: var(--mklms-cmdk-accent-user);
}

.mklms-cmdk__group-dot--certificate {
	background: var(--mklms-cmdk-accent-certificate);
}

.mklms-cmdk__group-label {
	flex: 1 1 auto;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--mklms-cmdk-grey);
}

.mklms-cmdk__group-count {
	flex: 0 0 auto;
	font-size: 11px;
	color: var(--mklms-cmdk-grey);
}

.mklms-cmdk__item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 9px 10px;
	border-radius: 9px;
	text-decoration: none;
	color: var(--mklms-cmdk-ink);
	cursor: pointer;
}

.mklms-cmdk__item:focus {
	box-shadow: none;
	outline: none;
}

.mklms-cmdk__item.is-selected {
	background: var(--mklms-cmdk-tint);
	color: var(--mklms-cmdk-blue-d);
	box-shadow: inset 0 0 0 1px var(--mklms-cmdk-ring);
}

.mklms-cmdk__item-tile {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 32px;
	height: 32px;
	border-radius: 8px;
	background: var(--mklms-cmdk-tint-neutral);
	color: var(--mklms-cmdk-accent-neutral);
}

.mklms-cmdk__item-tile .dashicons {
	font-size: 17px;
	width: 17px;
	height: 17px;
}

.mklms-cmdk__item-tile--action {
	background: var(--mklms-cmdk-tint-action);
	color: var(--mklms-cmdk-accent-action);
}

.mklms-cmdk__item-tile--course {
	background: var(--mklms-cmdk-tint-course);
	color: var(--mklms-cmdk-accent-course);
}

.mklms-cmdk__item-tile--group {
	background: var(--mklms-cmdk-tint-group);
	color: var(--mklms-cmdk-accent-group);
}

.mklms-cmdk__item-tile--user {
	background: var(--mklms-cmdk-tint-user);
	color: var(--mklms-cmdk-accent-user);
}

.mklms-cmdk__item-tile--certificate {
	background: var(--mklms-cmdk-tint-certificate);
	color: var(--mklms-cmdk-accent-certificate);
}

.mklms-cmdk__item-body {
	display: flex;
	flex-direction: column;
	gap: 1px;
	flex: 1 1 auto;
	min-width: 0;
}

.mklms-cmdk__item-title {
	font-size: 14.5px;
	font-weight: 600;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.mklms-cmdk__item-secondary {
	font-size: 12.5px;
	font-weight: 400;
	color: var(--mklms-cmdk-muted);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.mklms-cmdk__item.is-selected .mklms-cmdk__item-secondary {
	color: var(--mklms-cmdk-muted);
}

/* Settings breadcrumbs include the complete nested location. */
.mklms-cmdk__item--settings .mklms-cmdk__item-title,
.mklms-cmdk__item--settings .mklms-cmdk__item-secondary {
	white-space: normal;
	overflow-wrap: anywhere;
}

.mklms-cmdk__item-action {
	display: none;
	flex: 0 0 auto;
	align-items: center;
	gap: 4px;
	font-size: 12px;
	font-weight: 600;
	color: var(--mklms-cmdk-blue-d);
	white-space: nowrap;
}

.mklms-cmdk__item.is-selected .mklms-cmdk__item-action {
	display: inline-flex;
}

.mklms-cmdk__item-action kbd {
	display: inline-block;
	padding: 2px 5px;
	border: 1px solid var(--mklms-cmdk-ring);
	border-bottom-width: 2px;
	border-radius: 5px;
	background: #fff;
	font-size: 11px;
	font-family: inherit;
	line-height: 1.2;
	color: var(--mklms-cmdk-blue-d);
}

.mklms-cmdk__empty {
	padding: 30px 12px;
	text-align: center;
}

.mklms-cmdk__empty-title {
	margin: 0 0 4px;
	font-size: 14.5px;
	font-weight: 600;
	color: var(--mklms-cmdk-ink);
}

.mklms-cmdk__empty-help {
	margin: 0;
	font-size: 13px;
	color: var(--mklms-cmdk-muted);
}

.mklms-cmdk__status {
	padding: 18px 12px;
	color: var(--mklms-cmdk-muted);
	text-align: center;
}

.mklms-cmdk__visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.mklms-cmdk__footer {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 10px 18px;
	border-top: 1px solid var(--mklms-cmdk-hair);
	background: var(--mklms-cmdk-tint);
	color: var(--mklms-cmdk-grey);
	font-size: 12px;
}

.mklms-cmdk__hint kbd {
	display: inline-block;
	min-width: 18px;
	padding: 2px 5px;
	border: 1px solid var(--mklms-cmdk-card-border);
	border-bottom-width: 2px;
	border-radius: 5px;
	background: #fff;
	font-size: 11px;
	font-family: inherit;
	line-height: 1.2;
	text-align: center;
	color: var(--mklms-cmdk-muted);
}

.mklms-cmdk__footer-count {
	margin-left: auto;
}

.mklms-cmdk__footer .scorm-beta-badge {
	margin-left: auto;
}

.mklms-cmdk__footer-count + .scorm-beta-badge {
	margin-left: 8px;
}

/* Keep the page behind the overlay from scrolling while the palette is open. */
body.mklms-cmdk-open {
	overflow: hidden;
}

/* ------------------------------------------------------------------ *
 * Sidebar trigger (desktop entry point, first item in #adminmenu)
 * ------------------------------------------------------------------ */

#adminmenu .mklms-cmdk-menu-item {
	list-style: none;
}

.mklms-cmdk-trigger {
	display: flex;
	align-items: center;
	gap: 6px;
	width: calc(100% - 16px);
	margin: 2px 8px 12px;
	padding: 7px 8px;
	border: 1px solid rgba(240, 246, 252, 0.22);
	border-radius: 6px;
	background: rgba(240, 246, 252, 0.07);
	color: #c3c4c7;
	font-size: 12.5px;
	line-height: 1.2;
	cursor: pointer;
	transition: all 0.2s ease;
}

.mklms-cmdk-trigger:hover {
	border-color: rgba(114, 174, 230, 0.75);
	background: rgba(240, 246, 252, 0.12);
	color: #f0f6fc;
}

.mklms-cmdk-trigger:focus-visible {
	outline: 2px solid #72aee6;
	outline-offset: 1px;
}

.mklms-cmdk-trigger .dashicons {
	flex: 0 0 auto;
	width: 15px;
	height: 15px;
	font-size: 15px;
}

.mklms-cmdk-trigger__label {
	flex: 1 1 auto;
	overflow: hidden;
	text-align: left;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.mklms-cmdk-trigger__kbd {
	flex: 0 0 auto;
	padding: 2px 3px;
	border: 1px solid rgba(240, 246, 252, 0.28);
	border-radius: 3px;
	color: rgba(240, 246, 252, 0.75);
	font-size: 10px;
	white-space: nowrap;
}

/* Folded sidebar (36px): icon only, centred in a 32x32 box. */
body.folded .mklms-cmdk-trigger {
	width: 32px;
	height: 32px;
	margin: 2px auto 12px;
	padding: 0;
	justify-content: center;
	gap: 0;
}

body.folded .mklms-cmdk-trigger__label,
body.folded .mklms-cmdk-trigger__kbd {
	display: none;
}

[dir='rtl'] .mklms-cmdk-trigger__label {
	text-align: right;
}

/* Mobile: the WP menu is off-canvas, keep the admin-bar entry point instead. */
@media screen and (max-width: 782px) {
	.mklms-cmdk-trigger {
		display: none;
	}
}

/* ------------------------------------------------------------------ *
 * Admin bar button (mobile entry point, ≤782px only)
 * ------------------------------------------------------------------ */

#wpadminbar #wp-admin-bar-mklms-command-palette .ab-item {
	display: flex;
	align-items: center;
}

#wpadminbar .mklms-cmdk-ab {
	display: inline-flex;
	align-items: center;
	gap: 7px;
}

#wpadminbar .mklms-cmdk-ab-icon::before {
	content: '\f179'; /* dashicons-search */
	font-family: dashicons;
	font-size: 16px;
	line-height: 1;
	display: inline-block;
	vertical-align: middle;
}

#wpadminbar .mklms-cmdk-ab-kbd {
	font-size: 10px;
	line-height: 1;
	padding: 3px 6px;
	border-radius: 4px;
	border: 1px solid rgba(240, 246, 252, 0.35);
	color: rgba(240, 246, 252, 0.75);
}

#wpadminbar #wp-admin-bar-mklms-command-palette .ab-item:hover .mklms-cmdk-ab-kbd,
#wpadminbar #wp-admin-bar-mklms-command-palette .ab-item:focus .mklms-cmdk-ab-kbd {
	color: #72aee6;
	border-color: rgba(114, 174, 230, 0.6);
}

/* Above the mobile breakpoint the sidebar trigger is the single entry
   point — the admin-bar node stays registered server-side (needed ≤782px
   where the WP menu goes off-canvas) but is hidden here. */
@media screen and (min-width: 783px) {
	#wpadminbar #wp-admin-bar-mklms-command-palette {
		display: none;
	}
}

@media screen and (max-width: 782px) {
	/* Core's responsive admin bar hides every node it doesn't whitelist —
	   force ours back on, or mobile has no visible trigger at all. */
	#wpadminbar #wp-admin-bar-mklms-command-palette {
		display: block !important;
	}

	/* Mobile admin bar: icon-only, matching core's compact items. */
	#wpadminbar .mklms-cmdk-ab-label,
	#wpadminbar .mklms-cmdk-ab-kbd {
		display: none;
	}

	#wpadminbar .mklms-cmdk-ab-icon::before {
		font-size: 22px;
	}

	#wpadminbar #wp-admin-bar-mklms-command-palette .ab-item {
		height: 46px;
		padding: 0 12px;
	}
}

/* Beta badge is hidden site-wide (see admin-styles.css, 2026-05-15). The
   palette loads on screens that don't load admin-styles.css, so re-state the
   hide-rule here to avoid the unstyled badge flashing back on. */
.mklms-cmdk .scorm-beta-badge,
.mklms-cmdk .scorm-beta-tooltip {
	display: none !important;
}

/* The disclosure is a dialog child, visually aligned with the selected option. */
.mklms-cmdk__destinations {
	position: absolute;
	right: 24px;
	z-index: 2;
}
.mklms-cmdk__destinations[hidden],
.mklms-cmdk__destinations [hidden] {
	display: none;
}
.mklms-cmdk__item.has-destinations.is-selected {
	padding-right: 130px;
}
.mklms-cmdk__item.has-destinations.is-selected .mklms-cmdk__item-action {
	display: none;
}
.mklms-cmdk__destinations button,
.mklms-cmdk__destinations a {
	display: block;
	padding: 5px 10px;
	border: 1px solid #c9ccd2;
	border-radius: 7px;
	background: #fff;
	color: #2f6fb3;
	font: inherit;
	font-size: 12px;
	text-decoration: none;
	cursor: pointer;
}
#mklms-cmdk-destination-links {
	position: absolute;
	top: 100%;
	right: 0;
	min-width: 140px;
	padding: 5px;
	border: 1px solid #c9ccd2;
	border-radius: 7px;
	background: #fff;
	box-shadow: 0 4px 12px rgba(16, 24, 40, 0.15);
}
.mklms-cmdk__destinations.opens-up #mklms-cmdk-destination-links {
	top: auto;
	bottom: 100%;
}
.mklms-cmdk__destinations a {
	border: 0;
}
.mklms-cmdk__destinations a:hover {
	background: #f4f8fd;
}
.mklms-cmdk__destinations :focus-visible {
	outline: 2px solid #2f6fb3;
	outline-offset: 2px;
}

.mklms-cmdk__panel.has-open-destinations {
	overflow: visible;
}
