@use "sass:color";
@use "../../scss/functions/rem";
@use "../../scss/calypso-colors";
@use "../../scss/mixins/ui";
@use "../../scss/mixins/breakpoints";
@use "../../scss/mixins/long-content-fade";
@use "../../scss/typography";
@use "../../scss/variables/colors";

.jp-dash-item {

	@include ui.dashboard-card-shadow;

	.dops-section-header__actions {

		.form-toggle__label {
			position: relative;
			right: 0;
		}

		.form-toggle__label-content {
			margin: 0;
		}

		a:hover {
			text-decoration: underline;
		}

		.dops-notice {
			margin-top: rem.convert(-1px);
			margin-bottom: rem.convert(-1px);
		}
	}
}

.jp-dash-item__content {
	flex-grow: 1;
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
}

.jp-dash-item__card {
	margin: 0;
	box-shadow: none;
	padding: rem.convert(18px) rem.convert(24px) rem.convert(16px);
}

.jp-dash-item__count {
	margin: 0;
	color: colors.$black;
	font-weight: 400;
	font-size: typography.$font-headline-small;
	line-height: 40px;
	display: inline-block;
	padding: 0;
	text-align: center;

	@include breakpoints.breakpoint( "<660px" ) {
		font-size: rem.convert(23px);
	}

	+ .jp-dash-item__description {
		flex-basis: 100%;
	}

	&.is-alert {
		color: var(--jp-red-50);
	}
}

.jp-dash-item__title {
	max-width: calc(100% - 18px); // For the support icon

	&.jp-dash-item__title_fullwidth {
		flex-basis: 100%;
	}

	&.jp-dash-item__title_top {
		margin-top: 0;
	}
}

.jp-dash-item__description {
	margin: 0 50px 0 0;
	font-size: rem.convert(14px);
	max-width: calc(100% - 18px); // For the support icon
	color: calypso-colors.$gray-80;
	letter-spacing: -0.02em;
	line-height: 24px;
	font-weight: 400;

	&.jp-dash-item__connect {
		margin-top: 20px;
	}

	.jp-link-button {
		border: none;
		box-shadow: none;
		color: colors.$black;
		font-weight: 400;
		font-size: typography.$font-body-small;
		text-decoration: underline;
		transition-duration: 0.05s;
		transition-property: border, background, color;
		transition-timing-function: ease-in-out;
		background: none;
		padding: 0;

		&:hover {
			text-decoration-thickness: 3px;
		}

		&:focus {
			text-decoration-line: none;
			border-radius: 2px;
			box-shadow: 0 0 0 var(--wp-admin-border-width-focus) #000;
			outline: 3px solid transparent;
		}
	}
}

.jp-dash-item .dops-section-header {
	width: 100%;

	.dops-button {
		font-style: normal;
	}

	&.is-working,
	&.is-premium-inactive {

		.dops-section-header__actions {
			color: colors.$gray-text-min;
		}
	}
}

.jp-dash-item__active-label {
	display: inline-block;
	color: color.adjust(colors.$gray, $lightness: -10%);
	color: colors.$gray;
	font-size: rem.convert(12px);
	font-weight: 400;
	text-transform: uppercase;
}

// conditional styles for content when items are inactive
.jp-dash-item__is-inactive {

	.jp-at-a-glance__left &,
	.jp-at-a-glance__right & {
		border: 1px solid calypso-colors.$gray-5;
		background: #f9f9f6;
		box-shadow: none;

		.dops-card {
			background: none;

			.dops-section-header__label-text::before {
				background: none;
			}
		}

		.dops-banner__content {
			height: 100%;
		}
	}

	.dops-card.dops-banner {
		flex-grow: unset;
	}

	.dops-section-header {
		border-bottom: 0;
	}

	.dops-section-header__label {
		padding-right: rem.convert(8px);
	}

	.dops-section-header__label-text {

		&::before {

			@include long-content-fade.long-content-fade( $size: 8px, $color : colors.$white );
		}
	}
}

.jp-dash-item__disabled {
	opacity: 0.5;
	position: relative;

	&::before {
		content: "";
		width: 100%;
		height: 100%;
		display: block;
		position: absolute;
		top: 0;
		left: 0;
		z-index: 1;
	}
}
