body {
	width: 100vw;
	flex-wrap: nowrap;
}

header {
	padding: 5px 20px;
	display: flex;
	align-items: center;
	column-gap: 10px;
	border-bottom: 1px solid var(--border-color);
}

header h1 {
	font-size: 1.2em;
}

.flexGrow {
	flex-grow: 1;
}

main {
	flex-grow: 1;
	display: flex;
	overflow: hidden;
}

aside {
	width: 30%;
	border-right: 1px solid var(--border-color);
	display: flex;
	flex-direction: column;
	padding: 10px;
	row-gap: 10px;
	flex-shrink: 0;
}

#mainPrompt {
	resize: vertical;
	max-height: 70%;
}

#seedsOuterContainer {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: nowrap;
}

#seedsContainer {
	display: flex;
	align-items: center;
	gap: 5px;
	flex-wrap: wrap;
}

#seedsContainer .seed {
	background-color: rgba(var(--primary-color-base), 0.2);
	border-radius: 5px;
	padding: 8px;
	display: flex;
	align-items: center;
	gap: 2px;
}

#seedsContainer .seedNumber {
	margin: 0;
}

#seedsContainer button {
	background-color: transparent;
	padding: 2px;
	border: none;
}

#controlsContainer {
	display: flex;
	width: 100%;
	gap: 10px;
}

#generateButton {
	flex-grow: 1;
}

#optionButtons {
	display: none;
}

#mainList {
	flex-grow: 1;
	display: flex;
	flex-direction: column;
	overflow-y: auto;
	padding: 16px;
}

#imageList,
#imageHistory {
	display: flex;
	align-items: flex-start;
	flex-wrap: wrap;
	gap: 16px;
	width: 100%;
	justify-content: center;
}

.image {
	width: calc(50% - 8px);
	box-sizing: border-box;
	border-radius: 15px;
	background: var(--surface-bg-color);
	position: relative;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

#imageHistory .image {
	width: calc(22%);
	font-size: 0.8em;
}

.image .removeImage {
	position: absolute;
	top: 10px;
	right: 10px;
	border: none;
	padding: 2px;
	line-height: 1;
}

.image .removeImage:hover {
	background-color: var(--bg-color);
}

#imageList .image .generationDurationOnGoing {
	position: absolute;
	top: 10px;
	right: 10px;
	width: 40px;
	height: 20px;
	border-radius: 5px;
	color: white;
	background-color: grey;
	font-size: 15px;
	text-align: center;
}

#imageHistory .image .generationDurationOnGoing {
	display: none;
}

.image .cancelGeneration {
	align-self: center;
	margin: 10px;
}

#imageHistory .image .cancelGeneration {
	display: none;
}

.image img {
	width: 100%;
	height: auto;
	/* min-width: 400px; */
	object-fit: cover;
	cursor: pointer;
}

.image section {
	display: flex;
	flex-direction: column;
	padding: 10px;
	gap: 5px;
	flex-wrap: wrap;
}

.image .promptContainer {
	width: 100%;
}

.image section > * {
	margin: 0;
}

.image .imageDescription {
	display: flex;
	flex-direction: row;
	flex-wrap: wrap;
	justify-content: space-between;
}

.image .imageDescription p {
	margin: 0;
}

.image .imageInformation {
	display: flex;
	flex-direction: column;
}

.image .imageDescription .regenerateImage {
	padding: 2px;
	width: 30px;
	height: 30px;
	font-size: 1.4em;
}

/* #dialogContainer {
	position: absolute;
	top: 0px;
	left: 0px;
} */

#previewDialog {
	padding: 0px;
	line-height: 0;
	border: 0px;
	width: 0;
	height: 0;
	overflow: hidden;
	background-color: transparent;
	display: flex;
	align-items: center;
	justify-content: center;
}

#previewDialog[open] {
	width: 90vw;
	height: 90vh;
}

#previewDialog:focus-visible {
	outline: none;
}

#previewDialog::backdrop {
	background-color: rgba(0, 0, 0, 0.8);
}

#previewDialog img {
	max-height: 100%;
	max-width: 100%;
}

#historyDivider {
	display: flex;
	align-items: center;
	gap: 30px;
}

#historyDivider div {
	flex-grow: 1;
	border: 1px solid var(--border-color);
}

@media screen and (max-width: 900px) {
	.image {
		width: calc(100%);
	}

	#imageHistory .image {
		width: calc(46%);
	}

	#seedsOuterContainer {
		flex-direction: column;
	}
}

@media screen and (max-width: 600px), screen and (max-height: 400px) {
	main {
		flex-direction: column;
		flex-wrap: nowrap;
		width: 100%;
	}

	main > aside {
		width: 100%;
		/* height: 20%; */
		box-sizing: border-box;

		border-right: none;
		border-bottom: 1px solid var(--border-color);
	}

	main > aside:not(.showControls) > article {
		display: none;
	}

	aside.showControls #optionButtons {
		background-color: var(--primary-color);
		color: var(--contrast-text);
	}

	.image {
		width: calc(100%);
	}

	#imageHistory .image {
		width: calc(46%);
	}

	#optionButtons {
		display: block;
	}
}
