@import "../../../../css/_mixins.scss";
@import "../../../../css/_trx_addons.vars.scss";
@import "../../../../css/_trx_addons.colors.scss";

.sc_vgenerator {
	--trx-addons-ai-helper-vgenerator-fields-border-radius: 6px;
	--trx-addons-ai-helper-vgenerator-loading-border-radius: var(--trx-addons-ai-helper-vgenerator-fields-border-radius);
	--trx-addons-ai-helper-vgenerator-settings-border-radius: var(--trx-addons-ai-helper-vgenerator-fields-border-radius);
	--trx-addons-ai-helper-vgenerator-message-border-radius: var(--trx-addons-ai-helper-vgenerator-fields-border-radius);
	--trx-addons-ai-helper-vgenerator-button-border-radius: 6px;
	--trx-addons-ai-helper-vgenerator-tags-border-radius: 3px;
}
.sc_vgenerator_error {
	@include flex;
	@include flex-direction(column);
	@include flex-justify-content(center);
	@include flex-align-items(center);
	padding: 2em;
	background-color: $warning_bg_color;
	color: $warning_color;
	border: 1px solid $warning_bd_color;
}
.sc_vgenerator_form {
	@include flex;
	@include flex-direction(column);
	@include flex-justify-content(flex-start);
	@include flex-align-items(center);
	position: relative;

	&.sc_vgenerator_form_align_left {
		@include flex-align-items(flex-start);
	}
	&.sc_vgenerator_form_align_right {
		@include flex-align-items(flex-end);
	}
	.trx_addons_loading {
		@include border-radius(var(--trx-addons-ai-helper-vgenerator-loading-border-radius));
	}
	&.sc_vgenerator_form_loading {
		.trx_addons_loading {
			display: block;
		}
	}
}
.sc_vgenerator_form_inner {
	width: 100%;
	max-width: 100%;
	@include flex;
	@include flex-direction(column);
	@include flex-justify-content(flex-start);
	@include flex-align-items(center);

	.sc_vgenerator_form_align_left & {
		@include flex-align-items(flex-start);
	}
	.sc_vgenerator_form_align_right & {
		@include flex-align-items(flex-end);
	}
}

/* Common field styles */
.sc_vgenerator_form_field {
	position: relative;
	width: 100%;
	@include border-box;
	@include flex;
	@include flex-direction(column);
	@include flex-justify-content(flex-start);
	@include flex-align-items(flex-start);

	&.trx_addons_hidden {
		display: none;
	}

	& + & {
		margin-top: 1.5em;
	}
}
.sc_vgenerator_form_field_inner {
	position: relative;
	width: 100%;

	& > label {
		display: block;
		margin-bottom: 0.5em;
		font-weight: bold;
	}
	& > select,
	& > .select_container select,
	& > .sc_vgenerator_form_field_model_wrap > select,
	& > .sc_vgenerator_form_field_model_wrap > .select_container select,
	& > .sc_vgenerator_form_field_numeric_wrap input[type="number"],
	& > input[type="text"],
	& > .theme_form_field_text {
		width: 100%;
		@include border-radius(var(--trx-addons-ai-helper-vgenerator-fields-border-radius));
		@include border-box;
		text-overflow: ellipsis;
	}
}

/* Prompt */
.sc_vgenerator_form_field_prompt {
	@include flex-direction(row);
	@include flex-justify-content(space-between);
	@include flex-align-items(stretch);

	input[type="text"] {
		padding-right: 9em;
	}
	.sc_vgenerator_form_field_prompt_button {
		@include flex;
		@include flex-direction(row);
		@include flex-justify-content(center);
		@include flex-align-items(center);
		@include abs-pos( 4px, 4px, 4px, auto );
		@include border-box;
		@include border-radius(var(--trx-addons-ai-helper-vgenerator-button-border-radius));
		@include transition-colors;
		max-width: 50%;
		overflow: hidden;
		padding: 0 2em;
		background-color: $success_color;
		color: #fff;

		&:not(.sc_vgenerator_form_field_prompt_button_disabled):hover {
			background-color: $success_hover;
		}
		&.sc_vgenerator_form_field_prompt_button_with_icon {	// To override the theme rules
			@include flex;
		}
		.sc_vgenerator_form_field_prompt_button_image {
			max-height: 1.25em;
			width: auto;
		}
		.sc_vgenerator_form_field_prompt_button_svg {
			@include square(1.25em);

			svg {
				@include transition-property(fill);
			}
		}
		.sc_vgenerator_form_field_prompt_button_icon {
			font-size: 1.25em;
			@include transition-property(color);
		}
		.sc_vgenerator_form_field_prompt_button_image,
		.sc_vgenerator_form_field_prompt_button_svg,
		.sc_vgenerator_form_field_prompt_button_icon {
			& + .sc_vgenerator_form_field_prompt_button_text {
				margin-left: 0.5em;
			}
		}
		.sc_vgenerator_form_field_prompt_button_text {
			white-space: nowrap;
		}
	}
	.sc_vgenerator_form_field_prompt_button_disabled {
		background-color: $success_bg_color;
		color: #aaa;
		cursor: default;
	}
}

/* Settings */
.sc_vgenerator_form_settings_button {
	@include flex;
	@include flex-direction(column);
	@include flex-justify-content(center);
	@include flex-align-items(center);
	@include flex-shrink(0);
	@include border-box;
	@include border-radius(var(--trx-addons-ai-helper-vgenerator-fields-border-radius));
	font-size: 1.25em;
	width: 4em;
	margin-left: 4px;
	background-color: #e7eaed;
	color: #222;

	.sc_vgenerator_form_settings_button_image {
		max-height: 1.5em;
		width: auto;
	}
	.sc_vgenerator_form_settings_button_svg {
		@include flex;
		@include flex-justify-content(center);
		@include flex-align-items(center);

		svg {
			@include square(1.25em);
			@include transition-property(fill);
		}
	}
}
.sc_vgenerator_form_settings_button:hover,
.sc_vgenerator_form_settings_button:focus {
	background-color: #e7eaed;
	color: #222;
}
.sc_vgenerator_form_settings {
	@include abs-rt( 0, 100%, 100 );
	margin-top: 4px;
	@include border-box;
	@include border-radius(var(--trx-addons-ai-helper-vgenerator-settings-border-radius));
	padding: 1em;
	background-color: #f7f7f7;
	color: #222;
	@include transition-properties( opacity, transform );
	will-change: opacity, transform;
	opacity: 0;
	@include translateY( 20% );
	pointer-events: none;
	max-width: 20em;

	.sc_vgenerator_form_settings_field + .sc_vgenerator_form_settings_field:not(.sc_vgenerator_form_settings_field_group_title) {
		margin-top: 0.5em;
	}
	input[type="radio"] {
		margin-right: 0.3em;
	}
	select {
		width: 100%;
	}
}
.sc_vgenerator_form_settings_show {
	opacity: 1;
	@include translateY(0);
	pointer-events: auto;
}
.sc_vgenerator_form_settings_field_group_title {
	font-weight: bold;
	margin-top: 0.5em;
	margin-bottom: 0.25em;

	&:first-child {
		margin-top: 0 !important;
	}
}
.sc_vgenerator_form_field_numeric_wrap,
.sc_vgenerator_form_settings_field_numeric_wrap {
	position: relative;
	width: 100%;

	input[type="number"] {
		display: block;
		width: 100%;
		padding-right: 2em;
		@include border-box;
		-webkit-appearance: textfield;
		-moz-appearance: textfield;
		appearance: textfield;
	}
	.sc_vgenerator_form_field_numeric_wrap_buttons,
	.sc_vgenerator_form_settings_field_numeric_wrap_buttons {
		@include abs-rt;
		@include flex;
		@include flex-direction(column);
		@include flex-justify-content(stretch);
		@include flex-align-items(center);
		@include border-box;
		height: 100%;
	}
	.sc_vgenerator_form_field_numeric_wrap_button,
	.sc_vgenerator_form_settings_field_numeric_wrap_button {
		@include flex;
		@include flex-direction(row);
		@include flex-justify-content(center);
		@include flex-grow(1);
		@include flex-shrink(0);
		@include border-box;
		@include transition-properties(background-color, color);
		padding: 0.15em 0.5em;
		color: #888;

		&:hover {
			color: #222;
		}
	}
	.sc_vgenerator_form_field_numeric_wrap_button_inc,
	.sc_vgenerator_form_settings_field_numeric_wrap_button_inc {
		@include flex-align-items(flex-end);

		&:before {
			content: "\e885";
			font-family: $trx_addons_icons;
			@include square(1em);
		}
	}
	.sc_vgenerator_form_field_numeric_wrap_button_dec,
	.sc_vgenerator_form_settings_field_numeric_wrap_button_dec {
		@include flex-align-items(flex-start);

		&:before {
			content: "\e882";
			font-family: $trx_addons_icons;
			@include square(1em);
		}
	}
}
.sc_vgenerator_form_settings_field label {
	display: block;
}

/* Upload keyframe */
.sc_vgenerator_form_field_upload_keyframe_wrap {
	--trx-addons-ai-helper-vgenerator-upload-keyframe-wrap-gap: 1.5em;

	@include flex;
	@include flex-direction(row);
	@include flex-justify-content(space-between);
	@include flex-align-items(flex-start);
	@include flex-wrap(nowrap);
	gap: var( --trx-addons-ai-helper-vgenerator-upload-keyframe-wrap-gap );
	width: 100%;

	.sc_vgenerator_form_field_upload_start_keyframe,
	.sc_vgenerator_form_field_upload_end_keyframe {
		//@include flex-basis(50%);
		width: calc( 50% - var(--trx-addons-ai-helper-vgenerator-upload-keyframe-wrap-gap) / 2 );
		margin-top: 0 !important;
	}	
}
.sc_vgenerator_form_field_upload_keyframe_decorator {
	position: relative;
	width: 100%;

	.theme_form_field_placeholder {
		text-overflow: ellipsis;
		color: var(--theme-color-input_light, var(--theme-color-meta));
		@include transition-colors;
	}

	.sc_vgenerator_form_field_upload_keyframe_text {
		display: block;
		width: 100%;
		padding-right: 8em;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
		@include border-box;
	}
	.sc_vgenerator_form_field_upload_keyframe_button {
		@include abs-rc( 0.5em );
		@include border-box;
		@include transition-colors;
		padding: 0.3em 1em;
		// border: 1px solid var(--theme-color-input_bd_color, var(--theme-color-bd_color));
		@include border-radius(var(--trx-addons-ai-helper-vgenerator-fields-border-radius));

		&:before {
			margin-right: 0.5em;
		}
	}
	.sc_vgenerator_form_field_upload_keyframe_field {
		@include abs-cover(1);
		@include box(100%, 100%);
		opacity: 0;
	}
}

/* Tags */
.sc_vgenerator_form_field_tags {
	@include flex;
	@include flex-direction(row);
	@include flex-justify-content(center);
	@include flex-align-items(flex-start);

	.sc_vgenerator_form_align_left & {
		@include flex-justify-content(flex-start);
	}
	.sc_vgenerator_form_align_right & {
		@include flex-justify-content(flex-end);
	}
}
.sc_vgenerator_form_field_tags_label {
	white-space: nowrap;
	padding: 0.5em 1em 0.5em 0;
}
.sc_vgenerator_form_field_tags_list {
	@include flex;
	@include flex-direction(row);
	@include flex-wrap(wrap);
	@include flex-justify-content(flex-start);
	@include flex-align-items(flex-start);
}
.sc_vgenerator_form_field_tags_item {
	display: inline-block;
	vertical-align: top;
	margin: 0 0.5em 0.5em 0;
	padding: 0.5em 1.5em;
	background-color: $background_light;
	color: $text_light;
	@include border-radius(var(--trx-addons-ai-helper-vgenerator-tags-border-radius));
	@include border-box;

	&:hover {
		color: $text_dark;
		background-color: $background_color;
	}
}

/* Limits */
.sc_vgenerator_limits {
	width: 100%;
	text-align: center;

	.sc_vgenerator_form_align_left & {
		text-align: left;
	}
	.sc_vgenerator_form_align_right & {
		text-align: right;
	}
	.sc_vgenerator_limits_used {
		// white-space: nowrap;
		display: block;
	}
}

/* Message */
.sc_vgenerator_message {
	@include border-radius(var(--trx-addons-ai-helper-vgenerator-message-border-radius));
	@include border-box;
	position: relative;
	padding: 2em 3em;
	min-width: 40%;
	background-color: $error_bg_color;
	color: $error_color;
	margin: 1em 0;
	text-align: center;
	display: none;

	.trx_addons_button_close_icon {
		&:before,
		&:after {
			border-color: $error_dark;
		}
	}
}
.sc_vgenerator_message_inner {
	p,h1,h2,h3,h4,h5,h6 {
		margin: 0;

		& + p {
			margin-top: 0.3em;
		}
	}
	h1,h2,h3,h4,h5,h6 {
		color: $error_dark;
	}
	a {
		display: inline-block;
		vertical-align: top;
		font-weight: 500;
		color: $error_dark;
		border-bottom: 1px dashed $error_dark;

		&:hover {
			color: $error_dark;
			border-bottom-style: solid;
		}
	}
	// .sc_vgenerator_message_translation {

	// 	&:before {
	// 		content: ' ';
	// 		display: block;
	// 		height: 0;
	// 		width: 0;
	// 	}
	// }
}
.sc_vgenerator_message_type_info {
	background-color: $info_bg_color;
	color: $info_color;

	h1,h2,h3,h4,h5,h6 {
		color: $info_dark;
	}
	a {
		color: $info_dark;
		border-bottom-color: $info_dark;

		&:hover {
			color: $info_dark;
		}
	}
	.trx_addons_button_close_icon {
		&:before,
		&:after {
			border-color: $info_dark;
		}
	}
}
.sc_vgenerator_message_type_success {
	background-color: $success_bg_color;
	color: $success_color;

	h1,h2,h3,h4,h5,h6 {
		color: $success_dark;
	}
	a {
		color: $success_dark;
		border-bottom-color: $success_dark;

		&:hover {
			color: $success_dark;
		}
	}
	.trx_addons_button_close_icon {
		&:before,
		&:after {
			border-color: $success_dark;
		}
	}
}

/* Video - Preview area */
.sc_vgenerator_videos {
	display: none;
	margin-top: 2.5em;
}

.sc_vgenerator_columns_wrap {
	@include flex;
	@include flex-direction(row);
	@include flex-justify-content(center);
	@include flex-align-items(flex-start);
	@include flex-wrap(wrap);
}
.sc_vgenerator_videos_item {
	flex-basis: 50%;
	max-width: 100%;
	min-width: 480px;
}

.sc_vgenerator_video_inner {
	position: relative;
	text-align: center;
	// @include flex;
	// @include flex-direction(column);
	// @include flex-justify-content(center);
	// @include flex-align-items(center);

	.sc_vgenerator_video_wrap {
		display: block;
		position: relative;
		max-width: 100%;
		margin: 0 auto;
	}

	.sc_vgenerator_video_wait_available {
		display: none;
		@include flex-direction(column);
		@include flex-justify-content(center);
		@include flex-align-items(center);
		@include border-box;
		@include abs-cover; // Place it over the video
		padding: 1.5em;
		background-color: rgba(122, 122, 122, 0.56);
		border: 1px solid rgba(122, 122, 122, 0.88);
		cursor: auto;
	}
	.sc_vgenerator_video_wait_icon {
		font-size: 3em;
		color: #fff;

		&:before {
			content: "\e92a";
			font-family: $trx_addons_icons;
		}
	}
	.sc_vgenerator_video_wait_msg {
		margin-top: 2em;
		font-size: 1em;
		color: #fff;
	}

	&.sc_vgenerator_video_loading {
		.sc_vgenerator_video_wait_available {
			@include flex;
		}
	}
}

.sc_vgenerator_video_fetch {
	min-height: 15em;

	video {
		aspect-ratio: 16 / 9;
	}
}
.sc_vgenerator_video_fetch_info {
	@include abs-pos(auto, 10px, 10px, 10px);
	@include border-box;
	padding: 0 1em 1em;
	@include flex;
	@include flex-direction(column);
	@include flex-justify-content(flex-start);
	@include flex-align-items(center);
}
.sc_vgenerator_video_fetch_msg {
	display: block;
	text-decoration: none;
	font-size: 1.2em;
	line-height: 1.5em;
	font-weight: bold;
	// Commented to preserve the original color from the theme
	//color: $text_dark;
}
.sc_vgenerator_video_fetch_progress {
	display: block;
	margin-top: 10px;
	@include box(50%, 4px);
	//border: 1px solid $text_light;
	background-color: $text_light;
	overflow: hidden;
}
.sc_vgenerator_video_fetch_progressbar {
	display: block;
	@include box(50%, 4px);
	background-color: $warning_color;
	@include animation(sc_vgenerator_video_fetch_progress_animation 1.5s linear infinite);
	will-change: transform;
}
.sc_vgenerator_video_fetch.trx_addons_column-1_1 {
	.sc_vgenerator_video_fetch_progress {
		width: 40%;
	}
}

@-webkit-keyframes sc_vgenerator_video_fetch_progress_animation { 
	0% {
		@include translateX(-110%);
	}
	100% {
		@include translateX(210%);
	}
}

@keyframes sc_vgenerator_video_fetch_progress_animation { 
	0% {
		@include translateX(-110%);
	}
	100% {
		@include translateX(210%);
	}
}

.sc_vgenerator_video_link {
	margin-top: 1.5em;

	.sc_vgenerator_video_fetch_info + & {
		display: none !important;
	}

	.sc_button_icon {
		font-size: 1em;
	}
}
