/*
 * Copyright (C) 2026 Fluxer Contributors
 *
 * This file is part of Fluxer.
 *
 * Fluxer is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Fluxer is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
 */

.container {
	display: flex;
	min-height: 44px;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 0.25rem 0;
}

.container.compact {
	min-height: unset;
	gap: 0.75rem;
	padding: 0;
}

.labelContainer {
	display: flex;
	min-width: 0;
	flex: 1 1 0%;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.25rem;
}

.label {
	display: flex;
	min-width: 0;
	max-width: 100%;
	align-items: center;
	gap: 0.5rem;
	font-weight: 500;
	font-size: 0.875rem;
	line-height: 1.25rem;
	color: var(--text-primary);
}

.label.disabled {
	cursor: not-allowed;
}

.labelContainer.clickable {
	cursor: pointer;
}

.description {
	padding-right: 1rem;
	font-size: 0.875rem;
	line-height: 1.25rem;
	color: var(--text-primary-muted);
}

.switchRoot {
	--switch-highlight: rgba(255, 255, 255, 0.1);
	--switch-edge: rgba(0, 0, 0, 0.25);
	--switch-shadow: rgba(0, 0, 0, 0.2);
	display: inline-flex;
	align-items: center;
	position: relative;
	height: 1.5rem;
	width: 2.75rem;
	border-radius: 9999px;
	background-color: rgb(107 114 128);
	box-shadow:
		inset 0 2px 4px 0 rgba(0, 0, 0, 0.15),
		0 1px 0 0 var(--switch-highlight);
	transition-property: color, background-color, border-color, box-shadow;
	transition-duration: 150ms;
	transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
	cursor: pointer;
}

.switchRoot:hover {
	--switch-highlight: rgba(255, 255, 255, 0.15);
}

.switchRoot.disabled {
	cursor: not-allowed;
	opacity: 0.5;
}

.switchRoot[data-state='checked'] {
	background-color: var(--brand-primary);
	box-shadow:
		inset 0 2px 4px 0 rgba(0, 0, 0, 0.1),
		0 1px 0 0 rgba(255, 255, 255, 0.15);
}

.switchThumb {
	position: relative;
	display: flex;
	height: 1.25rem;
	width: 1.25rem;
	align-items: center;
	justify-content: center;
	border-radius: 9999px;
	background-color: white;
	box-shadow:
		inset 0 -1px 2px 0 rgba(0, 0, 0, 0.08),
		0 1px 0 0 rgba(0, 0, 0, 0.15),
		0 2px 4px -1px rgba(0, 0, 0, 0.2);
	transition-property: transform, box-shadow;
	transition-duration: 150ms;
	transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
	will-change: transform;
	transform: translateX(2px);
}

.switchRoot:active .switchThumb {
	box-shadow:
		inset 0 1px 2px 0 rgba(0, 0, 0, 0.1),
		0 0 0 0 rgba(0, 0, 0, 0.15),
		0 1px 2px -1px rgba(0, 0, 0, 0.15);
}

.switchThumb[data-state='checked'] {
	transform: translateX(22px);
}

.iconChecked {
	color: var(--brand-primary);
}

.iconUnchecked {
	color: rgb(107 114 128);
}
