/**
 * Sticky Side Menu (Floating) - Liquid Glass Theme
 * Frosted glass / backdrop blur, translucent panels, rounded corners
 */

/* Prevent layout shift and ensure sidebar sits above content */
#fsm-sidebar {
	position: fixed;
	top: 50%;
	transform: translateY(-50%);
	left: 0;
	z-index: 99998;
	margin: 0;
	padding: 0;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, sans-serif;
	font-size: 14px;
	line-height: 1.4;
	-webkit-font-smoothing: antialiased;
	transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1), right 0.35s cubic-bezier(0.4, 0, 0.2, 1),
		transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

#fsm-sidebar.fsm-position-right {
	left: auto;
	right: 0;
}

/* Toggle is at bottom of sidebar (nav above, toggle below) */
.fsm-sidebar-inner {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 0;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.4);
	border-radius: 0 16px 16px 0;
	overflow: hidden;
	border: 1px solid rgba(255, 255, 255, 0.25);
}

#fsm-sidebar.fsm-position-right .fsm-sidebar-inner {
	border-radius: 16px 0 0 16px;
	box-shadow: -8px 8px 32px rgba(0, 0, 0, 0.12);
}

#fsm-sidebar.fsm-position-right .fsm-toggle .fsm-chevron {
	transform: scaleX(-1);
}

/* Not floating: scrolls with the page */
body.fsm-sidebar-not-floating #fsm-sidebar.fsm-not-floating {
	position: absolute;
	top: 0;
	left: 0;
	transform: none;
}

body.fsm-sidebar-not-floating {
	position: relative;
}

body.fsm-sidebar-not-floating #fsm-sidebar.fsm-position-right.fsm-not-floating {
	left: auto;
	right: 0;
}

/* Shift content: only the main content area is shifted (header and footer stay full width) */
body.fsm-shift-content.fsm-has-sidebar {
	padding-left: 0;
	padding-right: 0;
	box-sizing: border-box;
}

/* Content-area margin is added via inline CSS (get_content_shift_css): equal left/right margins so content stays centered in the remaining space; themes can filter selectors */

/* Custom uploaded icon image */
.fsm-icon .fsm-icon-img {
	width: 20px;
	height: 20px;
	object-fit: contain;
	display: block;
}

/* Liquid glass base: blur + semi-transparent background */
.fsm-sidebar-inner::before,
.fsm-nav,
.fsm-toggle {
	background: rgba(255, 255, 255, 0.25);
	-webkit-backdrop-filter: blur(24px);
	backdrop-filter: blur(24px);
}

/* Fallback for older browsers */
@supports not (backdrop-filter: blur(1px)) {
	.fsm-sidebar-inner::before,
	.fsm-nav,
	.fsm-toggle {
		background: rgba(255, 255, 255, 0.85);
	}
}

/* Toggle button (collapse/expand) – at bottom of sidebar */
.fsm-toggle {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 48px;
	flex-shrink: 0;
	border: none;
	border-top: 1px solid rgba(255, 255, 255, 0.2);
	cursor: pointer;
	color: rgba(0, 0, 0, 0.65);
	padding: 10px;
	transition: background 0.2s, color 0.2s;
}

.fsm-toggle-label {
	display: none;
}

#fsm-sidebar.fsm-dark-text .fsm-toggle {
	color: rgba(0, 0, 0, 0.75);
}

.fsm-toggle:hover {
	background: rgba(255, 255, 255, 0.35);
	color: rgba(0, 0, 0, 0.85);
}

.fsm-chevron {
	transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#fsm-sidebar.fsm-collapsed .fsm-chevron {
	transform: rotate(180deg);
}

#fsm-sidebar.fsm-position-right.fsm-collapsed .fsm-chevron {
	transform: scaleX(-1) rotate(180deg);
}

/* Nav panel */
.fsm-nav {
	flex: 1;
	min-height: 200px;
	max-height: 70vh;
	padding: 12px 0;
	width: 240px;
	overflow-y: auto;
	overflow-x: hidden;
	transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1), padding 0.35s cubic-bezier(0.4, 0, 0.2, 1);
	border-radius: 0 12px 0 0;
}

#fsm-sidebar.fsm-position-right .fsm-nav {
	border-radius: 12px 0 0 0;
}

/* Collapsed: narrow icon-only strip */
#fsm-sidebar.fsm-collapsed .fsm-nav {
	width: 56px;
	min-width: 56px;
	padding-left: 0;
	padding-right: 0;
}

#fsm-sidebar.fsm-collapsed .fsm-section-title,
#fsm-sidebar.fsm-collapsed .fsm-label,
#fsm-sidebar.fsm-collapsed .fsm-badge {
	display: none !important;
}

#fsm-sidebar.fsm-collapsed .fsm-item {
	justify-content: center;
	padding: 10px 16px;
	margin: 2px 6px;
}

#fsm-sidebar.fsm-collapsed .fsm-section {
	margin-bottom: 8px;
}

/* Divider between multiple menus */
.fsm-divider {
	height: 1px;
	margin: 12px 16px;
	background: rgba(0, 0, 0, 0.12);
}

#fsm-sidebar.fsm-dark-text .fsm-divider {
	background: rgba(0, 0, 0, 0.18);
}

/* Section */
.fsm-section {
	margin-bottom: 16px;
}

.fsm-section:last-child {
	margin-bottom: 0;
}

.fsm-section-title {
	display: block;
	padding: 8px 20px 6px;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: rgba(0, 0, 0, 0.45);
}

#fsm-sidebar.fsm-dark-text .fsm-section-title {
	color: rgba(0, 0, 0, 0.55);
}

/* Menu item */
.fsm-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 20px;
	margin: 2px 8px;
	border-radius: 10px;
	color: rgba(0, 0, 0, 0.78);
	text-decoration: none;
	transition: background 0.2s, color 0.2s;
	position: relative;
}

#fsm-sidebar.fsm-dark-text .fsm-item {
	color: rgba(0, 0, 0, 0.88);
}

.fsm-item:hover {
	background: rgba(255, 255, 255, 0.35);
	color: rgba(0, 0, 0, 0.9);
}

.fsm-item.fsm-current {
	background: rgba(255, 255, 255, 0.4);
	color: rgba(0, 0, 0, 0.92);
	font-weight: 600;
}

/* Accent override from data attribute is applied via inline style in JS if needed */

.fsm-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 24px;
	height: 24px;
	color: inherit;
}

.fsm-icon svg {
	width: 20px;
	height: 20px;
	display: block;
	stroke: currentColor;
	fill: none;
}

.fsm-label {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Notification badge */
.fsm-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	margin-left: auto;
	font-size: 11px;
	font-weight: 600;
	line-height: 1;
	color: #fff;
	background: #e53935;
	border-radius: 9px;
}

/* Tooltip when collapsed (shown on hover via JS) */
.fsm-tooltip {
	position: fixed;
	left: 56px;
	top: 50%;
	transform: translateY(-50%);
	padding: 8px 14px;
	font-size: 13px;
	font-weight: 500;
	color: rgba(0, 0, 0, 0.9);
	background: rgba(255, 255, 255, 0.9);
	-webkit-backdrop-filter: blur(16px);
	backdrop-filter: blur(16px);
	border-radius: 10px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
	white-space: nowrap;
	z-index: 99999;
	pointer-events: none;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s, visibility 0.2s, left 0.2s, right 0.2s;
}

#fsm-sidebar.fsm-position-right .fsm-tooltip {
	left: auto;
	right: 56px;
}

.fsm-tooltip.is-visible {
	opacity: 1;
	visibility: visible;
}

/* Apply dynamic blur/opacity from data attributes (optional, set by PHP) */
#fsm-sidebar[data-blur] .fsm-nav,
#fsm-sidebar[data-blur] .fsm-toggle {
	-webkit-backdrop-filter: blur(var(--fsm-blur, 24px));
	backdrop-filter: blur(var(--fsm-blur, 24px));
}

#fsm-sidebar[data-opacity] .fsm-nav,
#fsm-sidebar[data-opacity] .fsm-toggle {
	background: rgba(255, 255, 255, var(--fsm-opacity, 0.35));
}

/* Accent for current item can be set via CSS variable */
#fsm-sidebar[data-accent] .fsm-item.fsm-current {
	background: var(--fsm-accent, rgba(255, 255, 255, 0.4));
}

/* Mobile bar slot: on desktop behave as if not there; icon outside link hidden */
.fsm-mobile-bar-slot {
	display: contents;
}
.fsm-mobile-only-icon {
	display: none;
}

/* Mobile bar: first 4 items are plain links (no slot); icon inside link is visible */
@media (max-width: 768px) {
	#fsm-sidebar .fsm-nav {
		display: grid;
		grid-template-columns: repeat(4, 1fr);
		gap: 0;
		padding: 0;
		min-height: auto;
		max-height: none;
	}
	
	#fsm-sidebar .fsm-nav > .fsm-section {
		grid-column: 1 / -1;
		display: none;
	}
	
	#fsm-sidebar .fsm-nav > .fsm-divider {
		grid-column: 1 / -1;
	}
	
	#fsm-sidebar .fsm-nav .fsm-item.fsm-mobile-bar-item {
		flex: none;
		min-width: auto;
		display: flex !important;
		align-items: center;
		justify-content: center;
		color: rgba(0, 0, 0, 0.78) !important;
		background: transparent;
		padding: 12px 8px;
		margin: 0;
		text-decoration: none;
		width: 100%;
		height: auto;
		min-height: 44px;
	}
	#fsm-sidebar .fsm-nav .fsm-item.fsm-mobile-bar-item .fsm-icon {
		display: inline-flex !important;
		align-items: center;
		justify-content: center;
		width: 28px !important;
		height: 28px !important;
		min-width: 28px !important;
		min-height: 28px !important;
		flex-shrink: 0;
		color: rgba(0, 0, 0, 0.78) !important;
	}
	#fsm-sidebar .fsm-nav .fsm-item.fsm-mobile-bar-item .fsm-icon svg {
		width: 20px !important;
		height: 20px !important;
		display: block !important;
	}
	#fsm-sidebar .fsm-nav .fsm-item.fsm-mobile-bar-item .fsm-icon .fsm-icon-img {
		display: block !important;
		max-width: 24px !important;
		max-height: 24px !important;
		object-fit: contain;
	}
	#fsm-sidebar .fsm-nav .fsm-item.fsm-mobile-bar-item .fsm-label,
	#fsm-sidebar .fsm-nav .fsm-item.fsm-mobile-bar-item .fsm-badge {
		display: none !important;
	}
}

/* Mobile overlay and drawer: hidden on desktop */
.fsm-mobile-overlay,
.fsm-mobile-drawer {
	display: none;
}
