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

.main.hosting-dashboard-layout-column,
.main.hosting-dashboard-layout {
	background: var( --color-surface );
	margin: 0;
	border-radius: 8px;
	overflow: hidden;
	height: calc( 100vh - 32px );
	padding-block-end: 0;

	header.current-section {
		margin: 0;
		padding: 0;

		button {
			padding: 20px 0;
		}
	}
}

.main.hosting-dashboard-layout-column {
	border-radius: 8px;
	display: flex;
	flex-direction: column;

	@include break-small {
		height: 100%;
		padding-block-start: 1px;
		border: 1px solid $gray-200;
		box-sizing: border-box;
	}
}

.hosting-dashboard-layout-with-columns__container,
.hosting-dashboard-layout__container {
	max-width: 100%;
	max-height: 100%;
	display: flex;
	margin: auto;
	padding: 0;
}

.hosting-dashboard-layout__container {
	flex-direction: column;
}

.hosting-dashboard-layout-with-columns__container {
	flex-direction: row;
	flex-wrap: nowrap;
	gap: 16px;
	height: 100%;
	overflow: hidden;
}

.hosting-dashboard-layout-column {
	flex: 1;
}

.hosting-dashboard-layout__body {
	width: 100%;
	overflow-y: auto;
	padding-block-start: 16px;
	padding-block-end: 32px;
}

.hosting-dashboard-layout__top-wrapper,
.hosting-dashboard-layout__body {
	margin-inline: 0;
	max-height: 100%;

	> * {
		padding-inline: 16px;

		@include breakpoint-deprecated( '>660px' ) {
			// TODO: This is currently overridden as `none` in the Sites Dashboard for both Dotcom and A4A to align with Core's DataViews.
			// Consider removing this max-width as the default across all layouts.
			max-width: 1500px;
			margin-inline: auto !important;
			padding-inline: 64px;
		}
	}
}

.hosting-dashboard-layout__top-wrapper {
	padding-block-start: 16px;
	border-block-end: 1px solid var( --color-neutral-5 );

	@include breakpoint-deprecated( '<660px' ) {
		padding: 0;
	}

	.notice-banner {
		&.is-info {
			border-left-color: var( --color-primary );

			.notice-banner__icon {
				fill: var( --color-primary );
			}
		}
	}

	// If we don't have a navigation, we will require some spacing on the borders.
	&:not( .has-navigation ) {
		padding-block-end: 16px;
	}
}

.main.hosting-dashboard-layout.is-with-border {
	@include breakpoint-deprecated( '>660px' ) {
		.hosting-dashboard-layout__top-wrapper {
			border-block-end: 1px solid var( --color-neutral-5 );
		}
	}
}

.main.hosting-dashboard-layout-column.is-scrollable {
	height: auto;
	overflow-y: scroll;
}

.hosting-dashboard-layout__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin: 0 auto;
	height: 100%;
	min-height: 40px;

	> * + * {
		margin-inline-start: 24px;
	}

	@include breakpoint-deprecated( '<1280px' ) {
		flex-wrap: wrap;
		gap: 16px;

		> * + * {
			margin-inline-start: 0;
		}
	}
}

.hosting-dashboard-layout__header-actions {
	width: 100%;
	display: flex;

	> * {
		flex-grow: 1;
	}

	&.is-column-flex-align {
		display: flex;
		flex-direction: column;
		align-items: normal;
		justify-content: normal;
	}

	@include break-medium {
		width: auto;
		> * {
			flex-grow: 0;
		}
	}

	@include breakpoint-deprecated( '<660px' ) {
		align-items: center;
		justify-content: space-between;
		> * {
			flex-grow: 0;
		}
		.current-section button {
			border: none;
		}

		.current-section .gridicons-menu {
			margin: 0;
		}
	}

	a {
		font-weight: normal;
	}
}

.hosting-dashboard-layout__sticky-header {
	position: fixed;
	width: calc( 100% );
	left: 0;
	top: var( --masterbar-height );
	background-color: rgba( 246, 247, 247, 0.95 );
	box-shadow: 2px 2px 2px 0 rgb( 0 0 0 / 8% );
	z-index: 1001;
	height: 74px;

	.hosting-dashboard-layout__header {
		flex-wrap: nowrap;
		max-width: 1500px;
		padding-inline: 48px;

		> * {
			width: auto;
		}
	}

	.hosting-dashboard-layout__header-main,
	.hosting-dashboard-layout__header-actions {
		margin: 0;
	}

	.hosting-dashboard-layout__header-subtitle {
		display: none;
	}

	.hosting-dashboard-layout__header-title {
		margin-block-end: 0;
	}

	@include breakpoint-deprecated( '>660px' ) {
		width: calc( 100% - var( --sidebar-width-min ) );
		left: var( --sidebar-width-min );
	}

	@include breakpoint-deprecated( '>960px' ) {
		width: calc( 100% - var( --sidebar-width-max ) );
		left: var( --sidebar-width-max );
	}
}

.hosting-dashboard-layout__header-breadcrumb {
	margin-block-end: 4px;

	&.is-hidden-on-mobile {
		@include breakpoint-deprecated( '<660px' ) {
			display: none;
		}
	}
}

.hosting-dashboard-layout__header-title {
	color: var( --studio-gray-80, #2c3338 );
	font-size: rem( 24px );
	font-weight: 500;
	line-height: 1.25;
	letter-spacing: -0.5px;
}

.hosting-dashboard-layout__header-subtitle {
	font-size: rem( 16px );
	font-weight: 400;
	line-height: 1.5;
	color: var( --color-neutral-60 );
	margin: 8px 0 0 0;

	@include breakpoint-deprecated( '<660px' ) {
		display: none;
	}
}

.section-nav.hosting-dashboard-layout__navigation {
	margin-block-start: 16px;

	&.section-nav-updated .count {
		border-radius: 4px;
		border: 1px solid var( --color-neutral-5 );
		background: var( --color-surface );
	}

	.section-nav__mobile-header-text .count {
		margin-inline-start: 8px;
	}

	.select-dropdown__item.is-selected .count {
		color: var( --color-text );
	}

	.select-dropdown__header {
		border-width: 0;

		.count {
			top: 12.5px;
		}

		@include breakpoint-deprecated( '>660px' ) {
			border-width: 1px;
		}
	}

	.section-nav-tab {
		box-sizing: border-box;
		max-height: 48px;
	}

	.section-nav-tabs.is-dropdown {
		width: 100%;
		margin: 0 0 1px 0;

		@include breakpoint-deprecated( '>660px' ) {
			margin-block-end: 12px;
		}
	}

	.select-dropdown__options {
		margin-inline: -1px;
	}

	.section-nav-tabs__dropdown .select-dropdown__container {
		max-width: unset;
		width: 100%;
	}

	.section-nav-tabs__dropdown {
		// Since the search below the dropdown has z-index: 22,
		// we need to make sure the dropdown is above it
		z-index: 23;
	}

	@include breakpoint-deprecated( '>1040px' ) {
		margin-inline: -16px;
	}

	.section-nav-tab__text {
		&,
		.content {
			display: flex;
			align-items: center;
			justify-content: space-between;
			gap: 8px;
		}
	}
}
