@use "sass:color";
@use "../../scss/layout";
@use "../../scss/variables/colors";
@use "../../scss/typography";

@mixin banner-color( $color ) {

	.dops-banner__icon {
		color: $color;
	}

	.dops-banner__icon-circle {
		background-color: $color;
	}

	.dops-banner__icon-wp {
		fill: $color;
	}
}

.dops-banner.dops-card {
	display: flex;
	padding: 12px 6px 12px 12px;
	position: relative;
	z-index: 2;

	&.is-card-link {
		padding: 12px 48px 12px 16px;
	}

	&.is-dismissible {
		padding-right: 48px;
	}

	@include banner-color( colors.$blue-wordpress );

	&.is-jetpack-info {

		@include banner-color( colors.$green-primary );
	}

	&.is-product {

		@include banner-color( colors.$color-product );
	}

	&.is-plan {

		@include banner-color( colors.$color-plan );

		&.is-upgrade-personal {

			@include banner-color( colors.$alert-yellow );
		}

		&.is-upgrade-premium {

			@include banner-color( colors.$alert-green );
		}

		&.is-upgrade-business {

			@include banner-color( colors.$alert-purple );
		}

		&.is-bundle {

			@include banner-color( colors.$color-bundle );
		}

		&.is-jetpack-warning {

			@include banner-color( colors.$alert-yellow );
		}
	}

	.dops-card__link-indicator {
		align-items: center;
		color: colors.$blue-wordpress;
		display: flex;
	}

	&:hover {
		transition: all 100ms ease-in-out;

		&.is-card-link {
			box-shadow: 0 0 0 1px colors.$gray, 0 2px 4px color.adjust(colors.$gray, $lightness: 20%);
		}

		.dops-card__link-indicator {
			color: colors.$blue-dark;
		}
	}

	@include layout.breakpoint( ">480px" ) {
		padding: 16px;

		&.is-dismissible {
			padding-right: 16px;
		}
	}
}

.dops-banner__icons {
	display: flex;

	.dops-banner__icon,
	.dops-banner__icon-circle {
		border-radius: 50%;
		flex-shrink: 0;
		height: 24px;
		margin-right: 16px;
		margin-top: -2px;
		text-align: center;
		top: 4px;
		width: 24px;
	}

	.dops-banner__icon {
		align-self: center;
		color: colors.$white;
		display: block;
	}

	.dops-banner__icon-circle {
		color: #fff;
		display: none;
		padding: 3px 4px 4px 3px;
	}

	.dops-banner__icon-circle-svg {
		transform: translate(1px, 4px);
	}

	@include layout.breakpoint( ">480px" ) {
		align-items: center;

		.dops-banner__icon {
			display: none;
		}

		.dops-banner__icon-circle {
			display: block;
		}
	}
}

.dops-banner__icon-plan {
	display: flex;
	margin-right: 16px;

	.dops-plan-icon {
		height: 32px;
		width: 32px;
	}

	@include layout.breakpoint( ">480px" ) {
		align-items: center;
		align-self: center;
	}
}

.dops-banner__icon-wp {
	margin-right: 16px;
	width: 22px;
	height: 22px;
}

.dops-banner__content {
	align-items: center;
	display: flex;
	flex-grow: 1;
	flex-wrap: wrap;

	@include layout.breakpoint( ">480px" ) {
		flex-wrap: nowrap;
	}
}

.dops-banner__info {
	flex-grow: 1;
	line-height: 1.4;
	width: 100%;

	.dops-banner__title,
	.dops-banner__description,
	.dops-banner__list {
		color: colors.$gray-dark;
	}

	.dops-banner__title {
		font-size: typography.$font-body-small;
	}

	.dops-banner__description {
		font-size: typography.$font-body-extra-small;
		margin-top: 3px;

		.jp-link-button {

			&,
			&:active,
			&:visited,
			&:hover,
			&:focus {
				font-size: typography.$font-body-extra-small;
				line-height: 1.4;
				box-shadow: none;
				background: none;
			}
		}
	}

	.dops-banner__list {
		font-size: typography.$font-body-extra-small;
		list-style: none;
		margin: 0;

		li {
			margin: 6px 0;

			.gridicon {
				color: colors.$gray;
				display: none;
			}
		}
	}

	@include layout.breakpoint( ">480px" ) {
		width: auto;

		.dops-banner__list li .gridicon {
			display: inline;
			margin-right: 12px;
			vertical-align: bottom;
		}
	}
}

.dops-banner__action {
	align-self: center;
	font-size: typography.$font-body-extra-small;
	margin: 8px 0 0 8px;
	text-align: left;
	width: 100%;

	.dops-banner__prices {
		display: flex;
		justify-content: flex-start;

		.dops-plan-price {
			margin-bottom: 0;
		}

		.dops-plan-price.is-discounted,
		.dops-plan-price.is-discounted .dops-plan-price__currency-symbol {
			color: colors.$gray-dark;
		}

		.has-call-to-action & .dops-plan-price {
			margin-bottom: 8px;
		}
	}

	@include layout.breakpoint( ">480px" ) {
		margin: 0 4px 0 8px;
		text-align: center;
		width: auto;

		.is-dismissible & {
			margin-top: 40px;
		}

		.dops-banner__prices {
			justify-content: flex-end;
			text-align: right;
		}
	}
}
