@import "~@wordpress/base-styles/colors";
@import "~@wordpress/base-styles/variables";
@import "~@wordpress/base-styles/mixins";
@import "~@wordpress/base-styles/breakpoints";
@import "~@wordpress/base-styles/animations";
@import "~@wordpress/base-styles/z-index";

@include wordpress-admin-schemes();

body.admin-color-fresh {
	@include admin-scheme(#2271b1);
}

.simpay-help-body-locked {
	overflow: hidden;

	ul#adminmenu a.wp-has-current-submenu:after,
	ul#adminmenu > li.current > a.current:after {
		border-right-color: #797979;
	}

	// <SearchControl /> compat for WordPress 5.7-5.8
	&.branch-5-7,
	&.branch-5-8 {

		.components-search-control {
			position: relative;

			input[type="search"].components-search-control__input {
				@include input-control;
				display: block;
				padding: $grid-unit-20 $grid-unit-60 $grid-unit-20 $grid-unit-20;
				background: $gray-100;
				border: none;
				width: 100%;
				height: $grid-unit-60;

				/* Fonts smaller than 16px causes mobile safari to zoom. */
				font-size: $mobile-text-min-font-size;
				@include break-small {
					font-size: $default-font-size;
				}

				&:focus {
					background: $white;
					box-shadow: 0 0 0 $border-width-focus var(--wp-admin-theme-color);
				}

				&::placeholder {
					color: $gray-700;
				}

				&::-webkit-search-decoration,
				&::-webkit-search-cancel-button,
				&::-webkit-search-results-button,
				&::-webkit-search-results-decoration {
					-webkit-appearance: none;
				}
			}
		}

		.components-search-control__icon {
			position: absolute;
			top: 0;
			right: calc( ( $grid-unit-60 - $icon-size ) / 2 );
			bottom: 0;
			display: flex;
			align-items: center;

			> svg {
				margin: $grid-unit-10 0;
			}
		}

		.components-search-control__input-wrapper {
			position: relative;
		}
	}
}

.simpay-help-popover {
	padding: 20px;
	min-width: 300px;

	h4 {
		margin: 0;
		font-size: 16px;
	}
}

.simpay-help-panel {
	background-color: $white;
	height: 100%;
	width: 100%;
	max-width: 570px;
	position: fixed;
	z-index: 1053;
	top: 0;
	right: 0;
	bottom: 0;
	overflow-x: hidden;
	transition: 0.5s;
	transform: translateX(0%);
	display: flex;
	flex-direction: column;

	.admin-bar & {
		height: calc(100% - $admin-bar-height-big);
		top: $admin-bar-height-big;

		@include break-medium {
			height: calc(100% - $admin-bar-height);
			top: $admin-bar-height;
		}
	}

	&__header {
		font-size: 15px;
		font-weight: bold;
		padding: $grid-unit-15 $grid-unit-30;
		background-color: #007cba;
		background-color: var(--wp-admin-theme-color);
		position: sticky;
		top: 0;
		z-index: 2;
		display: flex;
		align-items: center;
		justify-content: space-between;

		&,
		.components-button {
			color: $white;

			&:focus {
				box-shadow: 0 0 0 var(--wp-admin-border-width-focus) rgba(255, 255, 255, 0.2);
			}
		}
	}

	&__footer {
		margin-top: auto;
		display: flex;
		border-top: 1px solid $gray-200;
		background: #fff;
		position: sticky;
		bottom: 0;
		z-index: 2;

		&-action {
			text-align: center;
			flex-basis: 50%;
			padding: $grid-unit-30;

			svg {
				fill: $gray-800;
			}

			h4 {
				font-size: 18px;
				margin: 0;
			}

			p {
				font-size: 14px;
			}

			h4,
			p {
				color: $gray-800;
			}

			&:first-child {
				border-right: 1px solid $gray-200;
			}
		}

		&-upgrade-button.components-button {
			color: #fff;
			font-weight: bold;
			background-color: #00aa63 !important;
			box-shadow: inset 0 0 0 1px #00aa63 !important;

			&:hover:not(:disabled) {
				color: #fff;
				background-color: #07c575 !important;
			}
		}
	}

	&__search {
		padding: $grid-unit-30;
	}

	&__results {
		margin-top: $grid-unit-30;
	}

	&__none {
		font-size: 16px;
		color: $gray-700;
	}

	&__result {
		margin-bottom: $grid-unit-30;
		padding-bottom: $grid-unit-30;
		border-bottom: 1px solid $gray-200;

		&:last-child {
			border-bottom: 0;
		}

		a {
			font-size: 16px;
			text-decoration: none;
		}

		p {
			margin: $grid-unit-10 0 0;
		}
	}

	&__categories {
		margin-top: calc( $grid-unit-20 * -1 );
	}

	&__category {
		padding: $grid-unit-20 0;
		border-bottom: 1px solid $gray-200;

		> div {
			margin-top: $grid-unit-15;
		}

		a {
			font-size: 14px;
			text-decoration: none;
			display: block;
			margin-bottom: $grid-unit-10;
		}
	}

	&__category-title {
		color: $gray-800;
		font-size: 18px;
		margin: 0;
		padding: 0;
		width: 100%;
		height: auto;
		background: none;
		border: 0;
		box-shadow: none;
		appearance: none;
		border-radius: 0;
		display: flex;
		justify-content: space-between;
		align-items: center;

		svg {
			fill: $gray-600;
		}

		&:hover {
			cursor: pointer;
		}
	}
}

.simpay-help-backdrop {
	position: fixed;
	z-index: 1052;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	background-color: $black;
	border: 0;
	box-shadow: none;
	appearance: none;
	opacity: 0.5;
	transition: 0.5s;

	@include break-medium {

		&,
		.folded &,
		.auto-fold.folded & {
			left: $admin-sidebar-width-collapsed;
		}
	}

	@include break-large {
		.auto-fold & {
			left: $admin-sidebar-width;
		}
	}
}