@import "~scss/_mixins";

.widget { background: var(--color-bg-primary); border-radius: 12px; transform: translate(0px, 0px); position: relative; opacity: 0; }
.widget:last-child { margin: 0px; }
.widget {
	.head { padding: 8px; }
	.head {
		.sides { width: 100%; position: relative; display: flex; flex-direction: row; align-items: center; gap: 0px 8px; padding: 2px 4px 2px 8px; }
		.side.left { flex-grow: 1; display: flex; flex-direction: row; align-items: center; gap: 0px 4px; overflow: hidden; height: 28px; }
		.side.right { flex-shrink: 0; }	

		.sides::after { 
			opacity: 0; content: ''; width: 100%; height: 100%; left: 0px; top: 0px; border-radius: 6px; z-index: 1;
			pointer-events: none; position: absolute; transition: opacity $transitionCommon; background: var(--color-shape-highlight-medium);
		}
		.sides:hover::after { opacity: 1; }

		.clickable { 
			@include text-paragraph; font-weight: 600; display: flex; flex-direction: row; align-items: center; gap: 0px 6px; position: relative; 
			overflow: hidden;
		}
		.clickable {
			.iconObject, .icon { flex-shrink: 0; }
			.icon { width: 20px; height: 20px; }
			.name { @include text-overflow-nw; }
			.count { color: var(--color-text-secondary); }
		}
		.clickable:hover {
			.iconWrap.collapse { display: flex; }
			.headerIcon { display: none; }
		}

		.iconWrap { width: 28px; height: 28px; border-radius: 4px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
		.iconWrap.collapse { display: none; width: 20px; height: 20px; }

		.icon { width: 20px; height: 20px; flex-shrink: 0; }
		.icon.back { background-image: url('~img/icon/widget/back0.svg'); }
		.icon.options { background-image: url('~img/icon/widget/options0.svg'); }
		.icon.plus { background-image: url('~img/icon/widget/plus0.svg'); }
		.icon.collapse { background-image: url('~img/icon/widget/collapse0.svg'); }
		.icon.collapse.isClosed { transform: rotateZ(-90deg); }

		.iconWrap:hover,
		.iconWrap.hover,
		.iconWrap.active {
			.icon.back { background-image: url('~img/icon/widget/back1.svg'); }
			.icon.options { background-image: url('~img/icon/widget/options1.svg'); }
			.icon.plus { background-image: url('~img/icon/widget/plus1.svg'); }
			.icon.collapse { background-image: url('~img/icon/widget/collapse1.svg'); }
		}

		.buttons { flex-shrink: 0; flex-direction: row; align-items: center; display: none; position: relative; z-index: 2; }
		.buttons.active { display: flex; } 
	}

	&.active, &:hover {
		.head { padding-right: 8px; }
	}

	&.withButtons {
		&.active, &:hover {
			.head {
				.counters { display: none; }
				.buttons { display: flex; }
			}
		}
	}

	&.anim { transition: opacity $transitionChatMessageTime ease-in-out; }
	&.show { opacity: 1; }

	#button-show-all { padding: 0px 8px; }
	#button-show-all {
		.button { display: flex; align-items: center; justify-content: flex-start; border: 0; @include text-small; font-weight: 500; }
		.button:after { content: ''; width: 8px; height: 8px; display: block; background-image: url('~img/arrow/showAll.svg'); margin: 0px -12px 0px 4px; }
	}

	.dimmer { position: absolute; height: 100%; width: 100%; border-radius: 2px; left: 0px; top: 0px; z-index: 1; cursor: grab; display: none; }

	.contentWrapper { transition: height 0.4s $easeInQuint; }
	.innerWrap { transition: opacity 0.4s $easeInQuint; flex-direction: column; justify-content: center; }

	.emptyWrap { padding: 0px 16px; display: flex; align-items: flex-start; justify-content: flex-start; width: 100%; flex-grow: 1; }
	.emptyWrap {
		.label { text-align: center; @include text-common; @include clamp2; width: 100%; color: var(--color-text-secondary); }
		.icon.more { width: 20px; height: 20px; background-image: url('~img/icon/widget/emptyMore.svg'); }
	}

	.icon.remove { position: absolute; top: -15px; left: -15px; height: 40px; width: 40px; display: none; z-index: 2; cursor: default !important; }
	.icon.remove {
		.inner {
			height: 20px; width: 20px; border-radius: 50%; background-color: var(--color-shape-primary); background-image: url('~img/icon/widget/remove.svg');
			background-repeat: no-repeat; background-position: center; position: absolute; left: 50%; top: 50%; margin: -10px 0px 0px -10px;
		}
	}
	.icon.remove:hover .inner { background-color: var(--color-text-tertiary); }

	> .dropTarget:not(.targetHead) { position: absolute; left: 0px; width: 100%; height: 20px; }
	> .dropTarget:not(.targetHead).isOver { box-shadow: 0px 0px !important; }
	> .dropTarget:not(.targetHead).targetTop { top: -7px; }
	> .dropTarget:not(.targetHead).targetBot { bottom: -7px; }
	> .dropTarget:not(.targetHead).isOver::before { 
		content: ""; position: absolute; background: var(--color-control-accent); width: calc(100% - 24px); height: 2px; border-radius: 2px; left: 12px;
	}
	> .dropTarget:not(.targetHead).targetTop.isOver::before { top: 0px; }
	> .dropTarget:not(.targetHead).targetBot.isOver::before { bottom: 0px; }

	> .dropTarget.targetHead { border-radius: 12px 12px 0px 0px; }

	.item.isSection { padding-top: 12px; }
	.item.isSection:first-child { padding-top: 0px; }
	.item.isSection {
		.inner { display: flex; align-items: center; }
		.label { @include text-small; font-weight: 500; color: var(--color-text-secondary); @include text-overflow-nw; }
	}
	.item.isSection::before,
	.item.isSection .inner::before { display: none !important; }
}

.widget.isPreview { display: flex; flex-direction: column; flex-grow: 1; }
.widget.isPreview {
	.head { padding: 4px 16px; }
	.contentWrapper, .innerWrap { height: 100%; }

	.emptyWrap { padding: 16px 16px 8px 16px; }

	.innerWrap { padding: 0px !important; }

	.filterWrapper { display: flex; align-items: center; gap: 0px 8px; }
	.filterWrapper {
		.side.left { flex-grow: 1; }
		.side.right { flex-shrink: 0; }
		.filter { padding: 0px; width: 100%; }
	}
}

.widget.isClosed {
	.contentWrapper { height: 0px; overflow: hidden; }
	> .dropTarget.targetHead { border-radius: 12px; }
}

.widget.widgetLink {
	.headerIcon { display: block !important; }
	.iconWrap.collapse { display: none !important; }
}

@import "./space";
@import "./tree";
@import "./view/common";

body.isDragging {
	.widget::after {
		content: ''; display: block; position: absolute; left: 0px; top: 0px; background: transparent; width: 100%; height: 100%;
		z-index: 10; border-radius: inherit;
	}
}
