/**
 * Editor only styles for the Icon Block.
 */
// Style Color (Sidebar Gutenberg Tabs Style)
.icon-font-awesome-color {
	margin-bottom: 24px;

	.components-flex.components-color-palette__custom-color-wrapper {
		div {
			display: none;
		}

		button {
			border-radius: 100%;
			width: 35px;
			height: 35px;

			&::after {
				background: none;
			}
		}
	}

	.components-circular-option-picker {
		display: none;
	}
}

.wp-icon-font-awesome__opener {
	display: none;
}

// Style for the icon library modal.
.blockIcons {
	.components-modal__frame.wp-icon-font-awesome__modal {
		max-width: 1450px;
	}
}

.wp-icon-font-awesome__modal {
	background: #fff;

	// Header
	.components-modal__header {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		justify-content: center;
		height: auto;
		padding: 25px 45px;
		background: #fff;

		.components-modal__header-heading-container {
			h1 {
				font-size: 22px;
			}
		}

		.components-button {
			width: auto;
			height: auto;
			right: 0;
			padding: 0;

			svg {
				width: 30px;
				height: 30px;
				fill: #000;
			}
		}
	}

	.components-modal__content {
		overflow: auto;
		display: block;
		padding: 25px 45px;
		padding-top: 0;

		.box-icons {
			display: flex;
			flex-wrap: wrap;
			justify-content: space-between;
			margin-top: 10px;
		}

		// Aside
		.inserter__aside {
			display: flex;
			flex-wrap: wrap;
			align-items: center;
			overflow-y: scroll;
			width: 300px;
			height: 100vh;
			padding-right: 20px;

			.inserter-aside__search {
				.components-base-control__field {
					margin-bottom: 25px;

					input {
						background: #eaeaea;
						box-shadow: none;
						border-radius: 3px;
					}

					svg {
						fill: #000;
					}
				}
			}

			.inserter__sidebar__category-type {
				button {

					&.is-active {
						border-radius: 3px;
						background: #096aed;
						color: #fff;

						&:hover {
							background: #096aed;
							color: #fff;
						}

						&:focus {
							border: none;
							outline: none;
							box-shadow: none;
						}
					}

					&:hover {
						color: #096aed;
					}
				}

				.components-menu-item__item {
					text-transform: capitalize;
					display: flex;
					flex-wrap: wrap;
					justify-content: space-between;
					width: 100%;
					position: relative;

					&>span {
						opacity: 0.7;
					}

					span.new {
						position: absolute;
						right: 30px;
						font-size: 11px;
						font-weight: 500;
						padding: 3px 5px;
						background: #096aed;
						color: #eaeaea;
						border-radius: 3px;
						opacity: 1;
					}
				}
			}
		}

		// Content
		.inserter__content {
			width: calc(100% - 320px);

			.inserter__content-header {
				.search-results {
					color: #555;
					margin-bottom: 25px;
				}
			}

			.inserter__content-grid {
				.block-editor-inserter__no-results {
					display: flex;
					flex-wrap: wrap;
					justify-content: center;
					align-items: center;
					flex-direction: column;
					padding: 120px 20px;

					p {
						font-size: 16px;
						color: #555;
					}
				}

				.icons-list {
					display: grid;
					padding: 0;
					margin: 0;
					overflow: hidden;
					grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);

					button.icons-list__item {
						font-size: 25px;
						color: #555;
						cursor: pointer;
						display: flex;
						flex-direction: column;
						height: auto;
						padding: 5px;
						position: relative;
						word-break: break-word;

						&.is-active {
							background-color: #eeeeee;
						}

						&:hover {
							color: #096aed;
						}

						.icons-list__item-title {
							font-size: 12px;
							padding: 8px 2px 15px;
							overflow: hidden;
							display: block;
							line-height: 1.5;
						}
					}
				}
			}
		}
	}
}

@keyframes skeleton {
	0% {
		background-position: 100% 0;
	}

	100% {
		background-position: -100% 0;
	}
}

// skeleton
.blockIconsInserterOpen {
	.wp-icon-font-awesome__modal {

		// Header
		.components-modal__header {

			.components-modal__header-heading-container {
				h1 {
					position: relative;

					&::before {
						content: "";
						box-shadow: 0 4px 8px rgba(0, 0, 0, .01);
						background: linear-gradient(90deg, #dbdbdb 25%, #e9e9e9 50%, #dbdbdb 75%);
						background-size: 200% 100%;
						animation: skeleton 1.5s infinite ease-in-out;
						border-radius: 5px;
						width: 155px;
						height: 25px;
						position: absolute;
						top: 0;
						right: 0;
						z-index: 1;
					}
				}
			}

			.components-button {
				position: relative;

				&::before {
					content: "";
					box-shadow: 0 4px 8px rgba(0, 0, 0, .01);
					background: linear-gradient(90deg, #dbdbdb 25%, #e9e9e9 50%, #dbdbdb 75%);
					background-size: 200% 100%;
					animation: skeleton 1.5s infinite ease-in-out;
					border-radius: 5px;
					width: 33px;
					height: 33px;
					position: absolute;
					top: 0;
					right: 0;
					z-index: 1;
				}
			}
		}

		.components-modal__content {

			// Aside
			.inserter__aside {
				.inserter-aside__search {
					position: relative;
					height: 55px;

					&::before {
						content: "";
						box-shadow: 0 4px 8px rgba(0, 0, 0, .01);
						background: linear-gradient(90deg, #dbdbdb 25%, #e9e9e9 50%, #dbdbdb 75%);
						background-size: 200% 100%;
						animation: skeleton 1.5s infinite ease-in-out;
						border-radius: 5px;
						width: 100%;
						height: 40px;
						position: absolute;
						top: 0;
						right: 0;
						z-index: 1;
					}
				}

				.inserter__sidebar__category-type {
					button {

						&.is-active {
							background: transparent;
							color: transparent;

							&:hover {
								background: transparent;
								color: transparent;
							}
						}

						&:hover {
							background: transparent;
							color: transparent;
						}
					}

					.components-menu-item__item {
						position: relative;

						&::before {
							content: "";
							box-shadow: 0 4px 8px rgba(0, 0, 0, .01);
							background: linear-gradient(90deg, #dbdbdb 25%, #e9e9e9 50%, #dbdbdb 75%);
							background-size: 200% 100%;
							animation: skeleton 1.5s infinite ease-in-out;
							border-radius: 5px;
							width: 110%;
							height: 28px;
							position: absolute;
							top: -7px;
							right: -12px;
							z-index: 1;
						}

						span {
							background: transparent;
							color: transparent;
						}
					}
				}
			}

			// Content
			.inserter__content {
				.inserter__content-grid {
					.icons-list {
						button.icons-list__item {
							max-height: 51px;
							margin-bottom: 25px;

							i {
								background: transparent;
								color: transparent;

								&::before {
									content: "";
									box-shadow: 0 4px 8px rgba(0, 0, 0, 0.01);
									background: linear-gradient(90deg, #dbdbdb 25%, #e9e9e9 50%, #dbdbdb 75%);
									background-size: 200% 100%;
									animation: skeleton 1.5s infinite ease-in-out;
									border-radius: 5px;
									width: 50px;
									height: 29px;
									position: absolute;
									right: 40px;
									z-index: 1;
								}					
							}

							.icons-list__item-title {
								background: transparent;
								color: transparent;

								&::before {
									content: "";
									box-shadow: 0 4px 8px rgba(0, 0, 0, 0.01);
									background: linear-gradient(90deg, #dbdbdb 25%, #e9e9e9 50%, #dbdbdb 75%);
									background-size: 200% 100%;
									animation: skeleton 1.5s infinite ease-in-out;
									border-radius: 5px;
									width: 50px;
									height: 15px;
									position: absolute;
									bottom: -2px;
									right: 40px;
									z-index: 1;
								}
							}
						}
					}
				}
			}
		}
	}
}

$breakpoints: (
	1200px,
	1300px,
	1400px,
	1500px
);

@each $bp in $breakpoints {
	@media only screen and (min-width: $bp) {
		.wp-icon-font-awesome__modal {
			.components-modal__content {
				.inserter__content {
					.inserter__content-grid {
						.icons-list {

							@if $bp >=1300px {
								grid-template-columns: repeat(6, minmax(0, 1fr));
							}

							@if $bp >=1400px {
								grid-template-columns: repeat(7, minmax(0, 1fr));
							}

							@if $bp >=1500px {
								grid-template-columns: repeat(8, minmax(0, 1fr));
							}
						}
					}
				}
			}
		}
	}
}


@media only screen and (max-width: 1200px) {
	.wp-icon-font-awesome__modal {
		.components-modal__content {

			// Content
			.inserter__content {
				.inserter__content-grid {
					.icons-list {
						grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
					}
				}
			}
		}
	}
}

@media only screen and (max-width: 992px) {

	.wp-icon-font-awesome__modal {
		.components-modal__header {
			.components-modal__header-heading-container {
				h1 {
					font-size: 22px;
					padding-left: 18px;
				}
			}
		}

		.components-modal__content {
			padding: 25px 5px;

			.box-icons {
				flex-direction: column;
				gap: 25px;
			}

			// Aside
			.inserter__aside {
				width: 100%;
				padding: 0 46px;
				align-items: self-end;
			}

			// Content
			.inserter__content {
				width: 100%;
			}
		}
	}
}

@media only screen and (max-width: 768px) {

	.wp-icon-font-awesome__modal {
		.components-modal__content {

			// Content
			.inserter__content {
				.inserter__content-grid {
					.icons-list {
						grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
					}
				}
			}
		}
	}
}

@media only screen and (max-width: 580px) {
	.wp-icon-font-awesome__modal {
		.components-modal__content {

			// Content
			.inserter__content {
				.inserter__content-grid {
					.icons-list {
						grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
					}
				}
			}
		}
	}
}

// Temporary fix for the replace icon popover. Without this fix, the 
// popover appears over the Media Library modal when opened.
.icon-font-awesome__replace-popover {
	z-index: 100000;
}