/**
 * Antimanual admin sidebar — collapsible parent/child categories.
 *
 * Styles the category headers injected by assets/js/admin-menu.js and the
 * indented child items beneath them. Selectors are scoped to the Antimanual
 * top-level menu and rely on ID specificity to override WordPress core menu
 * rules without using !important. Colors inherit from the active admin color
 * scheme so the sidebar adapts to any theme.
 *
 * @package Antimanual
 */

/* Parent category header row. */
#toplevel_page_antimanual .wp-submenu li.atml-cat-header {
	margin: 0;
}

/* The toggle is a real <button>; strip the native chrome so it reads as a menu
   header while keeping keyboard activation (Enter/Space) and focus semantics. */
#toplevel_page_antimanual .wp-submenu li.atml-cat-header .atml-cat-toggle {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	margin: 0;
	padding: 9px 12px;
	border: 0;
	background: transparent;
	-webkit-appearance: none;
	appearance: none;
	font-family: inherit;
	font-size: 10px;
	font-weight: 700;
	line-height: 1.4;
	text-align: left;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #72aee6;
	opacity: 0.7;
	cursor: pointer;
	transition: opacity 0.15s ease, color 0.15s ease;
}

#toplevel_page_antimanual .wp-submenu li.atml-cat-header .atml-cat-toggle:hover,
#toplevel_page_antimanual .wp-submenu li.atml-cat-header .atml-cat-toggle:focus {
	opacity: 1;
	color: #72aee6;
	box-shadow: none;
	outline: none;
}

#toplevel_page_antimanual .wp-submenu li.atml-cat-header.atml-has-current .atml-cat-toggle {
    opacity: 1;
}

/* Keyboard focus needs a visible ring since the button chrome is removed. */
#toplevel_page_antimanual .wp-submenu li.atml-cat-header .atml-cat-toggle:focus-visible {
	opacity: 1;
	outline: 1px solid currentColor;
	outline-offset: -1px;
}

#toplevel_page_antimanual .wp-submenu li.atml-cat-header.atml-open .atml-cat-toggle {
	opacity: 0.9;
}

/* Leading category icon, mirroring the in-app navbar iconography. */
#toplevel_page_antimanual .wp-submenu li.atml-cat-header .atml-cat-icon {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 14px;
	height: 14px;
}

#toplevel_page_antimanual .wp-submenu li.atml-cat-header .atml-cat-icon svg {
	width: 14px;
	height: 14px;
	display: block;
}

#toplevel_page_antimanual .wp-submenu li.atml-cat-header .atml-cat-label {
	flex: 1 1 auto;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Marker shown when a collapsed group still holds the active page, so the
   breadcrumb to the current screen is not lost when the group is closed. */
#toplevel_page_antimanual .wp-submenu li.atml-cat-header.atml-has-current:not(.atml-open) .atml-cat-label::after {
	content: "";
	display: inline-block;
	width: 5px;
	height: 5px;
	margin-left: 6px;
	vertical-align: middle;
	border-radius: 50%;
	background: currentColor;
	opacity: 0.9;
}

/* Chevron drawn with a rotated border box; points right when closed. */
#toplevel_page_antimanual .wp-submenu li.atml-cat-header .atml-cat-arrow {
	flex: 0 0 auto;
	width: 6px;
	height: 6px;
	margin-right: 3px;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: rotate(-45deg);
	transition: transform 0.15s ease;
}

/* Points down when the group is open. */
#toplevel_page_antimanual .wp-submenu li.atml-cat-header.atml-open .atml-cat-arrow {
	transform: rotate(45deg);
	margin-top: -3px;
}

/* Thin divider between the plugin's grouped pages and ungrouped items below
   (e.g. Freemius Account/Pricing) so the bottom of the menu reads intentionally. */
#toplevel_page_antimanual .wp-submenu li.atml-cat-divider {
	height: 0;
	margin: 7px 12px;
	padding: 0;
	border-top: 1px solid currentColor;
	opacity: 0.14;
	list-style: none;
}

/* Indent child items so they read as nested under the parent header. */
#toplevel_page_antimanual .wp-submenu li.atml-cat-child > a {
	padding-left: 24px;
}

/* Subtle guide line to reinforce the parent/child grouping. */
#toplevel_page_antimanual .wp-submenu li.atml-cat-child {
	position: relative;
}

#toplevel_page_antimanual .wp-submenu li.atml-cat-child > a::before {
	content: "";
	position: absolute;
	left: 13px;
	top: 0;
	bottom: 0;
	width: 1px;
	background: currentColor;
	opacity: 0.14;
}

/* Brief entrance animation when a group is expanded by the user. */
#toplevel_page_antimanual .wp-submenu li.atml-cat-child.atml-cat-animate > a {
	animation: atml-cat-reveal 0.18s ease;
}

@keyframes atml-cat-reveal {
	from {
		opacity: 0;
		transform: translateY(-4px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Respect reduced-motion preferences. */
@media ( prefers-reduced-motion: reduce ) {
	#toplevel_page_antimanual .wp-submenu li.atml-cat-header .atml-cat-arrow,
	#toplevel_page_antimanual .wp-submenu li.atml-cat-header .atml-cat-toggle {
		transition: none;
	}

	#toplevel_page_antimanual .wp-submenu li.atml-cat-child.atml-cat-animate > a {
		animation: none;
	}
}

/* When the whole admin menu is folded to icons, the submenu becomes a flyout;
   drop the indentation and guide line so labels are not clipped. */
.folded #toplevel_page_antimanual .wp-submenu li.atml-cat-child > a {
	padding-left: 12px;
}

.folded #toplevel_page_antimanual .wp-submenu li.atml-cat-child > a::before {
	display: none;
}