@import url(../assets/fonts/Nippo/Fonts/WEB/css/nippo.css);
@import url(../assets/fonts/Poppins/Fonts/WEB/css/poppins.css);
@import url(../assets/fonts/NotoEmoji/Fonts/WEB/css/noto.css);
@import url(./views/tooltip/styles.css);
@import url('https://fonts.googleapis.com/css2?family=Noto+Color+Emoji&family=Noto+Emoji:wght@300..700&display=swap');

* {
	padding: 0;
	margin: 0;
	box-sizing: border-box;
}

.test-env-alert::part(base) {
	position: fixed;
	z-index: 999;
	bottom: 0;
	margin: 1em;
}

/*Video editor surface styles*/
.editor {
	padding: 0.5em;
	height: 100vh;
	height: 100dvh;
	display: flex;
	flex-direction: column;
	min-height: 0;
	padding-bottom: calc(0.5em + env(safe-area-inset-bottom, 0px));
    background: #0D0F14; /* editor background */
}

.editor-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 0.3em; /* tighter to reduce overall header height */
	flex-wrap: wrap;
	gap: 0.5em;
	min-height: 36px; /* define header height for layout calc below */

	& .logo {
		position: relative;
		top: 1px;
		width: 40px; /* reduced by ~2x */
	}

	& .flex {
		display: flex;
		align-items: center;
		gap: 1em;
	}
}

.project-name {
	display: flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border-radius: 5px;

	& .box {
		display: flex;
		align-items: center;
		border: 1px solid #2a3550;
		padding: 0 0.3em;
		border-radius: 5px;
		height: 20px;
		gap: 0.25em;
		transition: border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease;

		& .icons {
			display: flex;
			cursor: pointer;
			color: #9ca3af;
			transition: color 120ms ease;

			& .check {
				display: flex;
				color: inherit;
			}
		}

		& input {
			background: none;
			border: none;
			color: #9ca3af;
			font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
			font-size: 13px;
			line-height: 1;
			height: 100%;
			padding: 0;
			margin: 0;
			transition: color 120ms ease;

			&:not(:disabled) {
				color: #e5e7eb;
			}
		}

	}
}

/* project name: inactive (not editing) */
.project-name:not(.editing) .box {
	border-color: #9ca3af;
}

.project-name:not(.editing) .icons:hover {
	color: #cbd5e1;
}

/* project name: editing */
.project-name.editing .box:focus-within {
	border-color: #3A86FF;
	box-shadow: 0 0 0 3px rgba(58,134,255,0.25);
}

.project-name.editing .icons:hover {
	color: #cbd5e1;
}

.export {
	display: flex;
	align-items: center;
	gap: 1em;
}

.export-button {
	display: flex;
	height: 21px;
	align-items: center;
	color: white;
	background: #1d1c1c;
	cursor: pointer;
	border-radius: 5px;
	padding: 0 0.3em;
	border: 1px solid white;
	transition: border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease, color 120ms ease;

	&:disabled {
		opacity: 0.5;
		cursor: default;
		border-color: #1d1c1c;
	}

	&:hover:not(:disabled),
	&:focus-visible:not(:disabled) {
		background-color: rgba(58,134,255,0.10);
		border-color: rgba(58,134,255,0.75);
		box-shadow: 0 0 0 2px rgba(58,134,255,0.25), 0 0 12px rgba(58,134,255,0.22);
		color: #e5e7eb;
		outline: none;
	}

	& .text {
		display: flex;
		gap: 0.3em;
		font-family: Poppins-Regular;

		& svg {
			position: relative;
			top: 1px;
			width: 14px;
		}
	}
}
/*Video editor surface styles end*/

/*Global styles*/
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
	background: #394358;
	border-radius: 10px;
	border: 2px solid transparent;
	background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
	background: #445169;
	border: 2px solid transparent;
	background-clip: content-box;
}

html, body {
	font-size: 16px;
	min-height: 100%;

	color: gray;
	background: #101010; /*#111*/
}

/* === GLOBAL UI SCALE (easy revert) ========================================
   Set to 1 to restore original size.
   This makes browser 100% look like ~80% without changing browser zoom.
============================================================================ */
/* Default: no UI scaling (touch devices / iPad Safari/Chrome). */
:root {
	--timelineflow-ui-scale: 1;
}

/* Desktop-like environments only: apply the smaller UI scale. */
@media (pointer: fine) and (hover: hover) {
	:root {
		--timelineflow-ui-scale: 0.8;
	}
}

html {
	zoom: var(--timelineflow-ui-scale);
}

body {
	overflow-x: hidden;
}

body.editor-page {
	overflow: hidden;
}

.editor {
	overflow: hidden;
}

/* Ensure full-screen surfaces still fill the viewport at the scaled size. */
body.editor-page .editor {
	width: calc(100vw / var(--timelineflow-ui-scale));
	height: calc(100vh / var(--timelineflow-ui-scale));
}

@supports (height: 100dvh) {
	body.editor-page .editor {
		height: calc(100dvh / var(--timelineflow-ui-scale));
	}
}

.loading-page-indicator {
	width: calc(100vw / var(--timelineflow-ui-scale));
	height: calc(100vh / var(--timelineflow-ui-scale));
}

@supports (height: 100dvh) {
	.loading-page-indicator {
		height: calc(100dvh / var(--timelineflow-ui-scale));
	}
}

/* NOTE: iPad Chrome is WebKit; `zoom` support is inconsistent. We avoid scale on coarse pointers above. */

@keyframes spin {
	from { transform: rotate(0deg); }
	to { transform: rotate(360deg); }
}

/* Landing-page gradient animation (used for loading screen too) */
@keyframes g-3 {
	50% {
		--g3-1-x-position: 42.69531250000001%;
		--g3-1-y-position: 91.5625%;
		--g3-2-x-position: 91.7578125%;
		--g3-2-y-position: 33.046875%;
		--g3-3-x-position: 5.742187500000001%;
		--g3-3-y-position: 5.546875000000001%;
	}
}

/* Loading gradient: animated blob positions + vignette reveal */
@property --lg-text-x { syntax: "<percentage>"; inherits: false; initial-value: 20%; }
@property --lg-text-y { syntax: "<percentage>"; inherits: false; initial-value: 35%; }
@property --lg-image-x { syntax: "<percentage>"; inherits: false; initial-value: 78%; }
@property --lg-image-y { syntax: "<percentage>"; inherits: false; initial-value: 30%; }
@property --lg-video-x { syntax: "<percentage>"; inherits: false; initial-value: 60%; }
@property --lg-video-y { syntax: "<percentage>"; inherits: false; initial-value: 78%; }
@property --lg-audio-x { syntax: "<percentage>"; inherits: false; initial-value: 22%; }
@property --lg-audio-y { syntax: "<percentage>"; inherits: false; initial-value: 80%; }

@keyframes lg-text {
	0%   { --lg-text-x: 18%; --lg-text-y: 28%; }
	50%  { --lg-text-x: 44%; --lg-text-y: 12%; }
	100% { --lg-text-x: 10%; --lg-text-y: 52%; }
}

@keyframes lg-image {
	0%   { --lg-image-x: 82%; --lg-image-y: 20%; }
	50%  { --lg-image-x: 64%; --lg-image-y: 55%; }
	100% { --lg-image-x: 92%; --lg-image-y: 40%; }
}

@keyframes lg-video {
	0%   { --lg-video-x: 56%; --lg-video-y: 86%; }
	50%  { --lg-video-x: 88%; --lg-video-y: 72%; }
	100% { --lg-video-x: 40%; --lg-video-y: 70%; }
}

@keyframes lg-audio {
	0%   { --lg-audio-x: 22%; --lg-audio-y: 84%; }
	50%  { --lg-audio-x: 10%; --lg-audio-y: 62%; }
	100% { --lg-audio-x: 34%; --lg-audio-y: 92%; }
}


@keyframes loading-vignette-reveal {
	0%   { height: 46vh; }
	45%  { height: 30vh; }
	100% { height: 28vh; }
}

@keyframes loading-shadow-reveal {
	0% { box-shadow: 0 0 40vw 20vw rgba(0, 0, 0, 1) inset; }
	45% { box-shadow: 0 0 26vw 11vw rgba(0, 0, 0, 1) inset; }
	100% { box-shadow: 0 0 18vw 6vw rgba(0, 0, 0, 1) inset; }
}

/* Shoelace theme overrides: inputs, selects, textareas, details */
sl-input::part(base),
sl-select::part(base),
sl-textarea::part(base),
sl-details::part(base) {
	background-color: #0D0F14; /* unified dark field background */
	border-color: #2a3550;
}

sl-select::part(panel),
sl-select::part(listbox) {
	background-color: #0D0F14;
}

/* Ensure dropdown/select popovers render above timeline overlays.
   Note: stacking is controlled by the popup/base container, not just the inner panel. */
:root {
	--omni-popover-z: 10000;
}

sl-dropdown::part(base),
sl-dropdown::part(popup),
sl-dropdown::part(panel),
sl-select::part(base),
sl-select::part(popup),
sl-select::part(panel),
sl-select::part(listbox) {
	position: relative;
	z-index: var(--omni-popover-z) !important;
}

/* Provider dropdown (Project Settings): enforce app palette even when hoisted */
sl-dropdown.provider-dropdown::part(panel) {
	background: #0D0F14 !important;
	border: 1px solid #2a3550 !important;
	border-radius: 12px;
	box-shadow: none !important;
	color: #e5e7eb;
}

sl-dropdown.provider-dropdown::part(popup),
sl-dropdown.provider-dropdown::part(base) {
	background: transparent !important;
	border: none !important;
	box-shadow: none !important;
}

/* Provider dropdown menu items can be hoisted outside the dropdown's DOM.
   Style the menu directly via a dedicated class so it stays themed. */
sl-menu.provider-menu {
	/* Shoelace uses neutral tokens for menu item backgrounds.
	   Override them locally so rows don't default to gray. */
	--sl-color-neutral-0: transparent;
	--sl-color-neutral-50: transparent;
	--sl-color-neutral-100: transparent;
	--sl-color-neutral-200: transparent;
	--sl-color-neutral-300: transparent;
}

sl-menu.provider-menu::part(base) {
	background: transparent !important;
}

sl-menu.provider-menu sl-menu-item {
	--sl-color-neutral-0: transparent;
	--sl-color-neutral-50: transparent;
	--sl-color-neutral-100: transparent;
	--sl-color-neutral-200: transparent;
	background: transparent !important;
}

sl-menu.provider-menu sl-menu-item::part(base) {
	background: transparent !important;
	color: #e5e7eb;
}

sl-menu.provider-menu sl-menu-item:hover::part(base),
sl-menu.provider-menu sl-menu-item::part(base):hover {
	background: rgba(255,255,255,0.04) !important;
}

.project-name input {
	background: #0D0F14 !important;
	color: inherit;
}

sl-input:focus-within::part(base),
sl-select:focus-within::part(base),
sl-textarea:focus-within::part(base) {
	border-color: #3A86FF;
	box-shadow: 0 0 0 3px rgba(58,134,255,0.25);
}

/* native elements fallbacks (non-shoelace) */
input, select, textarea {
	background: #0D0F14;
	color: #e5e7eb;
	border: 1px solid #2a3550;
}

/* dropdown panels */
sl-select::part(panel),
sl-select::part(listbox) { background-color: #0D0F14; }

/* range sliders */
/* native range slider base reset + track/thumb styling */
input[type="range"] { appearance: none; -webkit-appearance: none; background: transparent; width: 100%; }
input[type="range"]:focus { outline: none; }
input[type="range"]::-webkit-slider-runnable-track { background: #394358; height: 4px; border-radius: 2px; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; height: 12px; width: 12px; border-radius: 50%; background: #3A86FF; margin-top: -4px; cursor: pointer; }
input[type="range"]::-moz-range-track { background: #394358; height: 4px; border-radius: 2px; }
input[type="range"]::-moz-range-thumb { height: 12px; width: 12px; border-radius: 50%; background: #3A86FF; border: none; cursor: pointer; }
input[type="range"]:active::-webkit-slider-runnable-track { background: #445169; }
input[type="range"]:active::-moz-range-track { background: #445169; }

/* Shoelace <sl-range> component theming via parts */
sl-range::part(track) { background: #394358; height: 4px; border-radius: 2px; }
sl-range::part(fill) { background: #3A86FF; }
sl-range::part(handle) { background: #3A86FF; border: 1px solid #0D0F14; box-shadow: 0 0 0 2px #0D0F14; }
sl-range:focus-within::part(handle) { box-shadow: 0 0 0 2px #0D0F14, 0 0 0 4px rgba(58,134,255,0.4); }
sl-range::part(tooltip) { background: #0D0F14; border: 1px solid #2a3550; color: #e5e7eb; font-family: Poppins-Regular; }

/* project name input */
.project-name input { background: #0D0F14 !important; color: inherit; }

/* construct-editor panel scroll areas (attempt to reach shadow parts) */
construct-editor::part(scroll) { scrollbar-width: thin; scrollbar-color: #394358 transparent; }
construct-editor::part(scroll)::-webkit-scrollbar { width: 8px; height: 8px; }
construct-editor::part(scroll)::-webkit-scrollbar-track { background: transparent; }
construct-editor::part(scroll)::-webkit-scrollbar-thumb {
	background: #394358;
	border-radius: 10px;
	border: 2px solid transparent;
	background-clip: content-box;
}
construct-editor::part(scroll)::-webkit-scrollbar-thumb:hover {
	background: #445169;
	border: 2px solid transparent;
	background-clip: content-box;
}

/* sl-details summary color to blue-ish accent */
sl-details::part(summary) {
	color: #c7d2fe;
}

/* Primary accent variables for Shoelace */
.sl-theme-dark, :root {
	--sl-color-primary-600: #3A86FF;
	--sl-color-primary-500: #5AA0FF;
	--sl-color-primary-700: #2F6FD1;
}

construct-editor {
	width: 100%;
	flex: 1 1 auto;
	min-height: 0;
	height: auto;
	border-radius: 10px;

	--alpha: #3A86FF; /* selection/brand accent */
	--bravo: lime;
	/* Panels/timeline surfaces */
	--bg-a: #10151E;
	--bg-b: #0D0F14;
	--bg-c: #1b2230;
	--taskbar-size: 1em;
	/* universal scrollbar theming inside construct-editor (deep selectors) */
	& ::-webkit-scrollbar { width: 10px; height: 10px; }
	& ::-webkit-scrollbar-track { background: transparent; }
	& ::-webkit-scrollbar-thumb {
		background: #394358;
		border-radius: 10px;
		border: 2px solid transparent;
		background-clip: content-box;
	}
	& ::-webkit-scrollbar-thumb:hover {
		background: #445169;
		border: 2px solid transparent;
		background-clip: content-box;
	}
	& { scrollbar-width: thin; scrollbar-color: #394358 transparent; }
}

.logo-loader {
	max-width: 175px; /* ~2x smaller */
	margin-bottom: 1em;
}

.loading-page-indicator {
	display: flex;
	flex-direction: column;
	position: fixed;
	inset: 0;
	width: calc(100vw / var(--timelineflow-ui-scale, 1));
	height: calc(100vh / var(--timelineflow-ui-scale, 1));
	justify-content: center;
	align-items: center;
	font-family: sans-serif;
	overflow: hidden;
	/* keep pseudo-elements positioned within the overlay */
	contain: layout paint;
	transform-origin: 0 0;
	padding-bottom: env(safe-area-inset-bottom, 0px);
	/* Use the same category colors as Clip panel blocks */
	/* text: #7E53C3, image: #2BB673, video: #3A86FF, audio: #E9B207 */
	box-shadow: 0 0 18vw 6vw rgba(0, 0, 0, 1) inset;
	background:
		radial-gradient(120% 120% at var(--lg-text-x) var(--lg-text-y), rgba(126, 83, 195, 0.55) -55%, transparent 55%),
		radial-gradient(120% 120% at var(--lg-image-x) var(--lg-image-y), rgba(43, 182, 115, 0.40) -55%, transparent 58%),
		radial-gradient(120% 120% at var(--lg-video-x) var(--lg-video-y), rgba(58, 134, 255, 0.38) -55%, transparent 58%),
		radial-gradient(120% 120% at var(--lg-audio-x) var(--lg-audio-y), rgba(233, 178, 7, 0.28) -55%, transparent 60%),
		#0a0a0a;
	animation:
		lg-text 10s linear infinite alternate -3s,
		lg-image 14s linear infinite alternate -5s,
		lg-video 12s linear infinite alternate -7s,
		lg-audio 16s linear infinite alternate -9s,
		loading-shadow-reveal 3s cubic-bezier(0.16, 1, 0.3, 1) 1 both;
}


/* Symmetric top/bottom fade so vignette is centered.
   Animate the height once on load to "reveal" the gradient area. */
.loading-page-indicator:before,
.loading-page-indicator:after {
	content: '';
	position: absolute;
	left: 0;
	right: 0;
	height: 28vh;
	z-index: 1;
	pointer-events: none;
	animation: loading-vignette-reveal 3s cubic-bezier(0.16, 1, 0.3, 1) 1 both;
}

.loading-page-indicator:before {
	top: 0;
	background: linear-gradient(to bottom, rgba(10, 10, 10, 0.92), transparent);
}

.loading-page-indicator:after {
	bottom: 0;
	background: linear-gradient(to top, rgba(10, 10, 10, 0.92), transparent);
}

.loading-page-indicator > * {
	position: relative;
	z-index: 2;
}

.shine {
	width: 100%;
	font-size: 5em;
	text-align: center;
	margin-bottom: 0.3em;
	text-shadow: 0 0px 0px rgba(255, 255, 255, 0.5);
	/* animated sweep from #10151E (lighter) to #0D0F14 (darker) */
	background: linear-gradient(90deg, #0D0F14 0%, #10151E 50%, #0D0F14 100%) 0 0 / 150px 100% no-repeat;
	color: rgba(255, 255, 255, 0.5);
	background-clip: text;
	animation-name: shine;
	animation-duration: 5s;
	animation-iteration-count: infinite;
	font-weight: bold;
	font-style: italic;
}

@keyframes shine {
	0%, 10% {
		background-position: 0px;
	}
	20% {
		background-position: top left;
	}
	100% {
		background-position: top right;
	}
}

.loader { 
  width: 250px; 
  margin:0 auto;
  border-radius:10px;
  border:4px solid transparent;
  position:relative;
  padding:1px;
}

.loader:before {
  content:'';
  border:1px solid #fff; 
  border-radius:10px;
  position:absolute;
  top:-4px; 
  right:-4px; 
  bottom:-4px; 
  left:-4px;
}

.loader .loaderBar { 
  position:absolute;
  border-radius:10px;
  top:0;
  right:100%;
  bottom:0;
  left:0;
  background:#fff; 
  width:0;
  animation:borealisBar 2s linear infinite;
}

@keyframes borealisBar {
  0% {
    left:0%;
    right:100%;
    width:0%;
  }
  10% {
    left:0%;
    right:75%;
    width:25%;
  }
  90% {
    right:0%;
    left:75%;
    width:25%;
  }
  100% {
    left:100%;
    right:0%;
    width:0%;
  }
}

@property --g3-1-x-position { syntax: "<percentage>"; inherits: false; initial-value: 16.09375%; }

@property --g3-1-y-position { syntax: "<percentage>"; inherits: false; initial-value: 33.12500000000001%; }

@property --g3-2-x-position { syntax: "<percentage>"; inherits: false; initial-value: 48.55468750000001%; }

@property --g3-2-y-position { syntax: "<percentage>"; inherits: false; initial-value: 9.648437500000002%; }

@property --g3-3-x-position { syntax: "<percentage>"; inherits: false; initial-value: 78.6328125%; }

@property --g3-3-y-position { syntax: "<percentage>"; inherits: false; initial-value: 79.8046875%; }


:root {

--g3-1-x-position: 16.09375%

--g3-1-y-position: 33.12500000000001%

--g3-2-x-position: 48.55468750000001%

--g3-2-y-position: 9.648437500000002%

--g3-3-x-position: 78.6328125%

--g3-3-y-position: 79.8046875%

}

.toast {
	position: fixed;
	bottom: 20px;
	left: 20px;
	padding: 10px 20px;
	border-radius: 5px;
	color: white;
	background-color: rgba(0, 0, 0, 0.8);
	z-index: 2147483647;
	animation: fade-in-out 5s ease-in-out;
	font-family: Poppins-Regular;
}

.toast.error { background-color: #e74c3c; }
.toast.warning { background-color: #f39c12; }
.toast.info { background-color: #2ecc71; }

@keyframes fade-in-out {
	0% { opacity: 0; }
	10% { opacity: 1; }
	90% { opacity: 1; }
	100% { opacity: 0; }
}
