@import "../../../shared/scss/notification-message-field";
@import "../../../shared/scss/confirmation-option-cards";
@import "../../../shared/scss/panel-configure-button";

$gf-fc-primary: #0da88c;
$gf-fc-primary-dark: #0c9b81;
$gf-fc-heading: #1e1e1e;
$gf-fc-body: #6e7376;
$gf-fc-border: #dedede;
$gf-fc-border-light: #e2e2e2;
$gf-fc-danger: #d70404;

.gutena-forms-form-confirmation-panel {
	.components-panel__body-title {
		font-weight: 600;
	}

	&.is-panel-focused {
		box-shadow: inset 0 0 0 1px $gf-fc-primary;
		outline: 1px solid $gf-fc-primary;
		outline-offset: 2px;
	}

	.gutena-forms-form-confirmation-panel__content {
		display: flex;
		flex-direction: column;
		gap: 10px;
	}

	.gutena-forms-form-confirmation-panel__toggle {
		.components-base-control__field {
			align-items: center;
			display: flex;
			justify-content: space-between;
			margin-bottom: 0;
		}

		.components-toggle-control__label {
			color: $gf-fc-heading;
			font-size: 13px;
			font-weight: 600;
			line-height: normal;
			margin: 0;
		}

		.components-form-toggle.is-checked .components-form-toggle__track {
			background-color: $gf-fc-primary;
			border-color: $gf-fc-primary;
		}

		.components-form-toggle__input:focus + .components-form-toggle__track {
			box-shadow: 0 0 0 1px #fff, 0 0 0 3px $gf-fc-primary;
			outline: none;
		}
	}

	.gutena-forms-form-confirmation-panel__configure.components-button {
		@include gutena-forms-panel-configure-button;
	}
}

.gutena-forms-form-confirmation-modal {
	inset: 0;
	position: fixed;
	z-index: 100000;

	&__overlay {
		background: rgba(0, 0, 0, 0.35);
		border: none;
		cursor: default;
		inset: 0;
		padding: 0;
		position: absolute;
	}

	&__dialog {
		background: #fff;
		border-radius: 10px;
		box-shadow: 0 0 50px rgba(0, 0, 0, 0.2);
		display: flex;
		flex-direction: column;
		left: 50%;
		max-height: calc(100vh - 64px);
		overflow: hidden;
		position: absolute;
		top: 50%;
		transform: translate(-50%, -50%);
		width: min(700px, calc(100% - 32px));
		z-index: 1;
	}

	&__header {
		align-items: center;
		display: flex;
		flex-shrink: 0;
		gap: 12px;
		justify-content: space-between;
		padding: 20px 20px 0;
	}

	&__header-actions {
		align-items: center;
		display: flex;
		flex-shrink: 0;
		gap: 10px;
	}

	&__close.components-button {
		color: $gf-fc-heading;
		flex-shrink: 0;
		height: 24px;
		margin: 0;
		min-width: 24px;
		padding: 0;
	}

	&__body {
		display: flex;
		flex: 1 1 auto;
		flex-direction: column;
		gap: 16px;
		min-height: 0;
		overflow-x: hidden;
		overflow-y: auto;
		padding: 20px;
		scrollbar-color: #c3c4c7 transparent;
		scrollbar-width: thin;

		&::-webkit-scrollbar {
			width: 8px;
		}

		&::-webkit-scrollbar-thumb {
			background: #c3c4c7;
			border-radius: 8px;
		}

		&::-webkit-scrollbar-track {
			background: transparent;
		}
	}

	&__section {
		display: flex;
		flex-direction: column;
		gap: 8px;
		margin: 0;
		width: 100%;

		&--redirect {
			gap: 12px;
		}
	}

	&__footer {
		border-top: 1px solid $gf-fc-border-light;
		display: flex;
		flex-shrink: 0;
		gap: 10px;
		justify-content: flex-end;
		margin-top: 0;
		padding: 16px 20px 20px;
	}

	&__cancel.components-button {
		background: #fff;
		border: 1px solid $gf-fc-border;
		border-radius: 4px;
		box-shadow: none;
		color: $gf-fc-heading;
		font-size: 14px;
		font-weight: 500;
		height: auto;
		line-height: 1;
		min-height: 0;
		padding: 10px 12px;

		&:hover,
		&:focus {
			background: #fff;
			border-color: $gf-fc-border;
			color: $gf-fc-heading;
		}
	}

	&__save.components-button.is-primary {
		background: $gf-fc-primary;
		border-radius: 4px;
		box-shadow: none;
		font-size: 14px;
		font-weight: 700;
		height: auto;
		line-height: 1;
		min-height: 0;
		padding: 10px 30px;

		&:hover,
		&:focus {
			background: $gf-fc-primary-dark;
		}
	}

}

.gutena-forms-form-confirmation-field {
	display: flex;
	flex-direction: column;
	gap: 8px;
	width: 100%;

	&__label {
		color: $gf-fc-heading;
		font-size: 14px;
		font-weight: 700;
		line-height: 1.2;
		margin: 0;
		text-transform: none;
	}

	&__input,
	&__select {
		appearance: none;
		background: #fff;
		background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%231E1E1E' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
		background-position: right 12px center;
		background-repeat: no-repeat;
		background-size: 10px 6px;
		border: 1px solid $gf-fc-border-light;
		border-radius: 4px;
		box-shadow: none;
		color: $gf-fc-heading;
		font-size: 12px;
		height: 35px;
		line-height: 1.2;
		min-height: 35px;
		padding: 7px 32px 7px 15px;
		width: 100%;

		&:focus {
			border-color: $gf-fc-primary;
			box-shadow: 0 0 0 1px $gf-fc-primary;
			outline: 2px solid transparent;
		}
	}

	&__input {
		background-image: none;
		padding: 7px 15px;
	}

	&__help {
		color: $gf-fc-body;
		font-size: 11px;
		line-height: normal;
		margin: 0;
	}

	&.has-error {
		.gutena-forms-form-confirmation-field__input {
			border-color: $gf-fc-danger;
		}

		.gutena-forms-form-confirmation-field__help {
			color: $gf-fc-danger;
		}
	}
}

.gutena-forms-form-confirmation-message-field {
	display: flex;
	flex-direction: column;
	gap: 6px;

	&__header {
		align-items: center;
		display: flex;
		flex-wrap: wrap;
		gap: 10px;
		justify-content: space-between;
		margin-bottom: 0;
	}

	&__label {
		color: $gf-fc-heading;
		font-size: 14px;
		font-weight: 700;
		line-height: 1.2;
		margin: 0;
	}

	&__toolbar {
		align-items: center;
		display: flex;
		flex-shrink: 0;
		flex-wrap: wrap;
		gap: 5px;
	}

	&__mode {
		background: transparent;
		border: 1px solid #e9e9e9;
		border-radius: 5px;
		color: $gf-fc-heading;
		cursor: pointer;
		font-size: 11px;
		font-weight: 500;
		line-height: 1.2;
		padding: 5px 9px;

		&.is-active {
			background: #efefef;
		}

		&:disabled {
			cursor: not-allowed;
			opacity: 0.6;
		}
	}

	&__editor {
		@include gf-message-editor-shell;
		border: 1px solid $gf-fc-border-light;
		border-radius: 6px;
	}

	&__rich-toolbar {
		align-items: center;
		background: #f8f8f8;
		border-bottom: 1px solid $gf-fc-border-light;
		color: $gf-fc-heading;
		display: flex;
		font-size: 10px;
		font-weight: 500;
		gap: 4px;
		min-height: 24px;
		padding: 5px 10px;
	}

	&__textarea {
		@include gf-message-editor-content-area;
		border: none;
		border-radius: 0;
		box-shadow: none;
		color: $gf-fc-heading;
		display: block;
		font-size: 12px;
		line-height: 1.5;
		padding: 10px;
		width: 100%;

		&:focus {
			border: none;
			box-shadow: none;
			outline: none;
		}

		&.is-code {
			font-family: Consolas, Monaco, monospace;
			font-size: 11px;
		}

		&:disabled {
			background: #f5f6f7;
			cursor: not-allowed;
		}
	}

	&__contenteditable {
		@include gf-message-editor-content-area;
		color: $gf-fc-heading;
		font-size: 12px;
		line-height: 1.5;
		outline: none;
		padding: 10px;

		&:empty::before {
			color: $gf-fc-body;
			content: attr(aria-label);
			pointer-events: none;
		}

		&:focus {
			outline: none;
		}

		a {
			color: $gf-fc-primary;
			text-decoration: underline;
		}

		ul,
		ol {
			margin: 0;
			padding-left: 20px;
		}
	}

	&.is-disabled {
		opacity: 0.6;
		pointer-events: none;

		.gutena-forms-form-confirmation-message-field__editor {
			resize: none;
		}
	}
}

.gutena-forms-form-confirmation-radio-group {
	display: flex;
	flex-direction: column;
	gap: 8px;

	&__label {
		color: $gf-fc-heading;
		font-size: 14px;
		font-weight: 700;
		line-height: 1.2;
		margin: 0;
	}

	&.is-card {
		.gutena-forms-form-confirmation-radio-group__label {
			font-size: 12px;
			font-weight: 500;
			margin-bottom: 10px;
		}
	}

	&.is-inline {
		.gutena-forms-form-confirmation-radio-group__options {
			align-items: center;
			display: flex;
			flex-wrap: wrap;
			gap: 40px;
			padding: 6px 0;
		}

		.gutena-forms-form-confirmation-radio-group__option {
			align-items: center;
			color: $gf-fc-heading;
			display: inline-flex;
			font-size: 12px;
			font-weight: 500;
			gap: 10px;
			margin: 0;

			input[type="radio"] {
				appearance: none;
				-webkit-appearance: none;
				background: #fff;
				border: 0.583px solid #a7aaad;
				border-radius: 50%;
				cursor: pointer;
				flex-shrink: 0;
				height: 14px;
				margin: 0;
				width: 14px;

				&:checked {
					background-color: #fff;
					border-color: $gf-fc-primary;
					box-shadow: inset 0 0 0 3.5px $gf-fc-primary;
				}

				&:focus-visible {
					box-shadow: 0 0 0 1px #fff, 0 0 0 3px $gf-fc-primary;
					outline: none;
				}

				&:disabled {
					cursor: not-allowed;
					opacity: 0.6;
				}
			}
		}
	}
}

@media (max-width: 782px) {
	.gutena-forms-form-confirmation-modal {
		&__dialog {
			max-height: calc(100vh - 32px);
		}
	}

	.gutena-forms-form-confirmation-message-field__header {
		align-items: flex-start;
		flex-direction: column;
	}
}
