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

dialog.kui.modal.grid {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100%;
  .header { height: 50px; }
  .actions { height: 65px; }
}

dialog.kui.modal.resize {
	max-height: calc(100% - 100px);
	height: auto;
}


.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;
}

dialog.kui.modal div.content,
#confirm div.cnt {
	background-color: #2f3036;
	border-top: 1px solid rgba(0,0,0,.15);
	padding: 20px 20px;
	color: var(--white);
	width: 100%;
	line-height: 1.4;
	min-height: 120px;
	display: flex;
	flex-direction: column;
	justify-content: flex-start;

	font-size: 14px;
	&.center { justify-content: center; align-items: center; }
	&.fs16 { font-size: 16px; }
	& form { width:100%; }
}

.kui.modal .actions {
	padding: 15px;
  background-color: #2f3036;
  border-top: 1px solid #1f2024;
}

.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_img {
	margin: 0;
	position: fixed;
	left: 50%;
	top: 50%;
	max-width: calc(100vw - 40px);
	max-height: calc(100vh - 40px);
	border: 5px solid #292a2f;
	border-radius: 20px;
	background-color: #2a2a2f;
	padding: 5px;
	box-shadow: 0 0 15px 2px rgb(255 255 255 / 0.48);
	width: fit-content;
	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;
	&.open { opacity: 1; transform: translate(-50%, -50%) scale(1); }
	&.closing { opacity: 0; transform: translate(-50%, -50%) scale(0.85); }
	display: grid;
	&:not([open]) { display: none; }
	& .cnt {
		display: grid;
		padding: 0;
		line-height: 0;
		font-size: 0;
		border-radius: 10px;
		overflow: hidden;
	}
	& img {
		display: block;
		cursor: pointer;
		object-fit: contain;
		border: 0;
		outline: none;
	}
	&::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);
	}
}

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

#notice {
	all: unset;
   position: fixed;
   inset: unset;
   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;
}
