// Reposition the settings box above the button when the widget is in the last position.
#dashboard-widgets {
	.meta-box-sortables .postbox:last-child {
		.wp-mail-smtp-dash-widget-settings-menu {
			top: auto;
			bottom: 50px;

			@media (min-width: 800px) {
				bottom: 40px;
			}
		}
	}
}

#wp_mail_smtp_reports_widget_pro,
#wp_mail_smtp_reports_widget_lite {

	.inside {
		margin: 0;
		padding: 0;
	}
}

.wp-mail-smtp-dash-widget {

	button:focus {
		outline: none;
	}

	&-block {
		position: relative;
		padding: 0 12px;
		margin-top: 12px;

		h3 {
			display: inline-block;
			line-height: 2;
		}

		p {
			margin-top: 0;
			margin-bottom: 0;
		}
	}

	.wp-mail-smtp-dash-widget-chart-block-container {
		position: relative;
	}

	.wp-mail-smtp-dash-widget-chart-block {
		height: 291px;
		border-bottom: 1px solid #eeeeee;
		padding: 0 12px 12px;
		padding-inline-end: 14px;
	}

	.wp-mail-smtp-dash-widget-block-settings {
		display: flex;
		align-items: start;
		justify-content: space-between;
		margin-top: 0;
		padding: 13px;
		background-color: #fafafa;

		> div {
			display: flex;

			&:first-child {
				flex-wrap: wrap;

				a {
					line-height: 30px;
				}
			}
		}

		@media (max-width: 980px) {
			padding: 13px 4px;
		}

		@media (max-width: 960px) {
			padding: 13px;
		}

		@media (max-width: 856px) {
			padding: 13px 2px;
		}

		@media (max-width: 799px) {
			padding: 13px;
		}

		@media (max-width: 436px) {
			flex-direction: column;
			align-items: normal;

			select {
				width: 100%;
				margin: 0 0 10px;
			}

			.wp-mail-smtp-dash-widget-select-timespan {
				width: calc( 100% - 38px );
			}
		}

		a {
			vertical-align: middle;

			@media (max-width: 1150px) {
				display: none;
			}

			@media (min-width: 1500px) and (max-width: 1630px) {
				display:none;
			}

			@media (min-width: 1801px) and (max-width: 2080px) {
				display:none;
			}
		}

		.wp-mail-smtp-dash-widget-select-email-type {
			margin-right: 6px;

			@media (max-width: 830px) {
				margin-right: 2px;
			}

			@media (max-width: 436px) {
				margin-right: 0;
			}
		}

		.wp-mail-smtp-dash-widget-settings-container {
			display: inline-block;
			position: relative;
			vertical-align: top;
			margin-left: 6px;

			@media (max-width: 830px) {
				margin-left: 2px;
			}

			@media (max-width: 799px) {
				margin-left: 6px;
			}
		}

		.wp-mail-smtp-dash-widget-settings-button {
			background: #fafafa;
			color: #787c82;
			border-color: #787c82;
			padding: 1px 6px 0;
			margin-bottom: 0;
			line-height: 1;
			display: flex;
			align-items: center;
			justify-content: center;

			&:hover,
			&:active,
			&:focus {
				color: #2271b1;
				border-color: #2271b1;

				svg {
					path {
						fill: #2271b1;
					}
				}
			}

			&.open {
				svg {
					path {
						transform: rotate(90deg);
					}
				}
			}

			svg {
				display: inline-block;
				width: 19px;
				height: 19px;

				@media (max-width: 782px) {
					padding: 5px;
				}

				path {
					fill: #787c82;
					transition: transform 0.2s;
					transform-origin: center center;
				}
			}
		}

		.wp-mail-smtp-dash-widget-settings-menu {
			display: none;
			position: absolute;
			background-color: #ffffff;
			width: 160px;
			border-radius: 3px;
			box-shadow: 0px 5px 15px rgba(0, 0, 0, 0.15);
			padding: 10px;
			z-index: 9999;
			right: 0;
			top: 50px;

			@media (min-width: 800px) {
				top: 40px;
			}

			&--style,
			&--color {
				border-bottom: 1px solid #eeeeee;

				h4 {
					text-transform: uppercase !important;
					color: #3c434a !important;
					font-size: 11px !important;
					font-weight: 500 !important;
					line-height: 13px !important;
					margin: 0 0 10px !important;
				}

				.wp-mail-smtp-dash-widget-settings-menu-item {
					display: flex;
					align-items: center;
					color: #3c434a;
					font-size: 13px;
					line-height: 16px;
					margin: 0 0 13px;

					&:last-child {
						margin: 0 0 10px;
					}

					input[type="radio"] {
						margin-right: 5px;
					}

					label {
						vertical-align: top;
						margin-top: -3px;
					}
				}
			}

			&--color {
				margin-top: 10px;
			}

			&-save {
				margin-top: 10px;
			}
		}
	}

	.wp-mail-smtp-dash-widget-email-stats-block {
		margin-top: 0;

		table {
			width: calc(100% + 24px);
			margin: 0 -12px;

			.wp-mail-smtp-dash-widget-email-stats-table-cell {
				padding: 10px 12px;
				border-right: 1px solid #eeeeee;
				border-top: 1px solid #eeeeee;
				color: #3c434a;
				font-size: 14px;
				width: 50%;
				line-height: 17px;

				@media (max-width: 436px) {
					display: block;
					width: 100%;
				}

				&--2 {
					&:not(:first-child) {
						border-right: none;
					}
				}

				&--3 {
					width: 33.33%;

					@media (max-width: 436px) {
						width: 100%;
					}

					&:last-child {
						border-right: none;
					}
				}

				&-container {
					display: flex;
					align-items: center;

					img {
						width: 16px;
						margin-right: 10px;
					}
				}
			}
		}

		.wp-mail-smtp-dash-widget-overlay {
			background-position-y: 50%;
		}
	}

	.wp-mail-smtp-dash-widget-recommended-plugin-block {
		display: flex;
		padding: 12px 7px 12px 12px;
		border-top: 1px solid #eeeeee;
		color: #787c82;
		font-size: 13px;
		line-height: 16px;

		b {
			color: #3c434a;
		}

		.sep {
			display: inline-block;
			margin: 0 3px;
			color: #dddddd;
		}

		.sep-vertical {
			color: #dddddd;
		}

		p {
			margin: 0;
		}

		.wp-mail-smtp-dash-widget-recommended-plugin {
			display: inline-block;
			width: calc( 100% - 24px );

			span {
				display: inline-block;
			}
		}

		.wp-mail-smtp-dash-widget-dismiss-recommended-plugin-block {
			display: inline-block;
			border: 0;
			color: grey;
			opacity: 0.3;
			vertical-align: baseline;
			cursor: pointer;
			background: none;
			padding: 0 2px;

			&:hover {
				opacity: 1;
			}

			.dashicons {
				font-size: 16px;
				height: 16px;
				width: 16px;
			}
		}
	}

	.wp-mail-smtp-dash-widget-email-alerts-education {
		align-items: center;
		border-left: 4px solid #D63638;
		border-top: 1px solid #eee;
		display: flex;
		gap: 10px;
		margin-top: 0;
		padding: 10px;

		&-error-icon {
			display: flex;
			height: 44px;
			width: 40px;

			img {
				height: 35px;
				width: 35px;
				margin: auto;
			}
		}

		&-content {
			padding-right: 14px;

			p {
				color: #1D2327;
				font-size: 14px;
				line-height: 20px;

				a {
					color: #2271B1;
					font-weight: 500;
				}

				strong {
					font-weight: 500;
				}
			}
		}

		.wp-mail-smtp-dash-widget-dismiss-email-alert-block {
			background: none;
			border: 0;
			cursor: pointer;
			position: absolute;
			right: 6px;
			top: 10px;

			.dashicons {
				color: #A0A5AA;
				font-size: 16px;
				height: 17px;
				width: 16px;
			}
		}
	}

	.wp-mail-smtp-error {
		text-align: center;
	}

	.wp-mail-smtp-dash-widget-chart-upgrade,
	.wp-mail-smtp-error-no-data-chart {
		position: absolute;
		left: 0;
		top: 0;
		height: 100%;
		width: 100%;
		overflow: hidden;
		-webkit-box-sizing: border-box;
		-moz-box-sizing: border-box;
		box-sizing: border-box;
		background: rgba(255, 255, 255, 0);
		background: -moz-radial-gradient(center, ellipse cover, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 100%);
		background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%, rgba(255, 255, 255, 0)), color-stop(100%, rgba(255, 255, 255, 1)));
		background: -webkit-radial-gradient(center, ellipse cover, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 100%);
		background: -o-radial-gradient(center, ellipse cover, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 100%);
		background: -ms-radial-gradient(center, ellipse cover, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 100%);
		background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 100%);

		.wp-mail-smtp-dash-widget-modal {
			position: absolute;
			top: calc(50% - 2em);
			left: 50%;
			transform: translate(-50%, -50%);
			padding: 1.5em 2em 2em 2em;
			box-shadow: 0 0 25px 10px rgba(0, 0, 0, 0.08);
			border-radius: 3px;
			background-color: #fff;
			text-align: center;
			width: 20em;

			h2 {
				padding: 0;
				margin-bottom: 5px;
				font-size: 18px;
			}

			p {
				line-height: 1.3;
			}
		}
	}

	.wp-mail-smtp-error-no-data-email-stats {
		padding-top: 16px;
		padding-bottom: 16px;
	}

	.wp-mail-smtp-dash-widget-block-logs-disabled {
		padding: 21px 25px 30px;
		text-align: center;

		.wp-mail-smtp-dash-widget-block-logo {
			width: 75px;
		}

		h2 {
			font-size: 16px;
			line-height: 20px;
			font-weight: 500;
			padding: 10px 0 0;
		}

		p {
			font-size: 14px;
			line-height: 20px;
			margin: 7px 0 19px;
		}

		a.button:first-of-type:not(:only-of-type) {
			margin-right: 10px;
		}
	}

	.wp-mail-smtp-dash-widget-overlay {
		width: 100%;
		position: absolute;
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
		background: url(../images/wp-spinner.gif) no-repeat center calc(50% - 12px);
		background-color: white;
		z-index: 10;
	}

	i.wp-mail-smtp-dash-widget-loader {
		background-image: url(../images/wp-spinner.gif);
		background-repeat: no-repeat;
		background-position: center;
		background-size: cover;
	}

	.hidden {
		display: none !important;
	}
}

// Lite specific styles.
#wp_mail_smtp_reports_widget_lite {
	.wp-mail-smtp-dash-widget {
		&-chart-block-container {
			#wp-mail-smtp-dash-widget-chart {
				opacity: 0.35;
			}
		}

		&-chart-upgrade {
			background: none;
			display: flex;
			align-items: center;
			justify-content: center;

			h2 {
				font-size: 20px;
				line-height: 20px;
				font-weight: 500;
				color: #3c434a;
				margin-bottom: 15px;
			}

			p {
				font-size: 14px;
				line-height: 18px;
				color: #787c82;
				margin-bottom: 15px;

				&:last-child {
					margin-bottom: 0;
				}
			}

			a.button.button-hero {
				font-weight: 500;
				font-size: 14px;
				line-height: 20px;
				padding: 9px 15px;
				min-height: 40px;
			}

			.wp-mail-smtp-dash-widget-modal {
				position: relative;
				top: inherit;
				left: inherit;
				transform: none;
				width: 24em;
				padding: 2.3em;
				box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
				border-radius: 6px;
			}
		}

		&-dismiss-chart-upgrade {
			position: absolute;
			width: 16px;
			height: 17px;
			right: 5px;
			top: 5px;
			color: #a0a5aa;
			text-decoration: none;

			.dashicons {
				width: 16px;
				height: 17px;
				font-style: normal;
				font-weight: normal;
				font-size: 16px;
				line-height: 17px;
			}
		}

		&-settings-menu {
			input[type=radio]:checked::before {
				background-color: #a0a5aa;
			}
		}

		&-settings-menu * {
			cursor: not-allowed;
		}

		&-summary-report-email-block {
			margin-top: 0;
			padding-top: 10px;
			padding-bottom: 10px;
			border-top: 1px solid #eeeeee;
			font-size: 13px;
			line-height: 16px;

			& > div {
				padding: 10px;
				border-radius: 4px;
				background: #F0F6FC;
			}

			&-setting {
				display: flex;
				align-items: center;

				label {
					display: flex;
					margin: 0 10px 0 0;
					color: #3C434A;

					input, i {
						margin: 0 10px 0 0;
					}

					i {
						display: none;
						width: 16px;
						height: 16px;
					}

					b {
						font-weight: 500;
					}
				}

				a {
					white-space: nowrap;
					margin-right: 10px;
				}

				.dashicons-dismiss {
					margin-left: auto;
					width: 16px;
					height: 16px;
					font-size: 16px;
					color: #A0A5AA;
					cursor: pointer;

					&:hover {
						color: #2271b1;
					}
				}
			}

			&-applied {
				display: flex;

				.wp-mail-smtp-dashicons-yes-alt-green {
					margin-right: 10px;
					width: 16px;
					height: 16px;
					background-image: url('../images/dash-widget/yes-green.svg');
				}
			}
		}

		&-upgrade-footer {
			padding: 12px;
			margin-top: 0;
			border-top: 1px solid #eeeeee;

			p {
				font-size: 13px;
				line-height: 16px;
			}

			&--hide {
				display: none;
			}
		}
	}
}
