@import '@wordpress/base-styles/breakpoints';
@import '@wordpress/base-styles/mixins';
@import '@wordpress/base-styles/variables';

$search_results_top_spacing: 24px;
$card_padding_small: 16px;
$card_padding_large: 24px;
$min_results_height: 180px;

.customer-home-help-search__footer {
	display: flex;
	gap: 16px;
	justify-content: space-between;
	align-items: center;
	padding: 16px;
	border-bottom-left-radius: 3px;
	border-bottom-right-radius: 3px;

	p {
		margin: 0;
		font-size: $font-body-small;
		color: var( --color-text-subtle );
	}

	button {
		flex-shrink: 0;
	}

	box-shadow: none;
	border-bottom: 1px solid var( --color-border-subtle );

	@include break-mobile {
		box-shadow: 0 0 0 1px var( --color-border-subtle );
		border: none;
	}
}

.customer-home__layout .help-search {
	.card-heading {
		margin-bottom: 16px;
	}

	&.customer-home__card {
		margin-bottom: 0;
		border-bottom-left-radius: 0;
		border-bottom-right-radius: 0;
		padding-bottom: 0;
	}

	.help-search__content {
		display: flex;
		justify-content: space-between;
	}

	.help-search__help-icon {
		display: block;
		width: 26px;
		height: 26px;
		margin-right: 12px;
		position: relative;

		background: var( --color-primary );
		box-shadow: 0 2px 6px rgba( 0, 0, 0, 0.15 );
		border: 1px solid var( --color-primary );
		border-radius: 100%;

		&::before {
			width: 18px;
			height: 18px;
			display: block;
			position: absolute;
			top: 4px;
			left: 4px;
			content: '';
			background: var( --color-surface );
			border-radius: 100%;
		}

		.gridicon {
			fill: var( --color-primary );
			height: 28px;
			width: 28px;
			transform: translate( -2px, -2px );
		}
	}

	.help-search__go-icon {
		fill: var( --color-neutral-20 );
		margin-left: auto; // push away from other cta content
		margin-right: -6px; // visually pull arrow RHS to edge of card
	}

	.inline-help__search {
		width: 100%; // Don't allow ellipsis items to flow outside box
	}

	.inline-help__results {
		min-height: $min_results_height;
	}

	.inline-help__results-title {
		padding-left: 0;
		padding-right: 0;
	}

	.inline-help__empty-results {
		padding-left: 0;
		padding-right: 0;
	}

	.card.search-card {
		margin: 0;
		border-radius: 2px;
		border-color: var( --color-border );

		.search {
			height: auto;
			border-radius: 2px;

			.search__input {
				padding: 6px 0;
				font-size: $font-body;
				color: var( --color-text );

				@include break-mobile {
					padding: 11px 0;
					font-size: $font-body-small;
				}
			}

			.search__input::placeholder {
				color: var( --color-text-subtle );
			}

			.search__input-fade {
				// compensate for border radius to avoid clipping
				margin-right: 1px;
			}

			.spinner {
				padding: 0 6px;
				width: 24px;
				height: 24px;
			}

			.search__icon-navigation .gridicon {
				padding: 0 6px;
				width: 24px;
				height: 24px;
			}
		}
	}

	// PlaceholderLines component
	.inline-help__results-placeholder {
		min-height: $min_results_height;
		margin: #{$search_results_top_spacing + 1} 0 0 #{-$search_results_top_spacing};
		padding: #{$search_results_top_spacing * 0.5 - 1px} 0 0 0;
	}

	.inline-help__results-placeholder-item {
		height: 15px;
		margin: 20px $card_padding_large 0;

		border-radius: 16px;
		background-color: var( --color-neutral-5 );

		&:first-child {
			margin-top: 12px;
		}

		&:last-child {
			margin-bottom: 12px;
		}

		&:nth-child( 4 ) {
			animation-delay: -5.1s;
		}
	}
}
