@use "variables" as *;

// Sizes of the admin-ui Dialog (1240 × 860 by default). Small and medium
// dialogs fit their content up to the window height.
.modula-admin-ui .modula-admin-dialog.modula-gallery-modal {
	&--small {
		width: min(440px, calc(100vw - 32px));
		height: auto;
		max-height: calc(100vh - 80px);
	}

	&--medium {
		width: min(640px, calc(100vw - 48px));
		height: auto;
		max-height: calc(100vh - 80px);
	}

	&--large {
		width: min(1160px, calc(100vw - 64px));
		height: min(820px, calc(100vh - 80px));
	}

	&--xlarge {
		width: min(1440px, calc(100vw - 48px));
		height: min(900px, calc(100vh - 48px));
	}
}

@media (max-width: 782px) {
	.modula-admin-ui .modula-admin-dialog.modula-gallery-modal {
		&--large,
		&--xlarge {
			width: calc(100vw - 24px);
			height: min(820px, calc(100vh - 48px));
		}
	}
}

// The body fills the dialog between its header and footer.
.modula-gallery-modal__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	min-height: 0;

	&--overflow-auto {
		overflow-x: hidden;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
	}

	&--overflow-hidden {
		overflow: hidden;
	}
}

.modula-gallery-modal__footer {
	display: flex;
	flex-shrink: 0;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 18px 32px;
	border-top: 1px solid var(--modula-admin-border);
}

.modula-gallery-modal__footer-start {
	display: flex;
	flex: 1;
	align-items: center;
	gap: 8px;
	min-width: 0;
}

.modula-gallery-modal__footer-actions {
	display: flex;
	flex-shrink: 0;
	flex-wrap: nowrap;
	align-items: center;
	justify-content: flex-end;
	gap: 8px;
}

.modula-gallery-modal__preset-json-body {
	display: flex;
	flex-direction: column;
	gap: $mod-space-16;
	padding: $mod-space-20 $mod-space-24;
}

.modula-gallery-modal__preset-json-intro {
	margin: 0;
	font-size: var(--modula-admin-text-body);
	line-height: 1.55;
	color: var(--modula-admin-ink-secondary);
}

.modula-gallery-modal__preset-json-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: $mod-space-12;

	// The two actions share the row equally.
	> * {
		flex: 1 1 0;
		min-width: 0;
	}
}

.modula-gallery-modal__preset-json-error {
	margin: 0;
	font-size: var(--modula-admin-text-body);
	line-height: 1.45;
	color: var(--modula-admin-danger);
}
