/**
 * Premium Sidebar Menu — frontend shell
 */

body.psm-shell-active {
	font-family: var(--psm-font);
}

body.psm-shell-active::before {
	content: "";
	position: fixed;
	inset: 0;
	pointer-events: none;
	z-index: 0;
	background: var(--psm-bg-gradient);
}

body.psm-shell-active::after {
	content: "";
	position: fixed;
	width: 280px;
	height: 280px;
	top: 8%;
	right: -80px;
	border-radius: 50%;
	background: var(--psm-accent);
	filter: blur(90px);
	opacity: 0.22;
	pointer-events: none;
	z-index: 0;
}

@media (min-width: 1024px) {
	body.psm-shell-active {
		padding-left: var(--psm-sidebar-w);
		padding-top: var(--psm-header-h);
		background: var(--psm-content-bg);
		color: #1e293b;
	}

	body.psm-shell-active::before,
	body.psm-shell-active::after {
		display: none;
	}

	body.admin-bar.psm-shell-active {
		padding-top: calc(var(--psm-header-h) + 32px);
	}
}

@media (max-width: 1023px) {
	body.psm-shell-active {
		padding-top: var(--psm-header-h);
		padding-bottom: calc(var(--psm-mobile-nav-h) + 20px + env(safe-area-inset-bottom, 0px));
		background: var(--psm-content-bg);
		color: #1e293b;
	}

	body.psm-shell-active::before,
	body.psm-shell-active::after {
		display: none;
	}

	body.admin-bar.psm-shell-active {
		padding-top: calc(var(--psm-header-h) + 46px);
	}
}

@media (max-width: 1023px) and (min-width: 783px) {
	body.admin-bar.psm-shell-active {
		padding-top: calc(var(--psm-header-h) + 32px);
	}
}

/* Layout shell (desktop: sidebar + header connected) */
.psm-layout-shell {
	display: contents;
}

/* Sidebar */
.psm-sidebar {
	position: fixed;
	top: 0;
	left: 0;
	z-index: var(--psm-z-sidebar);
	width: var(--psm-sidebar-w);
	height: 100vh;
	height: 100dvh;
	color: var(--psm-text);
	transform: translateX(0);
	transition: transform var(--psm-transition);
}

.psm-sidebar__inner {
	display: flex;
	flex-direction: column;
	height: 100%;
	margin: 12px;
	padding: 18px 14px;
	background: var(--psm-glass);
	border: 1px solid var(--psm-border);
	border-radius: var(--psm-radius-lg);
	box-shadow: var(--psm-shadow);
	backdrop-filter: blur(var(--psm-glass-blur));
	-webkit-backdrop-filter: blur(var(--psm-glass-blur));
}

/* Header brand (logo only in header — desktop & mobile) */
.psm-brand {
	display: flex;
	align-items: center;
	min-width: 0;
}

.psm-brand__link {
	display: inline-flex;
	align-items: center;
	text-decoration: none;
}

.psm-brand__logo {
	display: block;
	max-width: 160px;
	max-height: 44px;
	width: auto;
	height: auto;
	object-fit: contain;
}

.psm-brand__text {
	font-size: 1.05rem;
	font-weight: 700;
	color: var(--psm-text);
	text-decoration: none;
	letter-spacing: -0.02em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Logo: mobile = header, desktop = sidebar */
.psm-sidebar__brand {
	display: none;
	padding: 4px 8px 18px;
	margin-bottom: 8px;
	border-bottom: 1px solid var(--psm-border);
}

.psm-header__brand {
	display: flex;
	align-items: center;
	min-width: 0;
}

.psm-header__toggle {
	display: none;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 42px;
	height: 42px;
	padding: 0;
	border: none;
	outline: none;
	box-shadow: none;
	border-radius: 12px;
	color: var(--psm-toggle-icon);
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	transition: background var(--psm-transition), color var(--psm-transition), opacity var(--psm-transition);
}

.psm-header__toggle:hover {
	opacity: 0.92;
}

.psm-header__toggle:focus,
.psm-header__toggle:focus-visible {
	outline: none;
	box-shadow: none;
}

.psm-header__action--profile,
.psm-header__account-toggle {
	border: none;
	outline: none;
	box-shadow: none;
	background: var(--psm-profile-bg);
	color: var(--psm-profile-icon);
	-webkit-appearance: none;
	appearance: none;
}

.psm-header__action--profile:hover,
.psm-header__account-toggle:hover {
	background: var(--psm-profile-bg);
	opacity: 0.92;
	transform: none;
}

.psm-header__action--profile:focus,
.psm-header__action--profile:focus-visible,
.psm-header__account-toggle:focus,
.psm-header__account-toggle:focus-visible {
	outline: none;
	box-shadow: none;
}

.psm-header__action--profile svg,
.psm-header__account-toggle svg {
	color: var(--psm-profile-icon);
	fill: currentColor;
	stroke: none;
}

/* Menu toggle — solid (filled icon + colored button) */
.psm-header__toggle--solid,
body.psm-toggle-style-solid .psm-header__toggle {
	background: var(--psm-toggle-bg);
}

.psm-header__toggle--solid .psm-header__toggle-svg,
.psm-header__toggle--solid .psm-header__toggle-svg svg,
body.psm-toggle-style-solid .psm-header__toggle-svg,
body.psm-toggle-style-solid .psm-header__toggle-svg svg {
	color: var(--psm-toggle-icon);
	fill: currentColor;
	stroke: none;
}

/* Menu toggle — outline (line icon, no filled button) */
.psm-header__toggle--outline,
body.psm-toggle-style-outline .psm-header__toggle {
	background: transparent;
}

.psm-header__toggle--outline .psm-header__toggle-svg,
.psm-header__toggle--outline .psm-header__toggle-svg svg,
body.psm-toggle-style-outline .psm-header__toggle-svg,
body.psm-toggle-style-outline .psm-header__toggle-svg svg {
	color: var(--psm-toggle-icon);
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.psm-header__toggle-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.psm-header__toggle-icon--close {
	display: none;
}

body.psm-sidebar-open .psm-header__toggle-icon--menu {
	display: none;
}

body.psm-sidebar-open .psm-header__toggle-icon--close {
	display: inline-flex;
}

.psm-header__toggle-svg,
.psm-header__toggle-svg svg {
	width: 22px;
	height: 22px;
}

.psm-sidebar__nav {
	flex: 1;
	overflow: auto;
	padding: 6px 4px;
	scrollbar-width: thin;
	scrollbar-color: var(--psm-border) transparent;
}

.psm-nav-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 4px;
}

.psm-nav-list--child {
	margin: 4px 0 4px 12px;
	padding-left: 10px;
	border-left: 1px solid var(--psm-border);
}

.psm-nav-link {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	padding: 11px 12px;
	border: none;
	border-radius: var(--psm-radius-sm);
	background: transparent;
	color: var(--psm-muted);
	text-decoration: none;
	font: inherit;
	font-size: 0.94rem;
	font-weight: 500;
	cursor: pointer;
	transition: background var(--psm-transition), color var(--psm-transition), box-shadow var(--psm-transition);
}

.psm-nav-link:hover,
.psm-nav-link:focus-visible {
	color: var(--psm-text);
	background: var(--psm-surface-strong);
	outline: none;
}

.psm-nav-item.is-active > .psm-nav-link,
.psm-nav-link[aria-current="page"] {
	color: #fff;
	background: linear-gradient(135deg, var(--psm-accent) 0%, var(--psm-accent-2) 100%);
	box-shadow: 0 8px 24px var(--psm-accent-glow);
}

.psm-nav-link__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	flex-shrink: 0;
}

.psm-nav-link__icon svg,
.psm-nav-link__icon.dashicons {
	width: 20px;
	height: 20px;
	font-size: 20px;
}

.psm-nav-link__chevron {
	margin-left: auto;
	width: 8px;
	height: 8px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
	transition: transform var(--psm-transition);
	opacity: 0.7;
}

.psm-nav-item--has-children.is-open > .psm-nav-link .psm-nav-link__chevron {
	transform: rotate(-135deg);
}

.psm-nav-item--has-children .psm-nav-list--child {
	display: none;
}

.psm-nav-item--has-children.is-open > .psm-nav-list--child {
	display: grid;
}

.psm-sidebar__footer {
	padding-top: 12px;
	border-top: 1px solid var(--psm-border);
}

.psm-sidebar__user {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px;
	border-radius: var(--psm-radius-sm);
	background: var(--psm-surface);
}

.psm-sidebar__user-avatar {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--psm-accent), var(--psm-accent-2));
	color: #fff;
}

.psm-sidebar__user-label {
	display: block;
	font-size: 0.72rem;
	color: var(--psm-muted);
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

.psm-sidebar__user-name {
	display: block;
	font-size: 0.92rem;
	color: var(--psm-text);
}

/* Header (desktop only) */
.psm-header {
	display: none;
}

.psm-mobile-toggle {
	display: none;
}

@media (min-width: 1024px) {
	.psm-layout-shell {
		display: contents;
	}

	.psm-sidebar {
		position: fixed;
		top: 0;
		left: 0;
		bottom: 0;
		width: var(--psm-sidebar-w);
		height: auto;
		display: flex;
		flex-direction: column;
		transform: none !important;
		z-index: var(--psm-z-sidebar);
	}

	.psm-sidebar__inner {
		flex: 1;
		display: flex;
		flex-direction: column;
		margin: 0;
		height: 100%;
		padding: 20px 16px;
		background: var(--psm-shell-bg);
		border: none;
		border-right: 1px solid var(--psm-shell-border);
		border-radius: 0;
		box-shadow: var(--psm-shadow);
		backdrop-filter: blur(var(--psm-glass-blur));
		-webkit-backdrop-filter: blur(var(--psm-glass-blur));
	}

	.psm-header {
		display: block;
		position: fixed;
		top: 0;
		left: var(--psm-sidebar-w);
		right: 0;
		z-index: var(--psm-z-header);
		height: var(--psm-header-h);
		min-height: var(--psm-header-h);
		background: transparent;
	}

	.psm-header__inner {
		display: flex;
		align-items: center;
		justify-content: space-between;
		height: 100%;
		margin: 0;
		padding: 0 22px;
		background: var(--psm-shell-bg);
		border: none;
		border-bottom: 1px solid var(--psm-shell-border);
		border-radius: 0;
		backdrop-filter: blur(var(--psm-glass-blur));
		-webkit-backdrop-filter: blur(var(--psm-glass-blur));
		box-shadow: none;
	}

	.psm-header__toggle {
		display: none !important;
	}

	.psm-header__brand {
		display: none !important;
	}

	.psm-sidebar__brand {
		display: block;
	}

	.psm-header__start {
		display: flex;
		align-items: center;
		min-width: 0;
		flex: 1;
	}

	.psm-sidebar__brand .psm-brand__logo {
		max-height: 48px;
		max-width: 100%;
	}

	body.admin-bar.psm-shell-active .psm-sidebar {
		top: 32px;
	}

	body.admin-bar.psm-shell-active .psm-header {
		top: 32px;
	}

	.psm-header__actions {
		display: flex;
		align-items: center;
		gap: 10px;
	}

	.psm-header__action {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 40px;
		height: 40px;
		border-radius: 12px;
		border: 1px solid var(--psm-border);
		background: var(--psm-surface);
		color: var(--psm-text);
		text-decoration: none;
		transition: background var(--psm-transition), transform var(--psm-transition);
	}

	.psm-header__action:hover {
		background: var(--psm-surface-strong);
		transform: translateY(-1px);
	}

	.psm-header__action.psm-header__action--profile,
	.psm-header__account-toggle {
		border: none;
		box-shadow: none;
		background: var(--psm-profile-bg);
		color: var(--psm-profile-icon);
	}

	.psm-header__action.psm-header__action--profile:hover,
	.psm-header__account-toggle:hover {
		background: var(--psm-profile-bg);
		opacity: 0.92;
		transform: none;
	}

	.psm-header__action--whatsapp .dashicons {
		color: #25d366;
		font-size: 20px;
		width: 20px;
		height: 20px;
	}

	.psm-header__user {
		display: flex;
		flex-direction: column;
		align-items: flex-end;
		margin-left: 8px;
		padding-left: 14px;
		border-left: 1px solid var(--psm-border);
	}

	.psm-header__user-name {
		font-size: 0.9rem;
		font-weight: 600;
		color: var(--psm-text);
	}

	.psm-header__user-role {
		font-size: 0.75rem;
		color: var(--psm-muted);
	}
}

/* Mobile */
@media (max-width: 1023px) {
	.psm-layout-shell {
		display: contents;
	}

	.psm-header {
		display: block;
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		z-index: calc(var(--psm-z-sidebar) + 2);
		height: var(--psm-header-h);
		min-height: var(--psm-header-h);
	}

	.psm-header__inner {
		display: flex;
		align-items: center;
		justify-content: space-between;
		height: 100%;
		margin: 0;
		padding: 0 14px;
		background: var(--psm-shell-bg);
		border: none;
		border-bottom: 1px solid var(--psm-shell-border);
		border-radius: 0;
		box-shadow: var(--psm-shadow);
		backdrop-filter: blur(var(--psm-glass-blur));
		-webkit-backdrop-filter: blur(var(--psm-glass-blur));
	}

	.psm-header__start {
		display: flex;
		align-items: center;
		gap: 10px;
		min-width: 0;
		flex: 1;
	}

	.psm-header__toggle {
		display: inline-flex !important;
	}

	.psm-brand__logo {
		max-height: 40px;
	}

	.psm-header__actions {
		display: flex;
		align-items: center;
		gap: 8px;
		flex-shrink: 0;
	}

	.psm-header__action {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 38px;
		height: 38px;
		border-radius: 12px;
		border: 1px solid var(--psm-border);
		background: var(--psm-surface);
		color: var(--psm-text);
		text-decoration: none;
	}

	.psm-header__action.psm-header__action--profile,
	.psm-header__account-toggle {
		border: none;
		box-shadow: none;
		background: var(--psm-profile-bg);
		color: var(--psm-profile-icon);
	}

	.psm-header__action.psm-header__action--profile:hover,
	.psm-header__account-toggle:hover {
		background: var(--psm-profile-bg);
		opacity: 0.92;
	}

	.psm-header__user {
		display: none;
	}

	.psm-sidebar {
		position: fixed;
		top: var(--psm-header-h);
		left: 0;
		width: min(var(--psm-sidebar-w), 92vw);
		height: calc(100dvh - var(--psm-header-h));
		height: calc(100vh - var(--psm-header-h));
		transform: translateX(-100%);
		transition: transform var(--psm-transition);
		z-index: var(--psm-z-sidebar);
	}

	.psm-sidebar__inner {
		display: flex;
		flex-direction: column;
		margin: 0;
		height: 100%;
		padding: 16px 14px;
		border-radius: 0;
		border: none;
		border-right: 1px solid var(--psm-border);
		box-shadow: var(--psm-shadow);
		background: var(--psm-glass);
		backdrop-filter: blur(var(--psm-glass-blur));
		-webkit-backdrop-filter: blur(var(--psm-glass-blur));
	}

	body.psm-sidebar-open .psm-sidebar {
		transform: translateX(0);
	}

	body.admin-bar.psm-shell-active .psm-header {
		top: 32px;
	}

	body.admin-bar.psm-shell-active .psm-sidebar {
		top: calc(var(--psm-header-h) + 32px);
		height: calc(100dvh - var(--psm-header-h) - 32px);
		height: calc(100vh - var(--psm-header-h) - 32px);
	}
}

@media (max-width: 782px) {
	body.admin-bar.psm-shell-active .psm-header {
		top: 46px;
	}

	body.admin-bar.psm-shell-active .psm-sidebar {
		top: calc(var(--psm-header-h) + 46px);
		height: calc(100dvh - var(--psm-header-h) - 46px);
		height: calc(100vh - var(--psm-header-h) - 46px);
	}
}

.psm-backdrop {
	position: fixed;
	inset: 0;
	top: var(--psm-header-h);
	z-index: var(--psm-z-backdrop);
	background: rgba(0, 0, 0, 0.55);
	backdrop-filter: blur(4px);
	opacity: 0;
	transition: opacity var(--psm-transition);
}

body.psm-sidebar-open .psm-backdrop:not([hidden]) {
	opacity: 1;
}

.psm-mobile-toggle {
	position: fixed;
	top: 16px;
	left: 16px;
	z-index: var(--psm-z-toggle);
	display: none;
	align-items: center;
	justify-content: center;
	width: 46px;
	height: 46px;
	border: 1px solid var(--psm-border);
	border-radius: 14px;
	background: var(--psm-glass);
	color: var(--psm-text);
	box-shadow: var(--psm-shadow);
	backdrop-filter: blur(var(--psm-glass-blur));
	cursor: pointer;
}

/* Bottom mobile nav */
.psm-mobile-nav {
	display: none;
}

@media (max-width: 1023px) {
	.psm-mobile-nav {
		display: grid;
		grid-template-columns: repeat(5, minmax(0, 1fr));
		align-items: center;
		position: fixed;
		left: 12px;
		right: 12px;
		bottom: calc(10px + env(safe-area-inset-bottom, 0px));
		z-index: var(--psm-z-mobile-nav);
		box-sizing: border-box;
		height: var(--psm-mobile-nav-h);
		min-height: var(--psm-mobile-nav-h);
		max-height: var(--psm-mobile-nav-h);
		padding: 10px 8px 8px;
		overflow: hidden;
		background: var(--psm-glass);
		border: 1px solid var(--psm-border);
		border-radius: 22px;
		box-shadow: var(--psm-shadow);
		backdrop-filter: blur(var(--psm-glass-blur));
		-webkit-backdrop-filter: blur(var(--psm-glass-blur));
		transform: translateY(0);
		opacity: 1;
		pointer-events: auto;
		transition:
			transform 320ms cubic-bezier(0.22, 1, 0.36, 1),
			opacity 280ms cubic-bezier(0.22, 1, 0.36, 1);
		will-change: transform, opacity;
	}

	body.psm-mobile-nav-hidden .psm-mobile-nav {
		transform: translateY(calc(100% + 28px));
		opacity: 0;
		pointer-events: none;
	}

	.psm-mobile-nav__item {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		gap: 3px;
		min-width: 0;
		max-height: 100%;
		padding: 2px 4px;
		box-sizing: border-box;
		text-decoration: none;
		color: var(--psm-muted);
		font-size: 0.62rem;
		line-height: 1.1;
		font-weight: 500;
		border-radius: 12px;
		overflow: hidden;
		transition: color var(--psm-transition);
	}

	.psm-mobile-nav__item.is-active {
		color: var(--psm-text);
	}

	.psm-mobile-nav__item--home {
		align-self: center;
		transform: translateY(-4px);
	}

	.psm-mobile-nav__item--home .psm-mobile-nav__icon {
		width: 44px;
		height: 44px;
		flex-shrink: 0;
		border-radius: 50%;
		background: linear-gradient(135deg, var(--psm-accent), var(--psm-accent-2));
		box-shadow: 0 8px 22px var(--psm-accent-glow);
		color: #fff;
	}

	.psm-mobile-nav__icon {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		flex-shrink: 0;
		width: 24px;
		height: 24px;
	}

	.psm-mobile-nav__icon svg,
	.psm-mobile-nav__icon.dashicons {
		width: 18px;
		height: 18px;
		font-size: 18px;
	}

	.psm-mobile-nav__label {
		display: block;
		width: 100%;
		max-width: 56px;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
		text-align: center;
	}
}

/* Account dropdown */
.psm-header__account {
	position: relative;
}

.psm-header__account-toggle {
	cursor: pointer;
}

.psm-header__account-menu {
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	z-index: calc(var(--psm-z-header) + 5);
	min-width: 168px;
	padding: 6px;
	background: var(--psm-shell-bg);
	border: 1px solid var(--psm-shell-border);
	border-radius: var(--psm-radius-md);
	box-shadow: var(--psm-shadow);
	backdrop-filter: blur(var(--psm-glass-blur));
	-webkit-backdrop-filter: blur(var(--psm-glass-blur));
}

.psm-header__account-menu[hidden] {
	display: none;
}

.psm-header__account-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 12px;
	border-radius: var(--psm-radius-sm);
	color: var(--psm-text);
	text-decoration: none;
	font-size: 0.9rem;
	font-weight: 500;
	transition: background var(--psm-transition);
}

.psm-header__account-item:hover,
.psm-header__account-item:focus-visible {
	background: var(--psm-surface-strong);
	outline: none;
}

.psm-header__account-item-icon,
.psm-header__account-item-icon svg {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
}

.psm-icon svg {
	display: block;
}
