.button {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 10px 16px;
	font-size: 14px;
	font-weight: 600;
	line-height: 20px;
	height: 44px;
	min-height: 44px;
	min-width: 96px;
	border-radius: 8px;
	border: none;
	cursor: pointer;
	appearance: none;
	text-decoration: none;
	position: relative;
	overflow: hidden;
	transition:
		background-color 0.15s ease,
		color 0.15s ease,
		border-color 0.15s ease;
}

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

.button.small {
	height: 40px;
	min-height: 40px;
	min-width: 60px;
	padding: 8px 12px;
}

.button.compact {
	height: 32px;
	min-height: 32px;
	min-width: 60px;
	padding: 6px 12px;
}

.button.superCompact {
	height: 24px;
	min-height: 24px;
	min-width: 0;
	padding: 4px;
	font-size: 12px;
	line-height: 16px;
	border-radius: 6px;
}

.button.fitContent {
	min-width: 0;
	padding: 10px 16px;
}

.button.superCompact.fitContent {
	padding: 4px 8px;
}

.button.fitContainer {
	width: 100%;
}

.button.square {
	width: 44px;
	min-width: 44px;
	padding: 10px;
}

.button.square.small {
	width: 40px;
	min-width: 40px;
	padding: 8px;
}

.button.square.compact {
	width: 32px;
	min-width: 32px;
	padding: 6px;
}

/* ── Variant: Primary ── */

.button.primary {
	background-color: var(--brand-primary);
	color: var(--brand-primary-fill);
}

.button.primary:hover:not(:disabled) {
	background-color: var(--brand-secondary);
}

.button.primary:active:not(:disabled) {
	background-color: color-mix(in srgb, var(--brand-primary) 90%, #000);
}

/* ── Variant: Secondary ── */

.button.secondary {
	background-color: var(--background-tertiary);
	color: var(--button-secondary-text);
}

:global(.theme-light) .button.secondary {
	background-color: var(--background-modifier-hover);
	color: var(--button-ghost-text);
}

.button.secondary:hover:not(:disabled) {
	background-color: color-mix(in srgb, var(--background-tertiary), #fff 4%);
	color: var(--button-secondary-active-text);
}

:global(.theme-light) .button.secondary:hover:not(:disabled) {
	background-color: color-mix(in srgb, var(--background-modifier-hover), #fff 4%);
	color: var(--button-ghost-text);
}

/* ── Variant: Danger Primary ── */

.button.dangerPrimary {
	background-color: var(--button-danger-fill);
	color: var(--button-danger-text);
}

.button.dangerPrimary:hover:not(:disabled) {
	background-color: var(--button-danger-active-fill);
}

.button.dangerPrimary:active:not(:disabled) {
	background-color: color-mix(in srgb, var(--button-danger-fill) 85%, #000);
}

/* ── Variant: Danger Secondary ── */

.button.dangerSecondary {
	background-color: color-mix(in srgb, var(--button-danger-fill) 12%, transparent);
	color: var(--button-danger-outline-text);
}

.button.dangerSecondary:hover:not(:disabled) {
	background-color: color-mix(in srgb, var(--button-danger-fill) 20%, transparent);
}

.button.dangerSecondary:active:not(:disabled) {
	background-color: color-mix(in srgb, var(--button-danger-fill) 26%, transparent);
}

/* ── Variant: Ghost ── */

.button.ghost {
	background-color: transparent;
	color: var(--button-ghost-text, var(--text-primary));
}

.button.ghost:hover:not(:disabled) {
	background-color: var(--background-modifier-hover);
}

.button.ghost:active:not(:disabled) {
	background-color: var(--background-modifier-active);
}

/* ── Variant: Link ── */

.button.link {
	background-color: transparent;
	color: var(--brand-primary);
	min-width: 0;
	height: auto;
	min-height: auto;
	padding: 0;
	font-weight: 500;
}

.button.link:hover:not(:disabled) {
	text-decoration: underline;
}

/* ── Spinner (pulsing ellipsis) ── */

.spinner {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
}

.spinnerInner {
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	width: 28px;
	height: auto;
}

.spinnerItem {
	display: inline-block;
	width: 6px;
	height: 6px;
	margin-right: 2px;
	background-color: hsl(0, 0%, 100%);
	border-radius: 4px;
	opacity: 0.3;
	animation: spinnerPulsingEllipsis 1.4s ease-in-out infinite;
}

:global(.theme-light) .button.secondary .spinnerItem {
	background-color: #000;
}

.spinnerItem:nth-of-type(2) {
	animation-delay: 0.2s;
}

.spinnerItem:nth-of-type(3) {
	animation-delay: 0.4s;
}

/* ── Layout helpers ── */

.iconWrapper {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	white-space: nowrap;
}

.spinnerWrapper {
	display: flex;
	align-items: center;
	justify-content: center;
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
}

.hidden {
	opacity: 0;
	pointer-events: none;
}

.grid {
	display: grid;
	width: 100%;
	height: 100%;
}

@keyframes spinnerPulsingEllipsis {
	0% {
		opacity: 1;
		transform: scale(1);
	}
	50% {
		opacity: 0.3;
		transform: scale(0.8);
	}
	100% {
		opacity: 1;
		transform: scale(1);
	}
}
