/* ----~~~~ kui: Modal ~~~~---- */
body:has(#appbar) .kui.modal.max { margin-left:25px; }

.kui.modal {
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%) scale(0.75);
	opacity: 0;
	transition:
		transform 0.45s cubic-bezier(.16,1,.3,1),
		opacity 0.3s ease;
	will-change: transform, opacity;
	border-radius: 5px;
	background-color: #2f3036;
	box-shadow: 1px 3px 3px rgba(0,0,0,.2), 1px 3px 15px rgba(0,0,0,.2);
	display: flex;
	flex-direction: column;
	border: 0;
	padding: 0;
	outline: 0;
	user-select: none;
	&.hidden { display: none; }
	&.open {
		transform: translate(-50%, -50%) scale(1);
		opacity: 1;
		z-index: 1001;
	}
	
	&.rise {
		transform: translate(-50%, -40%);
		opacity: 0;
		&.open {
			transform: translate(-50%, -50%);
			opacity: 1;
		}
	}

	&::backdrop {
		background: rgba(0,0,0,0);
		backdrop-filter: blur(0);
		-webkit-backdrop-filter: blur(0);
		transition: background .25s ease, backdrop-filter .25s ease;
	}
	&.open::backdrop { 
		background: rgba(0,0,0,0.45); 
		backdrop-filter: blur(2px);
			-webkit-backdrop-filter: blur(2px);	
	}

	/* ---- SIZES ---- */
	&.tiny { width: 570px; }
	&.small { width: 760px; }
	&.max { height: 95vh; width: 90vw; }
	&.max .content:has(iframe) {
		height: 100%;
		overflow: hidden;
	}
}

.kui.modal .header {
	background-color: #3a3b40;
	color: rgba(255,255,255,.8);
	border-radius: 5px 5px 0 0;
	font-size: 16px;
	text-shadow: 1px 1px 1px rgba(0,0,0,.5);
	letter-spacing: 0.5px;
	padding: 0 20px;
	height: 50px;
	display: flex;
	align-items: center;
}

.kui.modal .cnt {
	background-color: #2f3036;
	border-top: 1px solid rgba(0,0,0,.15);
	padding: 20px 10px;
	color: var(--white);
	width: 100%;
	line-height: 1.4;
	min-height: 120px;
	display: flex;
	justify-content: center;
	align-items: center;
	font-size: 14px;
	&.fs16 { font-size: 16px; }
	& form { width:100%; }
}

.kui.modal .actions {
	padding: 15px;
	border-top: 1px solid #242528;
}

.kui.modal .kft.close {
	position: absolute;
	top: 0;
	right: 0;
	width: 40px;
	height: 40px;
}

.kui.modal .kft.close:before { color: gray; }
.kui.modal .kft.close:hover:before { color: lightgreen; }


#preview_dialog {
	display: grid;
   grid-template-rows: auto 1fr;
	&:not([open]) { display: none; }
	& .header { min-height: 50px; }
   & .header:empty { display: none; }
	&:has(.header:empty) { grid-template-rows: 1fr; }
	& .cnt {
		display: flex;
		align-items: center;
		justify-content: center;
		overflow: hidden;
	}

	position: absolute;
	left: 50%;
	top: 50%;
	border: 5px solid white;
	border-radius: 10px;
	transform: translate(-50%, -50%);
	width: calc(100% - 40px);
	margin-inline: auto;
	outline: none;

	scrollbar-color: transparent transparent;
	scrollbar-width: none;
	&::-webkit-scrollbar { width: 0;  }
	&::-webkit-scrollbar-track { background: transparent; }
	&::-webkit-scrollbar-thumb { background: transparent; border-radius:0; }

	opacity: 0;
	transform: translate(-50%, -50%) scale(0.85);
	transition: opacity 0.3s ease, transform 0.3s ease;
    &.visible,&.open { opacity: 1; transform: translate(-50%, -50%) scale(1); }

	& img {
		max-width: 100%;
		max-height: 100%;
		object-fit: contain;
		display:block;
		cursor:pointer;
	}
}

#preview_dialog[data-type=img] {
	&.max { margin-top:-10px; }
	& a.cancel { display: none; }
}
#preview_dialog[data-type=doc] {
	height: calc(100% - 50px);
	border: 0;
	padding: 0;
	width: calc(100% - 80px);
}
#preview_dialog[data-type=media] {
	border: 0;
	padding: 0;
	height: calc(100% - 50px);
	width: calc(100% - 80px);

	&.video {
		height: max-content;
		& #preview_player {
			height: 100%;
			width: 100%;
			& .plyr {
				width: 100%;
				margin: 20px;
				height:calc(100% - 40px);
			}
		}
	}

	&.audio {
		height: 320px;
		width: 50%;
		margin-left: 25px;
		background: none;
		max-width: 700px;
		& #preview_player {
			width:90%;
			& .plyr { 
				width:100%; 
				& .plyr__menu__container {
					overflow: auto;
					height: 100px;
					scrollbar-color: transparent transparent;
					scrollbar-width: none;
					&::-webkit-scrollbar { width: 0;  }
					&::-webkit-scrollbar-track { background: transparent; }
					&::-webkit-scrollbar-thumb { background: transparent; border-radius:0; }
				}
			}

		}
	}

	& .cnt { background-color: #46474a; }
}



/* ----~~~~ kUI - #notice ~~~~---- */

#notice {
	all: unset;
   position: fixed;
   left: 50%;
   bottom: 20px;
   transform: translateX(-50%);
   display: flex;
   flex-direction: column;
   gap: 10px;
   z-index: 500001;
   width: calc(100vw - 30px);
   max-width: 400px;
   height: max-content;
	&.notice-bottom .notice-item         { transform: translateY(12px);  opacity: 0; }
	&.notice-bottom .notice-item.visible { transform: translateY(0);     opacity: 1; }
	&.notice-top .notice-item            { transform: translateY(-12px); opacity: 0; }
	&.notice-top .notice-item.visible    { transform: translateY(0);     opacity: 1; }
}

.notice-item {
	pointer-events: auto;
	all: unset;
   position: relative;
   background: rgba(51,175,122,.95);
   border-radius: 6px;
   padding: 16px;
   cursor: pointer;
   overflow: hidden;
   opacity: 0;
   transform: translateY(20px) scale(.98);
   transition: transform 0.25s ease, opacity 0.25s ease;
   &.visible { opacity: 1; transform: translateY(0) scale(1); }

   &.error { background-color: rgba(228,81,89,.9); font-weight: bold; }
   &.success { background-color: rgba(51,175,122,.95); }
   &.warning { background-color: #eacc79; }
   &.warning .cnt { color: rgba(0,0,0,.9); text-shadow: none; }

   & .cnt {
   	all: unset;
      display: block;
      width: 100%;
      max-height: unset;
      min-height: unset;
      text-align: center;
      font-size: 16px;
      color: rgba(255,255,255,.95);
      text-shadow: 1px 1px 1px rgba(0,0,0,.45);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
   }

   & .progress {
      position: absolute;
      left: 0;
      bottom: 0;
      width: 100%;
      height: 3px;
      background: rgba(255,255,255,.2);
      & .bar {
         width: 0%;
         height: 100%;
         background: rgba(255,255,255,.9);
         transition: none;
      }
   }

}

/* ----~~~~ kUI - Tooltips ~~~~---- */

#tooltip {
	position: fixed;
	z-index: 9999;
	padding: 6px 15px;
	font-size: 14px;
	line-height: 1.2;
	background: rgba(0,0,0,.9);
	color: #fff;
	border-radius: 6px;
	white-space: nowrap;
	box-shadow: 0 4px 12px rgba(0,0,0,.2);
	pointer-events: none;
	opacity: 0;
	transform: scale(.96);
	transition: opacity .12s ease, transform .12s ease;
	&.show { opacity: 1; transform: scale(1); }
	&::after {
		content: "";
		position: absolute;
		width: 8px;
		height: 8px;
		background: #111;
		transform: rotate(45deg);
	}
}

#tooltip.arrow-top::after {
	top: -4px;
	left: var(--arrow-left, 50%);
	transform: translateX(-50%) rotate(45deg);
}
#tooltip.arrow-bottom::after {
	bottom: -4px;
	left: var(--arrow-left, 50%);
	transform: translateX(-50%) rotate(45deg);
}
#tooltip.arrow-left::after {
	left: -4px;
	top: var(--arrow-top, 50%);
	transform: translateY(-50%) rotate(45deg);
}
#tooltip.arrow-right::after {
	right: -4px;
	top: var(--arrow-top, 50%);
	transform: translateY(-50%) rotate(45deg);
}


/* ----~~~~ Context Menus ~~~~---- */

.ctxmenu {
	position: fixed;
	z-index: 5000;
	background-color: #ededf0;
	border-radius: 10px;
	outline: none;
	min-width: max-content;
	margin-bottom: 20px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18), 0 12px 24px rgba(0, 0, 0, 0.16);
	padding: 8px;
	display: none;

	&.open { display:block; }

	& a {
		color: #333;
		display: block;
		height: 26px;
		line-height: 25px;
		padding-inline: 10px;
		border-radius: 3px;
		cursor: pointer;
		transition: unset;
		text-align: left;
		text-shadow: none;
		font-size: 14px;
		&:hover { 
			color: var(--white);
			background: linear-gradient(180deg, rgba(95,186,247,1) 0%, rgba(17,141,210,1) 100%); 
		}

		& i { 
		   margin-right: 10px; 
		   width: 20px;
		   height: inherit;
		   float: left;
		}
	}

	& .sub_div {
	   border-bottom: 1px solid rgba(0,0,0,.15);
	   margin-bottom: 6px;
	   padding-top: 5px;
	}
}
}

#ctx-menu-wrap::backdrop {
    display: none;
}
