@use "../../../styles/variables" as *;

.wcgs-sidebar {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	z-index: 31;
	width: 64px;
	padding: 14px 0 12px;
	border-left: 1px solid $wcgs-divider;
	background: #fff;
	will-change: transform;
	visibility: hidden;
	pointer-events: none;
	transform: translate3d(100%, 0, 0);
	transition:
		transform 560ms $wcgs-ease-out,
		visibility 0s linear 560ms;

	&.is-visible {
		visibility: visible;
		pointer-events: auto;
		transform: translate3d(0, 0, 0);
		transition:
			transform 560ms $wcgs-ease-out,
			visibility 0s;
	}

	&__page {

		@include wcgs-reset-button;
		width: 36px;
		height: 36px;
		flex: 0 0 36px;
		margin: 2px 0 4px;
		border-radius: 8px;
		background: $wcgs-accent-soft;
		color: $wcgs-accent;
		transition: background-color 160ms $wcgs-ease;

		&:hover {
			background-color: #ede7fd;
		}
	}

	&__divider {
		width: 32px;
		height: 1px;
		flex: 0 0 1px;
		margin: 4px 0 6px;
		background: #e8e9ec;
	}

	&__item {
		position: relative;
	}

	&__link {

		@include wcgs-reset-button;
		position: relative;
		width: 60px;
		padding: 2px 0 4px;
		border-radius: 9px;
	}

	&__tile {
		position: relative;
		width: 40px;
		height: 32px;
		border-radius: 9px;
		background: transparent;
		color: $wcgs-body;
		transition:
			background-color 160ms $wcgs-ease,
			color 160ms $wcgs-ease,
			transform 120ms $wcgs-ease;
	}

	&__label {
		font-size: 11px;
		font-weight: 500;
		line-height: 1.2;
		letter-spacing: 0.01em;
		color: $wcgs-body;
		transition: color 160ms $wcgs-ease;
	}

	// Crown of a Pro section (Shop Page Video).
	&__crown {
		position: absolute;
		top: -3px;
		right: 6px;
		z-index: 2;
		width: 18px;
		height: 18px;
		border-radius: 50%;
		background: #fff8e8;
		box-shadow: 0 0 0 1px #f1dfb0;
	}

	&__link:hover &__tile {
		background: $wcgs-bg-subtle;
		color: $wcgs-text;
	}

	&__link:hover &__label {
		color: $wcgs-text;
	}

	&__link:active &__tile {
		transform: scale(0.94);
	}

	&__link.is-active &__tile {
		background: #ede7fd;
		color: $wcgs-accent;
	}

	&__link.is-active &__label {
		color: $wcgs-accent;
		font-weight: 600;
	}

	&__dirty {
		position: absolute;
		top: 3px;
		right: 6px;
		width: 8px;
		height: 8px;
		border-radius: 50%;
		background: $wcgs-accent;
		box-shadow: 0 0 0 2px #fff;
	}

	// Hover flyout listing a section's sub-sections.
	&__flyout {
		position: absolute;
		right: 100%;
		top: 0;
		z-index: 45;
		padding-right: 8px;
		opacity: 0;
		visibility: hidden;
		transform: translateX(4px);
		transition:
			opacity 140ms $wcgs-ease,
			transform 160ms $wcgs-ease,
			visibility 0s linear 140ms;
	}

	&__item:hover &__flyout,
	&__item:focus-within &__flyout {
		opacity: 1;
		visibility: visible;
		transform: none;
		transition:
			opacity 140ms $wcgs-ease 80ms,
			transform 160ms $wcgs-ease 80ms,
			visibility 0s linear 80ms;
	}

	&__flyout-card {
		width: 240px;
		max-height: min(520px, calc(100vh - 160px));
		overflow-y: auto;
		overscroll-behavior: contain;
		gap: 1px;
		padding: 6px;
		background: #fff;
		border: 1px solid $wcgs-menu-border;
		border-radius: 10px;
		box-shadow: 0 14px 36px rgba(16, 17, 20, 0.16);
	}

	&__flyout-head {

		@include wcgs-reset-button;
		margin-bottom: 4px;
		padding: 8px 10px 10px;
		border-bottom: 1px solid #f0f0f2;
		border-radius: 0;
		font-size: 14px;
		font-weight: 600;
		color: $wcgs-text;
		text-align: left;

		span {
			font-size: 12px;
			font-weight: 500;
			color: $wcgs-faint;
		}
	}

	&__flyout-item {

		@include wcgs-reset-button;
		padding: 8px 10px 8px 6px;
		border-radius: 6px;
		font-size: 14px;
		color: $wcgs-text;
		text-align: left;
		transition: background-color 140ms $wcgs-ease;

		&:hover {
			background-color: #f5f5f7;
		}

		&.is-active {
			background: #f3eefe;
			color: $wcgs-accent;
			font-weight: 500;
		}
	}

	&__flyout-dot {
		width: 6px;
		height: 6px;
		flex: 0 0 6px;
		border-radius: 50%;
		background: transparent;
	}

	&__flyout-item.is-active &__flyout-dot {
		background: $wcgs-accent;
	}
}
