@use 'variables' as *;

.button-grid-header {
	display: grid;
	grid-template-columns: 1fr auto;
	column-gap: 5px;
	padding: 10px 0;

	.input-group {
		flex-wrap: nowrap;
	}

	.button-page-input {
		flex-grow: 1;

		// Fix for firefox blowout
		display: grid;
		grid-template-columns: minmax(0, 1fr);
	}

	.right-buttons {
		align-content: center;
	}
}

.tab-pane .nav.nav-tabs .nav-link {
	color: black;
}

.buttongrid {
	-webkit-touch-callout: none !important;
	-webkit-user-select: none !important;
	user-select: none !important;

	display: grid;
	grid-auto-flow: row;
	grid-auto-rows: 1fr;

	height: 100%;

	&.button-armed .buttongrid-row {
		background-color: rgba(255, 0, 0, 0.5);
	}

	.buttongrid-row {
		display: grid;
		grid-auto-flow: column;
		grid-auto-columns: 1fr;
		transition: background-color 0.05s ease-in-out;
		background-color: transparent;

		img:hover {
			border: 1px solid rgba(255, 255, 255, 0.3);
		}
	}
}

.fadeinout {
	transition: opacity 0.05s ease-in-out;
	opacity: 1;

	&.out {
		opacity: 0;
	}
}

.button-grid-controls {
	display: flex;
	flex-flow: row wrap;
	justify-content: center;

	margin-top: 1rem;

	& > div {
		white-space: nowrap;
		margin-bottom: 1rem;
	}
}

.c-sidebar-nav-link,
.c-sidebar-nav-dropdown-toggle {
	transition: none;
}

.button-grid-panel {
	display: grid;
	grid-template-rows: auto 1fr auto;
	height: 100%;
}

.button-grid-panel-content {
	overflow: hidden;
	border-radius: 8px;
	min-height: 300px;
}

.button-grid-header {
	.btn-right {
		float: right;
		// margin-top: 10px;
		margin-left: 3px;
	}
}

.button-infinite-grid {
	height: 100%;
	max-height: 65vh;

	background-color: #222;
	// border-radius: 5px; // A radius here breaks safari, causing the div to draw over the scrollbars
	overflow: scroll;

	&.button-armed {
		background-color: #7f1111;
	}

	.button-grid-canvas {
		position: relative;
		width: 1000px;
		height: 1000px;

		// default grid scale, used for button text
		--grid-scale: 1;

		.expand {
			float: left;
			position: absolute;

			background-color: #333;

			color: #eee;

			.btn {
				color: $primary;
			}

			input {
				display: inline-block;
				width: 70px;
			}

			&.left {
				left: 0;
			}
			&.right {
				right: 0;
			}
			&.top {
				top: 0;
			}
			&.bottom {
				bottom: 0;
			}

			&.left,
			&.right {
				height: 100%;
				width: 90px;

				top: 0;

				.sticky-center {
					position: sticky;
					top: 50%;
					transform: translateY(-50%);

					text-align: center;
				}
			}

			&.top,
			&.bottom {
				height: 60px;
				width: 100%;

				left: 0;

				display: flex;
				align-items: center;

				.sticky-center {
					position: sticky;

					// display: inline-block;
					left: 50%;
					transform: translateX(-50%);
				}
			}
		}

		.button-control {
			position: absolute;
			float: left;

			.button-border {
				width: calc(var(--tile-inner-size) * 1px);
				height: calc(var(--tile-inner-size) * 1px);

				.button-placeholder {
					// shrink text with scaling
					font-size: calc(var(--grid-scale) * 1.5rem);
				}
			}
		}
	}
}

.dropdown-zoom {
	position: inherit;
	display: inline-block;

	.dropdown-item-padding {
		padding: 0.5rem 1.25rem;
	}
}
