
@use 'mixins.scss';
@use 'common.scss';

.dt-button {
	position: relative;
}

div.dt-button-collection {
	position: absolute;
	z-index: 2001;
	width: 200px;
	max-width: none;
	display: block;

	div.dt-button-collection-title {
		padding: 0.75em 0.6em 0.25em;
	}

	a.dt-button {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding-right: 0.5rem;

		&:focus {
			outline-offset: -2px;
		}
	}

	div.dt-button-split {
		display: flex;
		flex-direction: row;
		flex-wrap: wrap;
		justify-content: flex-start;
		align-content: flex-start;
		align-items: stretch;
		padding: 0;

		a:first-child {
			margin: 0;
			display: inline-block;
			width: 0;
			min-width: auto;
			flex-grow: 1;
			flex-shrink: 0;
			flex-basis: 50px;
			padding: .375rem 0 .375rem 1rem;
		}

		button:last-child {
			min-width: 33px;
			flex: 0;
			background: transparent;
			border: none;
			padding: 0;
			margin: 0;
			font-size: .875rem;
			line-height: 1.5;

			&:hover {
				background-color: #f5f5f5;
				color: #0a0a0a;
			}
		}
	}

	@include mixins.dtb-fixed-collection();

	&.fixed {
		&:before,
		&:after {
			display: none;
		}
	}
}

div.dt-button-background {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 999;
}

@media screen and (max-width: 767px) {
	div.dt-buttons {
		float: none;
		width: 100%;
		text-align: center;
		margin-bottom: 0.5em;

		a.btn {
			float: none;
		}
	}
}

div.dt-buttons.field.is-grouped {
	display: block;

	button.btn.processing,
	div.btn.processing,
	a.btn.processing {
		@include mixins.dtb-processing();
	}
}

span.dt-button-spacer {
	display: inline-flex;
	margin: 0.5em;
	white-space: nowrap;
	align-items: center;
	font-size: 1rem;

	&.bar {
		&:empty {
			height: inherit;
		}
	}
}


div.dt-button-collection {
	.is-disabled {
		cursor: default;
		opacity: 0.4;
	}

	span.dt-button-spacer {
		text-align: left;
		font-size: .875rem;
		padding-left: 1rem !important;
	}
}

div.dt-button-split {
	display: inline-flex;
	padding-left: 0;
	padding-right: 0;
	margin-bottom: 0px !important;

	button {
		margin-right: 0px;
		display: inline-block;
		margin-top: 0px;
		border-bottom-left-radius: 3px;
		border-top-left-radius: 3px;
		border-top-right-radius: 0px;
		border-bottom-right-radius: 0px;
		overflow: hidden;
		text-overflow: ellipsis;
	}
	button.dt-button {
		min-width: 30px;
		margin-left: -1px;
		border-bottom-left-radius: 0px;
		border-top-left-radius: 0px;
		border-top-right-radius: 3px;
		border-bottom-right-radius: 3px;
	}

	&:active:not(.disabled),
	&.active:not(.disabled),
	&.is-active:not(.disabled) {
		button {
			background-color: #eee;
			border-color: transparent;
		}
		button.dt-button {
			box-shadow: none;
			background-color: rgb(245,245,245);
			border-color: transparent;
		}
		button {
			&:hover {
				background-color: #eee;
				border-color: transparent;
			}
		}
	}
}