/*
 * https://github.com/morethanwords/tweb
 * Copyright (C) 2019-2021 Eduard Kuzmenko
 * https://github.com/morethanwords/tweb/blob/master/LICENSE
 */

.emoji-dropdown {
	display: flex/*  !important */;
	flex-direction: column;
	width: 100%;
	//height: 282px;
	height: unquote('min(282px, calc(var(--vh) * 100 - 135px))');
	background: var(--surface-color);
	overflow: hidden;
	flex: 1 1 auto;
	max-height: 100%;
	
	@include respond-to(esg-top) {
		position: absolute !important;
		left: $chat-padding;
		bottom: 85px;
		width: 420px !important;
		height: 420px;
		max-height: 420px;
		box-shadow: 0px 5px 10px 5px rgba(16, 35, 47, .14);
		z-index: 3;
		border-radius: 10px;
		transition: transform .2s, opacity .2s;
		transition-timing-function: cubic-bezier(.4, 0, .2, 1);
		transform: scale(0);
		opacity: 0;
		transform-origin: 0 100%;

		&.active {
			opacity: 1;
			transform: scale(1);
		}

		body.animation-level-0 & {
			transition: none;
		}
	}

	/* @include respond-to(handhelds) {
		width: calc(100% + 1rem);
		margin-left: -.5rem;
	} */
	
	> .menu-horizontal-div {
		//font-weight: 500;
		margin-top: 2px;
		border: none;
	}
	
	.emoji-container {
		width: 100%;
		max-width: 100%;
		overflow: hidden;
		height: 100%;
	}

	.emoji-tabs {
		justify-content: center;

		&-search {
			position: absolute;
			left: 0;
			margin-left: 4px !important;
		}

		&-delete {
			position: absolute;
			right: 0;
			margin-right: 4px !important;
		}
	}
	
	.tabs-container {
		/* width: 300%; */
		height: 100%;

		.category-title {
			//position: sticky;
			top: 0;
			//font-size: .85rem;
			font-size: 14px;
			font-weight: 500;
			color: var(--secondary-text-color);
			//background: linear-gradient(to bottom,#fff 0,rgba(255,255,255,.9) 60%,rgba(255,255,255,0) 100%);
			z-index: 2;
			//padding: .53333rem 6PX .66667rem;
			padding: 12px 6px 6px 6px;
			width: 100%;
		}

		.sticky_sentinel {
			&--top {
				top: 0;
				height: 1px;
			}
		}
		
		> div {
			min-height: 100%;
			/* display: flex; */
			flex-direction: column;
			height: 100%;
		}

		.emoticons-content {
			flex: 1;
			padding: 0;
		}
		
		.scrollable {
			padding: 0 10px;
		}
	}
	
	.emoji-padding.active {
		@include respond-to(handhelds) {
			.menu-horizontal-div .menu-horizontal-div-item {
				flex: unset;
				padding: 0;
			}

			.category-items {
				grid-template-columns: repeat(auto-fill, 40px);

				> span {
					width: 40px;
					height: 40px;
					justify-self: center;
				}
			}
	
			.category-title {
				padding: 12px 6px 6px 10px;
			}
	
			.scrollable {
				padding: 0;
			}
	
			.emoji-category .category-items {
				grid-column-gap: unset;
			}
		}
	}
	
	.emoji-padding, .stickers-padding {
		.menu-horizontal-div {
			height: 48px;
			border-bottom: none;
			padding: 2px;
			width: 100%;
			box-shadow: 0px 1px 5px -1px rgba(0, 0, 0, 0.21);
			z-index: 4;
			background-color: var(--surface-color);

			.menu-horizontal-div-item {
				margin: 0;
			}
		}
	}

	.emoji-category {
		//padding-top: 1px;
		position: relative;
		margin: 0 -.125rem;

		.category-items {
			// ! No chrome 56 support
			display: grid;
			grid-column-gap: 2.44px;
			grid-template-columns: repeat(auto-fill, 42px);
			justify-content: space-between;

			font-size: 2.25rem;
			line-height: 2.25rem;

			.category-item {
				display: inline-block;
				margin: 0 1.44px; // ! magic number
				padding: 4px 4px;
				line-height: inherit;
				border-radius: 8px;
				cursor: pointer;
				user-select: none;
				
				width: 42px;
				height: 42px;

				html:not(.emoji-supported) & {
					position: relative;
				}

				.emoji-placeholder {
					position: absolute;
					left: 7px;
					top: 7px;
					width: 1.75rem;
					height: 1.75rem;
					border-radius: 50%;
					background-color: var(--light-secondary-text-color);

					@include animation-level(2) {
						opacity: 0;
						transition: opacity .2s ease-in-out;
					}
				}

				@include animation-level(2) {
					img {
						opacity: 1;
						transition: opacity .2s ease-in-out;
					}
				}
				
				.emoji {
					width: 100%;
					height: 100%;
					vertical-align: unset;
					margin: 0;
				}
				
				@include hover-background-effect();
			}
		}

		/* &:first-child {
			//padding-top: 5px;
		} */

		/* &::after {
			content: "";
			flex: auto;
		} */
	}
	
	.sticker-category {
		position: relative;
		
		/* &::after {
			content: "";
			flex: auto;
		} */

		/* &.not-full::after {
			content: "";
			flex: auto;
		} */

		.category-items {
			width: 100%;
			display: grid;
			grid-template-columns: repeat(auto-fill, var(--esg-sticker-size)); // 64px
			grid-column-gap: 1px;
			justify-content: space-between;

			
		}
	}
	
	#content-stickers {
		.scrollable {
			padding: 0px 5px 0;
		}
	}

	.menu-horizontal-div {
		width: 100%;
		height: 48px;
		box-shadow: 0px -2px 5px -1px rgba(0, 0, 0, .21);

		.menu-horizontal-div-item {
			font-size: 1.5rem;
			margin: 0 12px;
			width: 48px;
			height: 48px;
			line-height: 48px;
			display: flex;
			align-items: center;
			flex: 0 0 auto;
		}
	} 
	
	.stickers-padding {
		&.active {
			.scrollable {
				padding: 0;
				box-shadow: 0px 1px 5px -1px rgba(0, 0, 0, .21);
			}

			.menu-horizontal-div {
				box-shadow: none;

				.menu-horizontal-div-item {
					height: 48px;
					width: 48px;
					padding: 0;
					margin-right: 1px;
					margin-left: 1px;
				}
			}
		}

		.menu-wrapper {
			padding: 0;
			height: 48px;
			max-width: 100%;
		}
		
		.menu-horizontal-div-item {
			/* width: calc(100% / 7); */
			flex: 0 0 auto;
			
			&.active {
				&:not(.tgico-recent) {
					background-color: var(--light-secondary-text-color);
				}
			}
			
			> canvas, > img {
				//padding: .75rem;
				padding: 8px;
				max-width: 100%;
				max-height: 100%;
			}

			> canvas {
				width: 100%;
				height: 100%;
			}
		} 
	}
}
