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

$gf-en-primary: #0da88c;
$gf-en-primary-dark: #0c9b81;
$gf-en-heading: #1e1e1e;
$gf-en-body: #6e7376;
$gf-en-muted: #646970;
$gf-en-border: #dedede;
$gf-en-border-light: #e2e2e2;
$gf-en-danger: #d70404;
$gf-en-warning-bg: #fff8e2;
$gf-en-warning-border: #f79808;
$gf-en-surface-muted: #f9f9f9;
$gf-en-pill-bg: #f0fffc;
$gf-en-pill-hover: #dff8f2;
$gf-en-table-header: #4b5563;

.gutena-forms-email-notifications-panel {
	.components-panel__body-title {
		font-weight: 600;
	}

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

	.gutena-forms-email-notifications-panel__toggle {
		.components-toggle-control__label {
			font-size: 13px;
			font-weight: 600;
		}

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

	.gutena-forms-email-notifications-panel__configure.components-button {
		@include gutena-forms-panel-configure-button;
	}
}

.gutena-forms-email-notifications-modal {
	inset: 0;
	position: fixed;
	z-index: 100000;

	&.is-detail-view .gutena-forms-email-notifications-modal__add-button {
		display: none;
	}

	&__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));
	}

	&__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;
	}

	&__add-button.components-button {
		align-items: center;
		background: #fff;
		border: 1px solid $gf-en-primary;
		border-radius: 4px;
		box-shadow: none;
		color: #0e826d;
		display: inline-flex;
		font-size: 12px;
		font-weight: 700;
		gap: 20px;
		height: auto;
		line-height: 1;
		min-height: 0;
		padding: 10px 12px;

		&.is-secondary {
			box-shadow: none;

			&:not( :disabled ):not( [aria-disabled='true'] ):hover,
			&:not( :disabled ):not( [aria-disabled='true'] ):focus {
				background: #fff;
				box-shadow: none;
			}
		}

		.components-button__icon {
			flex-shrink: 0;
			height: 12px;
			margin: 0;
			width: 12px;

			svg {
				display: block;
				height: 12px;
				max-height: none;
				max-width: none;
				width: 12px;
			}
		}

		svg {
			flex-shrink: 0;
			height: 12px;
			max-height: none;
			max-width: none;
			width: 12px;
		}

		&:hover,
		&:focus {
			background: #fff;
			border-color: $gf-en-primary;
			color: #0e826d;
		}
	}

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

	&__body {
		flex: 1 1 auto;
		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;
		}
	}

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

.gutena-forms-email-notifications-edit {
	display: flex;
	flex-direction: column;
	gap: 16px;
	margin: 0;
}

.gutena-forms-email-notifications-modal__table-wrap {
	border: 1px solid $gf-en-border;
	border-radius: 8px;
	overflow-x: auto;
}

.gutena-forms-email-notifications-table {
	border-collapse: collapse;
	margin: 0;
	table-layout: fixed;
	width: 100%;

	&__col-name {
		width: 150px;
		min-width: 150px;
	}

	&__col-subject {
		width: 200px;
		min-width: 200px;
	}

	&__col-status {
		width: 100px;
		min-width: 100px;
	}

	&__col-actions {
		width: 128px;
		min-width: 128px;
	}

	th,
	td {
		border-bottom: 1px solid $gf-en-border-light;
		padding: 15px;
		text-align: left;
		vertical-align: middle;
	}

	tr:last-child {
		td {
			border-bottom: none;
		}
	}

	th {
		background: $gf-en-surface-muted;
		border-bottom: 1px solid $gf-en-border;
		color: $gf-en-table-header;
		font-size: 14px;
		font-weight: 700;
		text-transform: uppercase;
	}

	td {
		color: $gf-en-heading;
		font-size: 12px;
	}

	&__col-subject {
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}
}

.gutena-forms-email-notifications-table__toggle {
	margin: 0;

	.components-base-control__field {
		margin-bottom: 0;
	}

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

.gutena-forms-email-notifications-table__actions {
	align-items: center;
	display: flex;
	gap: 20px;
}

.gutena-forms-email-notifications-table__action-icon.components-button {
	align-items: center;
	color: $gf-en-primary;
	display: inline-flex;
	height: 36px;
	justify-content: center;
	min-height: 36px;
	min-width: 36px;
	padding: 0;
	width: 36px;

	.components-button__icon {
		height: auto;
		margin: 0;
		width: auto;
	}

	&.is-destructive {
		color: $gf-en-danger;
	}

	&.is-edit {
		.components-button__icon svg,
		svg {
			display: block;
			height: 18px;
			max-height: none;
			max-width: none;
			width: 18px;
		}
	}

	&.is-delete {
		.components-button__icon svg,
		svg {
			display: block;
			height: 18px;
			max-height: none;
			max-width: none;
			width: 16px;
		}
	}
}

.gutena-forms-email-notifications-modal__empty {
	background: #f8f9fa;
	border: 1px dashed $gf-en-border-light;
	border-radius: 8px;
	padding: 24px;
	text-align: center;

	p {
		color: $gf-en-muted;
		font-size: 13px;
		margin: 0;
	}
}

.gutena-forms-email-notifications-modal__cancel.components-button {
	background: #fff;
	border: 1px solid $gf-en-border;
	border-radius: 4px;
	box-shadow: none;
	color: $gf-en-heading;
	font-size: 14px;
	font-weight: 500;
	height: auto;
	min-height: 0;
	padding: 10px 12px;

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

.gutena-forms-email-notifications-modal__save.components-button.is-primary {
	background: $gf-en-primary;
	border-radius: 4px;
	box-shadow: none;
	font-size: 14px;
	font-weight: 700;
	height: auto;
	min-height: 0;
	padding: 10px 30px;

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

.gutena-forms-notification-field {
	display: flex;
	flex-direction: column;
	gap: 5px;
}

.gutena-forms-notification-field__label,
.gutena-forms-notification-field--select .components-base-control__label {
	color: $gf-en-heading;
	display: block;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.2;
	margin: 0;
	text-transform: none;
}

.gutena-forms-notification-field__required {
	color: $gf-en-danger;
}

.gutena-forms-notification-field__row {
	align-items: stretch;
	display: flex;
	gap: 8px;
}

.gutena-forms-notification-field__input {
	background: #fff;
	border: 1px solid $gf-en-border;
	border-radius: 4px;
	box-shadow: none;
	color: $gf-en-heading;
	flex: 1;
	font-size: 12px;
	height: 32px;
	line-height: 1;
	min-width: 0;
	padding: 10px;

	&::placeholder {
		color: $gf-en-body;
		font-size: 12px;
	}

	&:focus {
		border-color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #2271b1));
		box-shadow: 0 0 0 1px var(--wp-components-color-accent, var(--wp-admin-theme-color, #2271b1));
		outline: 2px solid transparent;
	}
}

.gutena-forms-notification-field__help {
	color: $gf-en-body;
	font-size: 11px;
	line-height: normal;
	margin: 0;
}

.gutena-forms-notification-field--select {
	.components-base-control__field {
		margin-bottom: 0;
	}

	.components-select-control__input {
		background: #fff;
		border: 1px solid $gf-en-border;
		border-radius: 4px;
		box-shadow: none;
		color: $gf-en-heading;
		font-size: 12px;
		height: 32px;
		min-height: 32px;
		padding: 0 10px;
	}
}

.gutena-forms-notification-field-group {
	display: flex;
	flex-direction: column;
	gap: 5px;
	max-width: 100%;
	width: fit-content;
}

.gutena-forms-notification-field-warning-box {
	align-items: flex-start;
	background: $gf-en-warning-bg;
	border: 0.5px solid $gf-en-warning-border;
	border-radius: 6px;
	box-sizing: border-box;
	display: flex;
	gap: 10px;
	padding: 10px 15px;
	width: 100%;

	&__icon {
		align-items: flex-start;
		display: flex;
		flex-shrink: 0;
		line-height: 0;
		margin-top: 1px;

		svg {
			display: block;
			height: 25px;
			width: 13px;
		}
	}

	p {
		color: $gf-en-heading;
		font-size: 10px;
		line-height: 1.4;
		margin: 0;
		min-width: 0;
		word-break: break-word;
	}
}

.gutena-forms-notification-reply-name-panel {
	background: $gf-en-surface-muted;
	border: 1px solid $gf-en-border;
	border-radius: 4px;
	display: flex;
	flex-direction: column;
	gap: 20px;
	padding: 10px;
}

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

	.gutena-forms-email-notifications-table {
		min-width: 550px;
	}
}
