:root {
	--content-width: 1920.0;
	--content-height: 1080.0;
	--content-aspect: calc(var(--content-width) / var(--content-height));

	--margin-h: 12pt;
	--margin-v: 10pt;
	--sidebar-width: 350pt;

	--available-content-width: calc(100vw - var(--margin-h)*2 - var(--sidebar-width));
	--available-content-height: calc(100vh - var(--margin-v)*2);
	--width-fit-height: calc(var(--available-content-width) / var(--content-aspect));
	--height-fit-width: calc(var(--available-content-height) * var(--content-aspect));

	--border-radius: 8pt;
	--shadow-offset: 8pt;
	--shadow-size: 30pt;

	--main-background: #E3E3E3;
	--container-background: #F0F0F0;
	--container-shadow-color: rgba(50,50,70,0.2);
	--video-background: #333;
	--sidebar-background: #FCFCFC;
}

body {
	display: flex;
	margin: var(--margin-v) var(--margin-h);

	background: var(--main-background);
	font-family: "Myriad Pro", "Segoe UI", Verdana;
}

.container {
	display: inline-flex;

	min-height: var(--available-content-height);
	margin: auto;

	border-radius: var(--border-radius);
	background: var(--container-background);
	box-shadow: var(--container-shadow-color) var(--shadow-offset) var(--shadow-offset) var(--shadow-size);
}

.start_tab, .video_tab { display: none; }
.start_tab.open, .video_tab.open { display: flex; }

/* start tab */

.start_tab {
	align-items: center;
	justify-content: center;
	text-align: center;

	height: var(--available-content-height);
	aspect-ratio: var(--content-aspect);

	border-radius: var(--border-radius);
	background: var(--container-background);

	font-size: calc(var(--available-content-height) * 0.06);
	color: #777;
}

.start_tab > span {
	transform: translateY(-10%);
	pointer-events: none;
}

.start_tab.dropping {
	background: #F9F9FF;
	color: #08E;
}

/* main tab */

.video_tab {
	flex-direction: column;
}

.video_main {
	display: inline-flex;
	flex-direction: row;
}

/** video **/

.video {
	display: inline-flex;
	position: relative;

	height: var(--width-fit-height);
	max-height: var(--available-content-height);
	aspect-ratio: var(--content-aspect);
	
	background: var(--video-background);
}

.video, #video {
	border-radius: var(--border-radius);
	border-bottom-right-radius: 0;
	border-top-right-radius: 0;
}

/*** controls ***/

#controls {
	--size: 24px;

	position: absolute;
	top: 0;
	left: 0;

	width: 100%;
	height: 100%;

	border-radius: var(--border-radius);
	border-bottom-right-radius: 0;
	border-top-right-radius: 0;

	background: linear-gradient(to top, rgba(0, 0, 0, 0.68) 0, rgba(0, 0, 0, 0.5) 10pt, rgba(0, 0, 0, 0.25) 20pt, rgba(0, 0, 0, 0.1) 30pt, transparent 50pt);
	font-family: Consolas;
	font-size: 14px;
	color: #FFF;

	opacity: 0;
	transition: opacity 0.5s ease-in-out 1s;
}

#controls:hover, #controls.paused {
	opacity: 1;
	transition: opacity 0.25s ease-in-out;
}

.video.drawing #controls, .video.drawing #controls:hover, .video.drawing #controls.paused {
	opacity: 0;
	transition: opacity 0.5s ease-in-out;
}

.controls_wrapper {
	display: flex;
	flex-direction: column;
	position: absolute;
	bottom: 0;

	width: calc(100% - 2*15pt);
	padding: 5pt 15pt;
}

.controls_row_1 {
	--size: 18px;

	height: var(--size);
}

.controls_row_2 {
	display: flex;
	flex-direction: row;
}

/*** controls: seekbar ***/

#seekbar {
	--seeked: 50%;
	--seeking: 0%;
	--bar-height: 3px;
	--bar-height-hover: 4.5px;

	display: inline-block;
	position: relative;

	width: 100%;
	height: var(--size);
	margin: 0;

	cursor: pointer;
}

#seekbar_back, #seekbar_seeked, #seekbar_timestamps {
	display: inline-block;
	position: absolute;
	top: calc(0.5*var(--size) - 0.5*var(--bar-height));

	height: var(--bar-height);
}

#seekbar_back {
	width: 100%;

	background: rgba(255,255,255,0.5);
}

#seekbar:hover > #seekbar_back, #seekbar.seeking > #seekbar_back {
	background: linear-gradient(to right, rgba(255,255,255,0.75) var(--seeking), rgba(255,255,255,0.5) var(--seeking));
}

#seekbar_seeked {
	width: var(--seeked);

	background: #09E;
}

#seekbar:hover > #seekbar_back, #seekbar:hover > #seekbar_seeked, #seekbar:hover > #seekbar_timestamps {
	top: calc(0.5*var(--size) - 0.5*var(--bar-height-hover));

	height: var(--bar-height-hover);
}

#seekbar_timestamps {
	--bar-height-hover: 7px;

	top: calc(0.5*var(--size) - 0.5*var(--bar-height-hover));

	width: 100%;
	height: var(--bar-height-hover);
}

.seekbar_timestamp {
	position: absolute;

	width: calc(var(--timestamp-end) - var(--timestamp-start));
	height: 100%;
	margin: 0;
	margin-left: var(--timestamp-start);
	
	background: rgba(255, 0, 102, 0.4);
}

.seekbar_timestamp::before, .seekbar_timestamp::after {
	--h: 4px;
	--h2: 3px;

	display: inline-block;
	position: absolute;
	content: ' ';

	width: 2px;
	height: calc(100% + var(--h) + var(--h2));
	margin: 0;
	margin-top: calc(0px - var(--h));

	border: #F06 solid 1px;
}

.seekbar_timestamp::before {
	border-right: 0;
}

.seekbar_timestamp::after {
	border-left: 0;
	margin-left: calc(100% - 2px);
}

.seekbar_timestamp.editing {
	background: rgba(255, 153, 0, 0.4);
}

.seekbar_timestamp.editing::before, .seekbar_timestamp.editing::after {
	border-color: #F90;
}

#seekbar_handle {
	--handle-size: 12px;

	display: inline-block;
	position: absolute;
	top: calc(0.5*var(--size) - 0.5*var(--handle-size));
	left: calc(var(--seeked) - 0.5*var(--handle-size));

	width: var(--handle-size);
	height: var(--handle-size);
	
	background: #09E;
	border-radius: 50%;
}

#seekbar_seeking_time {
	position: absolute;
	left: calc(var(--seeking));
	bottom: var(--size);
	transform: translate(-50%, -25%);

	opacity: 0;
	transition: opacity 0.15s ease-in-out 0.5s;
	user-select: none;
}

#seekbar:hover > #seekbar_seeking_time, #seekbar.seeking > #seekbar_seeking_time {
	opacity: 1;
	transition: opacity 0.1s ease-in-out;
}

/*** controls: buttons ***/

.controls_wrapper .empty {
	width: 100%;
}

.controls_wrapper .button {
	display: inline-block;
	
	width: var(--size);
	height: var(--size);
	padding: 5pt;
	padding-top: 3pt;

	filter: brightness(0.96);
}

.controls_wrapper .button::before {
	display: inline-block;
	content: ' ';

	width: var(--size);
	height: var(--size);

	background-size: var(--size);
	background-repeat: no-repeat;
	
	filter: invert();
}

.controls_wrapper .button:hover {
	cursor: pointer;
	filter: none;
}

#volume_button {
	margin: 0pt 15pt 0pt 0pt;
}

#volume_button::before {
	background-image: url("icons/remixicon/volume-mute-fill.svg");
}

#volume_button.muted::before {
	background-image: url("icons/remixicon/volume-mute-fill.svg");
}

#volume_button.volume-1::before {
	background-image: url("icons/remixicon/volume-down-fill.svg");
}

#volume_button.volume-2::before {
	background-image: url("icons/remixicon/volume-up-fill.svg");
}

#time_duration {
	height: var(--size);
	line-height: var(--size);

	padding: 5pt;
	padding-top: 3pt;
	
	white-space: nowrap;
	user-select: none;
}

#prev_button {
	margin: 0pt 0pt 0pt 15pt;
}

#prev_button::before {
	background-image: url("icons/remixicon/skip-back-fill.svg");
}

#next_button {
	margin: 0pt;
}

#next_button::before {
	background-image: url("icons/remixicon/skip-forward-fill.svg");
}

#play_button {
	margin: 0pt;
	padding-left: 15pt;
}

#play_button::before {
	background-image: url("icons/remixicon/pause-large-fill.svg");
}

#play_button.paused::before {
	background-image: url("icons/remixicon/play-large-fill.svg");
}

/** video overlays **/

#drawing_canvas, #eraser_preview, #overlays {
	display: block;
	position: absolute;
	top: 0;
	left: 0;

	width: 100%;
	height: 100%;

	border-radius: var(--border-radius);
	border-bottom-right-radius: 0;
	border-top-right-radius: 0;
}

/** video overlays: drawing canvas, eraser preview **/

.video #drawing_canvas {
	display: none;
}

.video.drawing #drawing_canvas {
	display: block;
}

#eraser_preview {
	--mx: 0px;
	--my: 0px;
	--size: 10px;
	--scale: 1;

	display: none;
	overflow: hidden;

	user-select: none;
	pointer-events: none;
}

#drawing_canvas.erasing + #eraser_preview {
	display: block;
}

#drawing_canvas.erasing:hover + #eraser_preview::before {
	display: block;
	position: absolute;
	top: calc(var(--my) - var(--size) * var(--scale)/2);
	left: calc(var(--mx) - var(--size) * var(--scale)/2);
	content: ' ';

	width: calc(1 * var(--size) * var(--scale) - 2*1px);
	height: calc(1 * var(--size) * var(--scale) - 2*1px);

	border: 1px solid #CCC;
	border-radius: 50%;

	background: transparent;
	
	user-select: none;
	pointer-events: none;
	mix-blend-mode: exclusion;
}

/** video overlays **/

#overlays {
	user-select: none;
	pointer-events: none;
}

.video.drawing #overlays {
	display: none;
}

#overlays > canvas {
	display: none;
	position: absolute;
	top: 0;
	left: 0;

	width: 100%;
	height: 100%;

	opacity: 1;
	transition: opacity 0.05s ease-in-out;
}

#overlays > canvas.visible {
	display: block;
}

#overlays.has_hovered > canvas {
	opacity: 0.4;
}

#overlays.has_hovered > canvas.hovered {
	opacity: 1;
}

/** sidebar **/

.sidebar {
	display: inline-flex;
	position: relative;

	width: calc(var(--sidebar-width) - 1px);
	overflow: hidden;

	border-left: 1px solid #EEE;
	border-radius: var(--border-radius);
	border-bottom-left-radius: 0;
	border-top-left-radius: 0;

	background: var(--sidebar-background);
}

/*** sidebar: default view (header, marks list, plus button) ***/

#marks_view {
	display: inline-flex;
	flex-direction: column;
	position: absolute;
	
	width: calc(100% - 2*10pt);
	height: calc(100% - 7pt);
	padding: 10pt;
	padding-top: 0;
	padding-bottom: 7pt;
}

/*** sidebar: default view (header) ***/

.header {
	display: inline-flex;
	flex-direction: row;
	align-items: center;
	justify-content: space-between;

	padding: 7pt 3pt;
}

.changed {
	font-weight: 600;
}

#save_button {
	--size: 24px;
	--padding: 5pt;

	width: var(--size);
	height: var(--size);
	padding: var(--padding);

	background-image: url("icons/remixicon/save-line.svg");
	background-size: var(--size);
	background-position: var(--padding);
	background-repeat: no-repeat;
}

#save_button:hover {
	background-color: #EEE;
	border-radius: 50%;
	cursor: pointer;
}

/*** sidebar: default view (marks list) ***/

#marks_scrollbox {
	overflow-y: scroll;
	overflow-y: auto;

	height: 100%;
	padding: 10pt 0;
	margin: 0;
	margin-bottom: 7pt;

	border: 1px solid #EEE;
	border-left: 0;
	border-right: 0;
}

.mark {
	display: none;
	position: relative;

	width: calc(100% - 8pt);
	line-height: calc(14px + 2*3pt);
	padding: 0;
	margin-bottom: 6pt;
}

.mark.visible {
	display: block;
}

.mark.with_text {
	width: calc(100% - 4pt - 8pt);
	padding-right: 4pt;
	white-space: pre-wrap;
}

.mark:hover {
	background: #F3F3F3;
}

.mark > .timestamp {
	display: inline-block;

	line-height: 14px;
	padding: 2pt 3pt;
	margin: 0;
	margin-right: 6pt;

	background: #F06;
	font-size: 14px;
	color: #FFF;
	user-select: none;
}

.mark > .edit_button {
	--size: 24px;
	--padding: 5pt;

	display: none;
	position: absolute;
	right: 0;
	bottom: -4pt;

	width: var(--size);
	height: var(--size);
	padding: var(--padding);

	background-image: url("icons/remixicon/pencil-line.svg");
	background-size: var(--size);
	background-position: var(--padding);
	background-repeat: no-repeat;
}

.mark:hover > .edit_button {
	display: block;
}

.mark > .edit_button:hover {
	background-color: #DDD;
	border-radius: 50%;
	cursor: pointer;
}

/*** sidebar: default view (plus button) ***/

#add_mark_button {
	--size: 24px;

	display: inline-flex;
	
	width: 100%;
	height: var(--size);
	padding: 7pt 0;

	border-radius: 7px;

	background-image: url("icons/remixicon/add-large-line.svg");
	background-size: var(--size);
	background-repeat: no-repeat;
	background-position: center;
}

#add_mark_button:hover {
	background-color: #EEE;
	cursor: pointer;
}

/*** sidebar: other views ***/

#editing_mark_view, #drawing_view {
	display: flex;
	flex-direction: column;
	position: absolute;

	width: 100%;
	height: 100%;

	border-radius: var(--border-radius);
	border-bottom-left-radius: 0;
	border-top-left-radius: 0;

	background: transparent;

	transition: background ease-in 0.2s 0.2s;
	pointer-events: none;
}

#editing_mark_view .sidebar_sliding_part, #drawing_view .sidebar_sliding_part {
	display: flex;
	flex-direction: column;
	transform: translateY(100%);

	width: calc(100% - 2*10pt);
	height: calc(100% - 7pt);
	padding: 10pt;
	padding-top: 0;
	padding-bottom: 7pt;
	
	border-radius: var(--border-radius);
	border-bottom-left-radius: 0;
	border-top-left-radius: 0;
	
	background: var(--sidebar-background);

	opacity: 1;
	transition: transform ease-in 0.2s, opacity ease-in 0.2s;
}

#editing_mark_view.open, #drawing_view.open {
	background: rgba(51,51,51, 0.5);

	transition: background ease-in 0.2s;
	pointer-events: all;
}

#editing_mark_view.open .sidebar_sliding_part, #drawing_view.open .sidebar_sliding_part {
	transform: none;
	
	opacity: 1;
	transition: transform ease-in-out 0.2s 0.2s, opacity ease-in-out 0.2s 0.2s;
}

.sidebar_sliding_part .empty {
	height: 100%;
}

.sidebar_sliding_part > .bottom_buttons {
	border: 0;
	border-top: 1px solid #EEE;
}

.sidebar_sliding_part .button_group {
	display: flex;
	flex-direction: row;

	padding: 0;
	padding-top: 7pt;

	gap: 10pt;
}

.sidebar_sliding_part .button_group > .button {
	width: 100%;
	padding: 7pt 0;

	border-radius: 7px;

	text-align: center;
}

.sidebar_sliding_part .button_group > .button:hover {
	background-color: #EEE;
	cursor: pointer;
}

.toggle.button {
	text-align: left !important;
	color: #333;
}

.toggle.button::before {
	content: ' ';
	display: inline-block;
	vertical-align: middle;

	width: 24px;
	height: 24px;
	margin: 0;
	margin-left: 4px;

	background-size: 20px 20px;
	background-position: 2px 2px;
	background-repeat: no-repeat;

	opacity: 0.4;
}

.toggle.button::after {
	display: inline;
	vertical-align: top;

	line-height: 24px;
	margin: 0;
	margin-left: 4pt;
	margin-right: calc(4pt + 24px);
}

.toggle.button.toggled_on {
	color: #000;
}

.toggle.button.toggled_on::before {
	opacity: 1;
}

/*** sidebar: editing view ***/

.time_range_edit {
	padding: 0;
	padding-bottom: 7pt;
	margin: 0;

	border: 0;
	border-bottom: 1px solid #EEE;
}

.time_range_icon {
	--size: 22px;

	content: ' ';
	display: inline-block;
	vertical-align: middle;

	width: var(--size);
	height: var(--size);

	margin: 0 2pt;
	margin-left: 5pt;

	filter: contrast(40%) brightness(120%);
}

.time_range_icon.current_time {
	background: url("icons/remixicon/time-line.svg");
}

.time_range_icon.time_range {
	background: url("icons/remixicon/expand-width-line.svg");
}

#mark_pause_button::before {
	background: url("icons/remixicon/pause-large-fill.svg");
}

#mark_pause_button::after {
	content: 'Pause: off';
}

#mark_pause_button.toggled_on::after {
	content: 'Pause: on';
}

#mark_loop_button::before {
	margin-right: 1pt;

	background: url("icons/remixicon/repeat-fill.svg");
	background-size: 18px;
	background-position: 4px 4px;
	background-repeat: no-repeat;
}

#mark_loop_button::after {
	content: 'Loop: off';
}

#mark_loop_button.toggled_on::after {
	content: 'Loop: on';
}

#mark_text {
	box-sizing: border-box;
	
	width: 100%;
	height: 100%;
	min-height: 100pt;
	resize: none;

	margin: 7pt 0;
	margin-bottom: 10pt;
}

/*** sidebar: buttons ***/

#drawing_mode_button, #mark_delete_button, #cancel_mark_button, #save_mark_button, #save_drawing_button {
	--size: 24px;

	height: var(--size);
	
	background-image: var(--url);
	background-size: var(--size);
	background-repeat: no-repeat;
	background-position: center;
}

#drawing_mode_button {
	--url: url("icons/remixicon/brush-line.svg");
}

#mark_delete_button {
	--url: url("icons/remixicon/delete-bin-line.svg");
}

#cancel_mark_button {
	--url: url("icons/remixicon/close-line.svg");
}

#save_mark_button, #save_drawing_button {
	--url: url("icons/remixicon/check-line.svg");
}

#mark_delete_button:hover {
	filter: invert();
	background-color: #09C;
}

.hidden {
	display: none;
}

/*** sidebar: drawing view ***/

.drawing_tools {
	padding-bottom: 7pt !important;
	
	border: 0;
	border-bottom: 1px solid #EEE;
}

#drawing_brush_panel > .button_group + .button_group {
	margin-top: 7pt;
}

#drawing_view .toggle.button {
	text-align: center !important;
}

#drawing_view .toggle.button::before {
	margin: 0;
}

/**** drawing tools: brush/erase tabs ****/

#drawing_brush_button::before {
	background: url("icons/remixicon/brush-line.svg");
}

#drawing_erase_button::before {
	background: url("icons/remixicon/eraser-line.svg");
}

/**** drawing tools: brush/erase size buttons ****/

#drawing_brush_thin_button::before, #drawing_brush_medium_button::before, #drawing_brush_large_button::before,
#drawing_erase_thin_button::before, #drawing_erase_medium_button::before, #drawing_erase_large_button::before {
	background: #000;
	border-radius: 50%;
}

#drawing_brush_thin_button::before,
#drawing_erase_thin_button::before {
	width: 10px;
	height: 10px;
}

#drawing_brush_medium_button::before,
#drawing_erase_medium_button::before {
	width: 17px;
	height: 17px;
}

/**** drawing tools: color buttons ****/

.color_button::before {
	display: none !important;
}

.color_button > b {
	--brush-color: #000;
	--brush-color-alpha: rgba(0, 0, 0, 0.7);

	display: inline-block;

	width: 20px;
	height: 20px;

	border-radius: 50%;
	border: 2px solid transparent;
}

.color_button:hover > b {
	border-color: var(--brush-color-alpha);
}

.color_button.toggled_on > b,
.color_button.toggled_on:hover > b {
	border-color: var(--brush-color);
}

.color_button > b::before {
	display: inline-block;
	content: ' ';

	width: calc(100% - 2*2px);
	height: calc(100% - 2*2px);
	margin: 2px;

	border-radius: 50%;

	background: var(--brush-color);
}

#drawing_color_red_button > b { --brush-color: #F36; --brush-color-alpha: rgba(255, 51, 102, 0.55); }
#drawing_color_green_button > b { --brush-color: #3B3; --brush-color-alpha: rgba(51, 220, 51, 0.55); }
#drawing_color_blue_button > b { --brush-color: #36E; --brush-color-alpha: rgba(51, 102, 239, 0.55); }
#drawing_color_yellow_button > b { --brush-color: #FB0; --brush-color-alpha: rgba(255, 220, 0, 0.55); }
#drawing_color_white_button > b { --brush-color: #FFF; --brush-color-alpha: rgba(255, 255, 255, 0.55); }

/**** custom treatment for white color button ****/

#drawing_color_white_button {
	--shadow-color: rgba(0, 0, 0, 0.5);
}

#drawing_color_white_button > b::before {
	box-shadow: var(--shadow-color) 0px 0px 2px 1px;
}

#drawing_color_white_button:hover > b,
#drawing_color_white_button.toggled_on > b {
	box-shadow: var(--shadow-color) 0px 0px 3px 1px;
}

/* bottom panel: section that lists all marks' timestamps */

#video_stamps {
	display: flex;
	flex-direction: row;
	flex-wrap: wrap;
	column-gap: 10pt;

	width: calc(100% - 2*10pt);
	padding: 10pt;
}

#video_stamps > .timestamp {
	display: inline-flex;

	padding: 3pt 5pt;
	border-radius: 3px;

	background: #F06;
	color: #FFF;

	user-select: none;
}

#video_stamps > .timestamp.editing {
	background: #F90;
}

#video_stamps > .timestamp:hover {
	cursor: pointer;
}
