$contractor-profile-gutter: 23px;

.cp-v2 {
	color: $color-charcoal6;
	font-size: 14px;
	line-height: 21px;
	padding: 0 $contractor-profile-gutter;

	ul,
	p {
		margin-bottom: 15px;
	}

	.profile-page-nav {
		border-bottom: 1px solid $color-charcoal1;
		box-shadow: none;
		font-size: 14px;
		line-height: 18px;
		margin-left: -$contractor-profile-gutter;
		margin-right: -$contractor-profile-gutter;
		margin-top: $contractor-profile-gutter;
		text-transform: none;

		&__tabs {
			display: flex;
			margin: 0;
		}

		&__tab {
			flex: 1;
			max-width: 100%;
		}

		&__link {
			padding: 5px 15px;
		}
	}

	&__section {
		padding: 15px 0;
	}

	&__section-subtitle {
		border-bottom: 1px solid $color-charcoal1;
		font-size: 24px;
		line-height: 30px;
		margin: 24px 0;
		padding: 0 0 10px;

		&--photos {
			border-bottom: 0;
			margin-bottom: 17px;
			padding-bottom: 0;
		}
	}

	&__section-subtitle-link {
		@include font-primary-medium;
		bottom: -5px;
		float: right;
		font-size: 13px;
		line-height: 16px;
		position: relative;
	}

	.open-hours {
		color: inherit;
		margin-left: 26px;
		max-width: 330px;

		dt,
		dd {
			margin-bottom: 12px;
		}

		dt {
			@include font-primary-semi-bold;
			color: $color-charcoal4;
			width: 90px;
		}

		dd {
			margin-left: 90px;
			text-align: right;
		}
	}

	.contractor-icons-list {
		color: inherit;
	}

	hr {
		border-bottom: 1px solid $color-charcoal1;
		border-top: 0;
		margin: $contractor-profile-gutter 0;
	}
}

.cp-v2-hero {
	background: $color-charcoal3;
	height: 117px;
	margin-left: -$contractor-profile-gutter;
	margin-right: -$contractor-profile-gutter;
	overflow: hidden;
	position: relative;

	&__back-btn {
		background-color: rgba($color-charcoal5, .75);
		border-radius: 50%;
		left: 22px;
		line-height: 1;
		padding: 6px 8px 6px 5px;
		position: absolute;
		top: 15px;
		z-index: 2;

		&,
		&:hover,
		&:focus,
		&:active {
			color: $color-white;
		}
	}

	&__img {
		height: 100%;
		object-fit: cover;
		object-position: 50% 50%;
		width: 100%;
	}

	&--no-image {
		background: linear-gradient(121.76deg, $color-blue3 4.51%, $color-blue6 95.1%);
		height: 70px;
	}
}

.cp-v2-company {
	margin-top: -40px;
	position: relative;
	z-index: 2;

	&__logo {
		background: $color-white;
		border: 1px solid $color-charcoal1;
		border-radius: 4px;
		display: block;
		font-size: 0;
		height: 78px;
		line-height: 78px;
		margin: 0 0 8px;
		overflow: hidden;
		text-align: center;
		width: 78px;

		img {
			display: inline-block;
			max-height: 100%;
			max-width: 100%;
			vertical-align: middle;
		}
	}

	&__name {
		@include font-primary-semi-bold;
		font-size: 18px;
		line-height: 22px;
		margin: 0 0 4px;
		padding: 0;
	}

	&__rating {
		font-size: 0;

		a {
			display: inline-block;
			vertical-align: middle;

			& + a {
				margin-left: 6px;
			}
		}

		.star-rating {
			margin-left: 11px;

			&__label {
				&--verified {
					color: $color-charcoal5 !important;
				}
			}
		}
	}
}

.open-hours-copy {
	@include font-primary-semi-bold;
	font-size: 14px;
	line-height: 16px;
	margin: 0 0 4px;
	padding-left: 26px;
	position: relative;

	&::before {
		@include icon-stroke;
		content: '\e914';
		left: 2px;
		position: absolute;
		top: 1px;
	}
}

.cp-v2-photos {
	-ms-overflow-style: none; // sass-lint:disable-line no-vendor-prefixes
	margin-left: -$contractor-profile-gutter;
	margin-right: -$contractor-profile-gutter;
	overflow-y: hidden;
	overflow-x: scroll;
	scrollbar-width: none;

	&::-webkit-scrollbar { // sass-lint:disable-line no-vendor-prefixes
		display: none;
	}

	&__list {
		font-size: 0;
		list-style: none;
		margin: 0;
		padding: 0;
		white-space: nowrap;
	}

	&__item {
		background: $color-charcoal3;
		border-radius: 2px;
		display: inline-block;
		height: 146px;
		margin: 0 4px;
		overflow: hidden;
		width: 146px;

		&:first-child {
			margin-left: $contractor-profile-gutter;
		}

		&:last-child {
			margin-right: $contractor-profile-gutter;
		}
	}

	&__img {
		cursor: pointer;
		height: 100%;
		object-fit: cover;
		width: 100%;
	}
}

.promotions-v2-list {
	list-style: none;
	padding: 0;

	li {
		margin: 0 0 $contractor-profile-gutter;

		& + li {
			border-top: 1px solid $color-charcoal1;
			padding-top: $contractor-profile-gutter;
		}
	}
}

.promotion-v2 {
	color: $color-charcoal4;

	&__subtitle,
	&__terms-title {
		color: $color-charcoal5;
	}

	&__title {
		@include font-primary-semi-bold;
		color: $color-green5;
		font-size: 16px;
		line-height: 19px;
		padding-left: 25px;
		position: relative;

		i {
			left: 0;
			margin-right: 5px;
			position: absolute;
			top: 3px;
		}
	}

	&__trades {
		margin-bottom: 16px;
		padding-left: 25px;
	}

	&__subtitle {
		@include font-primary-semi-bold;
	}

	&__terms-title {
		@include font-primary-semi-bold;
		font-size: 13px;
		line-height: 21px;
	}

	&__trades,
	&__details--terms {
		font-size: 14px;
		line-height: 18px;
	}
}

.cp-v2-reviews-section {
	margin-left: -$contractor-profile-gutter;
	margin-right: -$contractor-profile-gutter;
	padding-left: $contractor-profile-gutter;
	padding-right: $contractor-profile-gutter;

	& + & {
		border-top: 1px solid $color-charcoal1;
		padding-top: $contractor-profile-gutter;
	}

	&__title {
		@include font-primary-semi-bold;
		font-size: 14px;
		line-height: 18px;
		margin: 0 0 16px;
	}

	&__footer {
		border-top: 1px solid $color-charcoal1;
		margin-left: -$contractor-profile-gutter;
		margin-right: -$contractor-profile-gutter;
		padding-bottom: 0;
		padding-left: $contractor-profile-gutter;
		padding-right: $contractor-profile-gutter;
		padding-top: 15px;
		text-align: center;
	}

	&__more-btn {
		@include font-primary-medium;
		border: 0;
		border-radius: 0;
		display: inline-block;
		font-size: 16px;
		letter-spacing: 0;
		line-height: 19px;
		margin: 0;
		padding: 0;
		text-transform: none;
	}

	.reviews-block {
		&__header {
			font-size: 12px;
			line-height: 15px;
			margin-left: -$contractor-profile-gutter;
			margin-right: -$contractor-profile-gutter;
			padding-left: $contractor-profile-gutter;
			padding-right: $contractor-profile-gutter;

			&-right {
				i {
					top: 50%;
					transform: translateY(-50%);
				}
			}
		}

		&__dropdown {
			position: relative;
		}
	}

	.review-item {
		margin-left: -$contractor-profile-gutter;
		margin-right: -$contractor-profile-gutter;
		padding-bottom: 25px;
		padding-left: $contractor-profile-gutter;
		padding-right: $contractor-profile-gutter;
		position: relative;

		& + .review-item {
			border-top: 1px solid $color-charcoal1;
			margin-top: 0;
			padding-top: 25px;
		}

		&__by,
		&__project,
		&__rating {
			margin-right: 50px;
		}

		&__project {
			@include font-primary-medium;
			color: $color-charcoal3;
			font-size: 12px;
			line-height: 14px;
			margin-top: 2px;
		}

		&__rating {
			margin-top: 8px;
		}

		&__photos-wrapper {
			-ms-overflow-style: none; // sass-lint:disable-line no-vendor-prefixes
			margin-left: -$contractor-profile-gutter;
			margin-right: -$contractor-profile-gutter;
			margin-top: 10px;
			overflow: auto;

			&::-webkit-scrollbar { // sass-lint:disable-line no-vendor-prefixes
				display: none;
			}
		}

		&__photos {
			display: block;
			font-size: 0;
			height: 75px;
			list-style: none;
			margin: 0;
			overflow: visible;
			padding: 0;
			white-space: nowrap;
			width: auto;
			overflow-y: hidden;
			overflow-x: scroll;
			scrollbar-width: none;

			&::-webkit-scrollbar { // sass-lint:disable-line no-vendor-prefixes
				display: none;
			}
		}

		&__photo {
			display: inline-block;
			float: none;
			margin-bottom: 0;
			overflow: hidden;

			&:first-child {
				margin-left: $contractor-profile-gutter;
			}

			&:last-child {
				margin-right: $contractor-profile-gutter;
			}
		}

		&__meta {
			@include font-primary-regular;
			color: $color-charcoal3;
			font-size: 13px;
			line-height: 16px;
			margin-top: 10px;
		}

		&--google,
		&--modernize {
			&::before {
				background-position: top right;
				background-repeat: no-repeat;
				background-size: contain;
				content: '';
				display: block;
				height: 25px;
				float: right;
				width: 35px;
			}
		}

		&--google {
			&::before {
				background-image: url('#{$rating-icons-folder}/google.svg');
			}
		}

		&--modernize {
			&::before {
				background-image: url('#{$rating-icons-folder}/modernize.svg');
			}
		}
	}
}

.cp-v2-reviews-details {
	@include font-primary-semi-bold;
	font-size: 14px;
	line-height: 18px;
	margin: 0;
	overflow: hidden;
	padding: 0;

	dt {
		float: left;
		width: 70%;
	}

	dd {
		float: left;
		margin: 0;
		text-align: right;
		width: 30%;
	}

	dt,
	dd {
		margin-bottom: 16px;
	}

	.star-rating {
		&__stars {
			margin-right: 0;
		}
	}
}

.cp-v2-reviews-tags-list {
	list-style: none;
	margin: 0;
	padding: 0;

	li {
		display: inline-block;
		margin: 0 10px 8px 0;
	}
}

.cp-v2-review-tag-btn {
	@include font-primary-semi-bold;
	appearance: none;
	background: transparent;
	border: 1px solid $color-blue5;
	border-radius: 20px;
	color: $color-blue5;
	cursor: pointer;
	display: inline-block;
	font-size: 11px;
	line-height: 14px;
	padding: 8px 17px 9px;
	transition: background-color $trans-time $trans-func;
	white-space: nowrap;

	&:disabled {
		cursor: not-allowed;
		opacity: .35;
	}

	&:not(:disabled) {
		&:hover,
		&:focus,
		&:active {
			background: $color-blue5;
			color: $color-white;
		}
	}

	&--active {
		background: $color-blue5;
		color: $color-white;
	}
}

/**
 * Mobile styles
 * We have to do this cause original CSS is desktop first
 */
@include breakpoint-phone {
	.cp-v2 {
		.open-hours {
			font-size: 13px;
			line-height: 16px;
			max-width: 250px;
		}

		.review-item {
			&__text {
				font-size: 13px;
				line-height: 21px;
			}
		}
	}

	.cp-v2-company {
		.ext-rating-icon {
			border-color: $color-charcoal2;
			font-size: 12px;
			line-height: 15px;
			padding: 3px 9px 3px 23px;

			&--google {
				background-position: 4px 50%;
			}

			&--bbb {
				background-position: 5px 50%;
				background-size: auto 16px;
			}
		}

		a {
			&.ext-rating-icon {
				&:hover,
				&:focus,
				&:active {
					border-color: $color-charcoal3;
				}
			}
		}

		.star-rating {
			display: inline-block;
			line-height: 12px;
			margin-top: -2px;
			position: relative;
			vertical-align: middle;

			&__stars {
				height: 12px;
				line-height: 12px;

				&::before,
				&::after {
					font-size: 12px;
					height: 12px;
					letter-spacing: 4px;
					line-height: 12px;
				}

				&::before {
					color: $color-orange1;
				}

				&--05 {
					&::after {
						width: 8%;
					}
				}

				&--15 {
					&::after {
						width: 28%;
					}
				}

				&--25 {
					&::after {
						width: 48%;
					}
				}

				&--35 {
					&::after {
						width: 68%;
					}
				}

				&--45 {
					&::after {
						width: 88%;
					}
				}
			}

			&__label {
				font-size: 11px;
				line-height: 14px;
			}
		}
	}
}

/**
 * Tablet styles
 */
@include breakpoint-sm {
	.cp-v2 {
		.profile-page-nav {
			border: 0;
			box-shadow: 0 2px 4px 0 rgba($color-black, .1);

			&__tabs {
				display: block;
			}

			&__link {
				min-width: 160px;
				padding: 15px;
			}
		}

		&__section {
			padding: 40px 0;
		}

		.star-rating {
			&__stars {
				&::before,
				&::after {
					font-size: 20px;
					letter-spacing: 2px;
				}
			}
		}
	}

	.cp-v2-hero {
		height: 220px;

		&--no-image {
			height: 100px;
		}
	}

	.cp-v2-company {
		margin-top: -45px;
		min-height: 165px;
		padding-left: 195px;
		padding-top: 80px;
		position: relative;

		&__logo {
			border: 0;
			box-shadow: 0 8px 16px 0 rgba($color-black, .1);
			height: 165px;
			left: 0;
			line-height: 165px;
			position: absolute;
			top: 0;
			width: 165px;
		}

		&__name {
			font-size: 36px;
			line-height: 44px;
			margin-bottom: 12px;
		}
	}

	.open-hours-copy {
		font-size: 18px;
		line-height: 25px;

		&::before {
			font-size: 18px;
			top: 2px;
		}
	}

	.cp-v2-photos {
		&__item {
			height: 175px;
			margin: 0 8px;
			width: 175px;
		}
	}

	.promotion-v2 {
		font-size: 16px;
		line-height: 26px;

		&__title {
			font-size: 18px;
			line-height: 25px;
		}

		&__subtitle {
			font-size: 16px;
			line-height: 21px;
		}
	}

	.cp-v2-reviews-section {
		margin-left: 0;
		margin-right: 0;
		padding-left: 0;
		padding-right: 0;

		&__title {
			font-size: 22px;
			line-height: 29px;
		}

		&__footer {
			margin-left: 0;
			margin-right: 0;
		}

		.reviews-block {
			&__header {
				font-size: 14px;
				line-height: 26px;

				margin-left: 0;
				margin-right: 0;
				padding-left: 0;
				padding-right: 0;
			}
		}

		.review-item {
			margin-left: 0;
			margin-right: 0;

			&__author {
				font-size: 18px;
				line-height: 25px;
			}

			&__project {
				font-size: 14px;
				letter-spacing: .1px;
				line-height: 18px;
			}

			&__photos-wrapper {
				margin-left: 0;
				margin-right: 0;
			}

			&__photo {
				margin: 0 8px 16px;

				&:first-child {
					margin-left: 0;
				}

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

	.cp-v2-reviews-details {
		max-width: 460px;
	}

	.cp-v2-reviews-details {
		dt {
			font-size: 18px;
			line-height: 24px;
		}
	}
}
