@import "../fonts/css/onest-variable.css";

#studiocms-theme-toggle,
#studiocms-theme-toggle * {
	color: var(--text-normal);
}

#studiocms-theme-toggle #dark-content,
#studiocms-theme-toggle #light-content {
	display: none;
	width: fit-content;
	height: fit-content;
	max-height: 100%;
}

#studiocms-theme-toggle #fallback-content {
	display: block;
	width: fit-content;
	height: fit-content;
	max-height: 100%;
}

[data-theme="dark"] #studiocms-theme-toggle #dark-content {
	display: block;
}

[data-theme="light"] #studiocms-theme-toggle #light-content {
	display: block;
}

[data-theme="dark"] #studiocms-theme-toggle #fallback-content,
[data-theme="light"] #studiocms-theme-toggle #fallback-content {
	display: none;
}

#scms-dashboard-layout,
#scms-dashboard-layout body {
	min-height: 100vh;
	min-width: 100vw;
	max-width: 100vw;
	height: 100%;
	overflow-y: auto;
	overflow-x: hidden;
	scrollbar-width: thin;
	display: flex;
	align-items: center;
	font-family: var(--scms-font-onest);
}

#scms-dashboard-layout {
	main {
		min-height: 100%;
		width: 100vw;
		max-width: 100vw;
		position: relative;
	}

	.scrollbar {
		overflow-y: auto;
		overflow-x: hidden;

		&::-webkit-scrollbar,
		&::-webkit-scrollbar-track {
			background-color: inherit;
			border-top-left-radius: 0;
			border-top-right-radius: 0;
			-webkit-box-shadow: inset 0 0 2px var(--border);
		}
		&::-webkit-scrollbar-thumb {
			background-color: var(--mono-flat-hover);
			border: 4px solid transparent;
			background-clip: content-box;
			border-radius: var(--radius-full);
		}
		&::-webkit-scrollbar-thumb:hover {
			background-color: var(--mono-flat-active);
			cursor: default;
		}
	}

	.sidebar-header {
		display: flex;
		flex-direction: column;
		gap: 1rem;
		align-items: center;
		width: 100%;
	}

	.sidebar-logo {
		width: 2.75rem;
		height: auto;
	}

	.sidebar-title {
		font-size: 1.75em;
		font-weight: 700;
	}

	.sidebar-subtitle {
		font-size: 1em;
		color: var(--text-muted);
		display: flex;
		align-items: center;
		flex-direction: row;
		gap: 1rem;
		width: 100%;

		.sui-group {
			width: 100%;

			button {
				align-items: center;
			}
		}
	}

	.sidebar-header-text {
		display: flex;
		flex-direction: row;
		gap: 1rem;
		align-items: center;
	}
	.sidebar-link-group {
		display: flex;
		flex-direction: column;
		gap: 0.375rem;
		width: 100%;
	}

	.sidebar-link-group.hidden {
		display: none;
	}

	.empty-placeholder-span {
		width: 100%;
		text-align: center;
		color: var(--text-muted);
		font-size: 0.875em;
	}

	.user-dropdown-trigger-container {
		width: calc(280px - 3rem);
		cursor: pointer;
		border: 1px solid var(--border);
		padding: 0.5rem;
		border-radius: 0.5rem;
		transition: all 0.15s ease;
	}

	.user-dropdown-trigger-container:hover {
		background-color: var(--background-step-2);
	}

	.sidebar {
		justify-content: space-between;
	}

	.sidebar-links-container {
		gap: 0.75rem;
		display: flex;
		flex-direction: column;
		align-items: center;
		width: 100%;
		height: 100%;
	}

	.outer-sidebar-container {
		height: 100%;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		width: 100%;
	}

	.sui-modal.lg {
		width: 650px !important;
	}

	.dashboard-footer {
		display: flex;
		flex-direction: column;
		align-items: center;
		gap: 0.25rem;
		padding-top: 1.25rem;
		color: var(--text-muted);
		font-size: 0.875em;
		justify-content: center;

		& a {
			color: var(--text-muted);
			text-decoration: none;
			margin-left: 0.25rem;
		}
	}

	.dashboard-footer a:hover {
		color: var(--primary-hover);
		text-decoration: underline;
	}

	.container {
		height: 100vh;
		min-height: 100dvh;
		max-height: 100vh;
		max-width: 100%;
		padding: 1.5rem;
		overflow-y: auto;
		overflow-x: hidden;
		display: flex;
		flex-direction: column;

		&::-webkit-scrollbar,
		&::-webkit-scrollbar-track {
			background-color: inherit;
			border-radius: 99px;
			border-top-left-radius: 0;
			border-top-right-radius: 0;
		}
		&::-webkit-scrollbar-thumb {
			background-color: var(--default-active);
			border: 4px solid transparent;
			background-clip: content-box;
			border-radius: 99px;
		}
		&::-webkit-scrollbar-thumb:hover {
			background-color: var(--default-hover);
		}
	}

	.container-content {
		-webkit-box-flex: 1;
		-ms-flex-positive: 1;
		flex-grow: 1;
		margin: 0 auto;
		position: relative;
		width: 100%;
	}

	.dashboard-grid-container {
		display: grid;
		grid-template-columns: repeat(3, 1fr);
		grid-auto-flow: dense;
		gap: 1rem;
		width: 100%;

		& .grid-item {
			padding: 0.5rem;
			height: unset !important;
			grid-row: auto;
		}

		& .span-2 {
			grid-column: span 2;
		}

		& .span-3 {
			grid-column: span 3;
		}

		& .grid-item-title {
			display: flex;
			gap: 1rem;
			align-items: center;
		}
	}

	.sidebar-link {
		display: flex;
		flex-direction: row;
		gap: 0.5rem;
		align-items: center;
		border-radius: 0.5rem;
		transition: all 0.15s ease;
		width: 100%;
		padding: 0.375rem 0.5rem;
		text-decoration: none;
		color: var(--text-muted);
		cursor: pointer;
	}

	.sidebar-link:hover {
		background-color: var(--background-step-2);
	}

	.sidebar-link.active {
		color: var(--text);
	}

	.sidebar-link.active .sidebar-link-icon {
		color: var(--primary-base);
	}

	#sui-sidebar-inner {
		display: block !important;
	}

	.inner-sidebar-header {
		display: flex;
		width: 100%;
		gap: 1rem;
		align-items: center;

		& input {
			width: 100%;
		}

		& button {
			aspect-ratio: 1 / 1;
			display: flex;
			align-items: center;
			justify-content: center;
		}

		& input[name="search"] {
			height: 40px;
		}
	}

	.inner-sidebar-folder-child-nodes {
		margin-left: 0.5rem;
		border-left: 2px solid var(--border);
	}

	.inner-sidebar-link {
		display: flex;
		flex-direction: row;
		gap: 0.5rem;
		align-items: center;
		border-radius: 0.5rem;
		transition: all 0.15s ease;
		width: 100%;
		padding: 0.375rem 0.5rem;
		text-decoration: none;
		color: var(--text-muted);
	}

	.not-selected {
		display: block;
	}

	.selected {
		display: none;
	}

	.inner-sidebar-link:hover {
		background-color: var(--background-step-3);
	}

	.inner-sidebar-link.active {
		color: var(--text);
	}

	.inner-sidebar-link.active .sidebar-link-icon {
		color: var(--primary-base);
	}

	.inner-sidebar-items {
		display: flex;
		flex-direction: column !important;
		gap: 0.4rem !important;
		width: 100%;
		min-height: 100%;
		max-height: 100%;
		height: 100%;
	}

	.inner-sidebar-link {
		display: flex;
		flex-direction: row;
		gap: 0.5rem;
		align-items: center;
		border-radius: 0.5rem;
		transition: all 0.15s ease;
		width: 100%;
		padding: 0.375rem 0.5rem;
		text-decoration: none;
		color: var(--text-muted);
	}

	#search-selector {
		margin-bottom: 0.4rem;
	}

	.inner-sidebar-link:hover {
		background-color: var(--background-step-3);
		cursor: pointer;
	}

	.text-h3 {
		font-size: 1.25em;
		font-weight: 700;
	}

	.inner-user-sidebar-header {
		display: flex;
		width: 100%;
		align-items: center;
		padding-bottom: 1.5rem;
		padding-left: 1.5rem;
		padding-right: 1.5rem;
		gap: 1rem;

		& input {
			width: 100%;
		}

		& button {
			aspect-ratio: 1 / 1;
			display: flex;
			align-items: center;
			justify-content: center;
		}

		& input {
			width: 100%;
		}
	}

	.inner-sidebar-users {
		display: flex;
		flex-direction: column;
		width: 100%;
		height: 100%;
	}

	.sidebar-user {
		padding: 1rem;
		display: flex;
		justify-content: space-between;
		align-items: center;
		text-decoration: none;
		color: var(--text-normal);
		transition: all 0.15s ease;
	}

	.sidebar-user:hover {
		background-color: var(--background-step-1);
	}

	.sidebar-user.active {
		background-color: var(--background-step-2);
	}

	.sui-accordion-details .astro-code {
		background-color: var(--background-step-2) !important;
		border: 1px solid var(--border) !important;
		border-radius: 0.25rem;
		padding: 1rem;
		margin-bottom: 1rem;
		margin-right: 1rem;
		box-sizing: border-box;
	}

	.mobile-btn {
		display: none !important;
		aspect-ratio: 1 / 1;
		align-items: center;
		justify-content: center;
	}

	.mid-size-btn {
		display: none !important;
	}

	#search-form {
		width: 100%;
	}

	#sui-sidebar-inner > div:has(> .inner-sidebar-container) {
		height: 100%;
	}

	@media (max-width: 1200px) {
		.dashboard-grid-container {
			grid-template-columns: repeat(2, 1fr);

			& .span-3 {
				grid-column: span 2;
			}

			& .span-2 {
				grid-column: span 2;
			}
		}
	}

	@media (max-width: 768px) {
		.dashboard-grid-container {
			grid-template-columns: 1fr;

			& .span-3 {
				grid-column: span 1;
			}

			& .span-2 {
				grid-column: span 1;
			}
		}
	}

	@media screen and (max-width: 1200px) {
		.mid-size-btn {
			display: flex !important;
		}
	}

	@media screen and (max-width: 840px) {
		.sidebar-links-container {
			align-items: flex-start;
		}

		.sidebar-header {
			width: 100%;
		}

		.sidebar-header-text {
			flex-direction: row;
			width: 100%;
			justify-content: space-between;
		}

		.dashboard-footer {
			text-align: left;
		}

		#sui-sidebar > div,
		.user-dropdown-trigger-container {
			width: 100%;
		}

		.mobile-btn {
			display: flex !important;
		}
	}

	@media screen and (max-width: 440px) {
		.sidebar-header-text {
			flex-direction: column;
			width: fit-content;
		}
	}
}
