@import "@automattic/typography/styles/variables";
@import "@automattic/onboarding/styles/mixins";
@import "@wordpress/base-styles/breakpoints";
@import "@wordpress/base-styles/mixins";

.videos-ui {
	background: #101517;
	color: #fff;
	display: flex;
	flex-direction: column;

	a,
	a:visited {
		color: #fff;
	}

	.calypso-notice {
		background-color: #2d3338;
		border-radius: 4px;
		.calypso-notice__icon-wrapper {
			background: none;
		}
		.calypso-notice__dismiss {
			display: flex;
			align-items: center;

			svg {
				width: 15px;
				height: 15px;
			}
		}
	}

	.videos-ui__header {
		background: #151b1e;
		border-bottom: 1px solid rgba(255, 255, 255, 0.1);
		padding: 0 20px;

		.videos-ui__header-content {
			display: flex;
			flex-direction: column;
			padding: 20px 0 30px;
			padding-top: 21px;

			ul {
				margin: 38px 0 0;
			}

			li {
				list-style: none;
				margin-bottom: 10px;
				font-size: $font-body-small;
			}

			h2 {
				@include onboarding-font-recoleta;
				font-size: $font-headline-small;
				letter-spacing: 0;
				line-height: 1.1;

				&:first-child {
					color: rgba(255, 255, 255, 0.5);
				}
			}

			.videos-ui__summary {
				padding-left: 2.55px;

				svg {
					flex-basis: 18px;
					flex-grow: 0;
					flex-shrink: 0;
					padding-right: 16px;
					fill: rgba(255, 255, 255, 0.6);
					vertical-align: text-bottom;
				}

				li {
					color: rgba(255, 255, 255, 0.88);
					display: flex;
				}
			}
		}
	}

	.videos-ui__body {

		&.is-loading {
			width: 100%;
			padding-left: 0;
			padding-right: 0;
			.videos-ui__body-title,
			.videos-ui__video-placeholder,
			.videos-ui__chapters {
				@include placeholder( --color-neutral-60 );
				* {
					visibility: hidden;
				}
			}
			.videos-ui__body-title {
				height: 1.5rem;
				margin-bottom: 24px;
				margin-right: 20px;
				margin-left: 20px;
			}

			.videos-ui__video-placeholder,
			.videos-ui__chapters {
				height: 500px;
				margin: 0 20px 20px;
			}
		}

		max-width: 1280px;
		padding: 64px 20px 97px;

		h3 {
			font-size: $font-title-medium;
			margin-bottom: 24px;
		}

		.videos-ui__video-content {
			display: flex;
			flex-direction: column;
		}

		.videos-ui__video {
			margin-bottom: 30px;
			flex-basis: auto;
			width: 100%;

			video {
				width: 100%;
				height: auto;
			}

			.videos-ui__resource-links {
				ul {
					margin: 0;

					li {
						list-style: none;
						margin-bottom: 8px;
					}
				}
			}
		}

		.videos-ui__chapters {
			font-size: $font-body-small;

			.videos-ui__chapter {
				background: #1d262a;
				border-bottom: 1px solid #343c3f;

				&:first-child {
					border-radius: 4px 4px 0 0;
				}

				&:last-child {
					border-bottom: none;
					border-radius: 0 0 4px 4px;
				}

				.videos-ui__duration {
					color: rgba(255, 255, 255, 0.5);
					display: inline-block;
					flex-basis: 34px;
					margin-right: 10px;
				}

				.videos-ui__completed-checkmark {
					text-align: center;
					background-color: #00a32a;
					margin-left: auto;
					flex-basis: 22px;
					flex-shrink: 0;
					flex-grow: 0;
					height: 22px;
					border-radius: 50%;

					svg {
						margin-top: 5px;
					}
				}

				.videos-ui__status-icon {
					text-align: center;
					margin-left: auto;
					flex-shrink: 0;
					flex-basis: 22px;

					svg {
						vertical-align: middle;
					}
				}

				.videos-ui__video-title {
					margin-right: 10px;
					display: -webkit-box;
					-webkit-line-clamp: 2;
					-webkit-box-orient: vertical;
					overflow: hidden;
				}

				.videos-ui__chapter-accordion-toggle {
					color: #fff;
					cursor: pointer;
					display: flex;
					width: 100%;
					text-align: left;
					line-height: 22px;
					padding: 13px 20px;
				}

				&:not(.preload) .videos-ui__active-video-content {
					overflow: hidden;
					max-height: 0;
					transition: max-height 0.2s ease-out;

					div {
						padding: 20px;
						padding-top: 12px;
						overflow-y: auto;
						p {
							color: rgba(255, 255, 255, 0.72);
						}
					}
				}

				&.selected:not(.preload) .videos-ui__active-video-content {
					max-height: 250px;
				}

				.videos-ui__button {
					width: 100%;
				}
			}
		}
	}

	.videos-ui__button:hover {
		opacity: 0.8;
	}

	.videos-ui__button,
	.videos-ui__button:visited {
		border: 0;
		border-radius: 4px;
		color: #101517;
		padding: 10px 28px;
		span {
			font-weight: 400;
			color: #101517;
			display: inline-block;
			vertical-align: middle;
		}

		svg {
			padding-right: 10px;
			vertical-align: middle;
		}

		&.videos-ui__video-completed {
			background-color: #263135;
			span {
				color: rgba(255, 255, 255, 0.5);
			}

			svg {
				opacity: 0.5;
				path {
					fill: #fff;
					stroke: #fff;
				}
			}
		}
	}

	.videos-ui__bar {
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		font-size: $font-body-small;
		min-height: 64px;

		div,
		a {
			display: flex;
			align-items: center;
		}

		.videos-ui__back-button {
			color: #fff;
		}

		* {
			line-height: 20px;
		}
	}

	.videos-ui__footer-bar {
		padding: 0 20px;
		background-color: #101517;
		border-top: 1px solid rgba(255, 255, 255, 0.1);
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
	}

	@include break-small {
		.videos-ui__button {
			max-width: 300px;
		}

		.videos-ui__bar {
			min-height: 72px;
		}
	}

	@include break-medium {
		.videos-ui__header {
			.videos-ui__header-content {
				margin: auto;
				flex-direction: row;
				justify-content: space-between;
				padding: 60px 0;

				.videos-ui__titles {
					flex-basis: auto;
				}

				.videos-ui__summary {
					flex: 0 0 360px;
				}

				ul {
					margin: 0;
				}
			}
		}
	}

	@include break-xlarge {
		.calypso-notice {
			max-width: 1160px;
			margin: auto;
		}
		.videos-ui__header {
			.videos-ui__header-content {
				max-width: 1160px;

				.videos-ui__titles {
					h2 {
						font-size: $font-headline-medium;
						height: 60px;
					}
				}

				.videos-ui__summary {
					flex-basis: auto;
					width: 31%;
				}
			}
		}

		.videos-ui__body {
			margin: 0 auto;
			max-width: 1160px;
			padding: 0 20px 80px;
			width: 100%;
			h3 {
				margin: 80px 0 20px;
			}

			.videos-ui__body-title {
				max-width: 1160px;
			}

			.videos-ui__video-content {
				max-width: 1160px;
				flex-direction: row;
				justify-content: space-between;

				.videos-ui__video {
					flex-basis: auto;
					width: 65.5%;
				}

				.videos-ui__chapters {
					flex-basis: auto;
					width: 31%;
				}
			}

			&.is-loading {

				.videos-ui__body-title {
					margin-right: 0;
					margin-left: 0;
				}

				.videos-ui__video-placeholder,
				.videos-ui__chapters {
					margin: 0 0 20px;
					flex: 0 0 360px;
				}

				.videos-ui__video-placeholder {
					margin-right: 20px;
					flex-grow: 1;
					width: 100%;
				}

			}
		}

		.videos-ui__button {
			max-width: inherit;
		}
	}
}

.blank-canvas .videos-ui {
	min-height: 100vh;
}

.videos-ui__modal {
	.blank-canvas__content {
		padding: 0;
	}
}
