@import "./../shared/AnalysisFilters";

.column-growthstack {
	width: 5.875rem;
}

.column-growthstack-icons {
	display: flex;
	gap: 0.25rem;
	flex-wrap: wrap;
	align-items: center;
}

.column-growthstack-icons__button {
	background: none;
	border: none;
	color: inherit;
	font: inherit;
	line-height: normal;
	overflow: visible;
	padding: 0;
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	-webkit-font-smoothing: inherit;
	-moz-osx-font-smoothing: inherit;
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	user-select: none;
	text-decoration: none;
	cursor: pointer;
}

.column-growthstack-icons__button > * {
	pointer-events: none;
}

.column-growthstack-icons__button svg {
	width: 1.5rem;
	height: 1.5rem;
	object-fit: contain;
	object-position: 50%;
	fill: #ccc;
	color: #ccc;
}

.column-growthstack-icons__button:hover svg,
.column-growthstack-icons__button:focus svg {
	fill: #bbb;
	color: #bbb;
}

.column-growthstack-icons__button.is-active svg {
	fill: #2271b1;
	color: #2271b1;
}

.column-growthstack-icons__button.is-active:hover svg,
.column-growthstack-icons__button.is-active:focus svg {
	fill: #135e96;
	color: #135e96;
}

.column-growthstack-icons__button:focus {
	outline-offset: 2px;
}

/**
 * Admin pages
 */

:root {
	--growthstack-color-border: #e0e0e0;
	--growthstack-primary-dark: #343a40;
	--growthstack-primary: #3d8618;
	--growthstack-danger: #d73e3e;
	--growthstack-danger-light: #f8d7da;
	--growthstack-primary-light: #def1e9;
	--growthstack-primary-lightest: #f0f9f6;
	--growthstack-view-max-width: 1240px;

}

body.wp-admin.growthstack_page_growthstack-liana {
	background: #f8f8f8;
}

#wpbody:has(.growthstack-view) {
	padding-top: 0 !important;
}

#wpbody .growthstack-view {
	min-height: calc(100vh - 64px);
	display: flex;
	flex-direction: column;
}

#wpbody .growthstack-view > * {
	flex-shrink: 0;
}

#wpbody .growthstack-view,
#wpbody .growthstack-view * {
	box-sizing: border-box;
}

#wpcontent {
	.growthstack-view-header {
		margin-left: -20px;
		padding-left: 20px;
		padding-right: 20px;
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		// background: var(--growthstack-primary-lightest);

		background-image: url("./../../assets/hero.png");
		background-color: var(--growthstack-primary-light);
		background-position: center;
		background-repeat: no-repeat;
		background-size: cover;

		// color: #fff;

		/* border-bottom: 1px solid #ccd0d4; */
		width: calc(100% + 20px);
		box-sizing: border-box;

		* {
			box-sizing: border-box;
		}

		&__inner {
			flex-grow: 1;
			gap: 0 0.75rem;
			display: flex;
			align-items: center;
			max-width: var(--growthstack-view-max-width);
			padding-inline: 10px;
			margin: 0 auto;
			width: 100%;
		}

		&__title {
			font-size: 0.9375rem;
			font-weight: 400;
			color: currentcolor;
			margin: 0;
			line-height: 1;
			// flex-grow: 1;
			// padding-right: 1rem;

			@media (min-width: 1000px) {
				font-size: 0.9375rem;
			}
		}

		&__version {
			display: inline-block;
			padding: 4px 5px;
			background: rgba(255, 255, 255, 0.8);
			border-radius: 6px;
			color: rgba(0, 0, 0, 0.7);
			font-size: 0.625rem;
			line-height: 1;
			margin-left: -4px;
			margin-bottom: -1px;
			text-transform: uppercase;

			&.is-pro {
				background: #4ca74f;
				color: #fff;
			}
		}

		&__logo {
			padding: 1rem 0;
			display: flex;
			align-items: center;

			a {
				display: block;
				line-height: 0;
			}

			svg {
				max-width: 24px;
				width: 100%;
				height: auto;
			}
		}
	}

	.growthstack-view-header + #wpbody {
		padding-top: 0;
	}

	@media screen and (max-width: 600px) {
		&:has(.growthstack-view-header) {
			padding-top: 46px;
		}
	}

	.growthstack-view-tabs {
		margin-left: -20px;
		padding-left: 20px;
		padding-right: 20px;
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		// background: var(--growthstack-primary-lightest);

		border-bottom: 1px solid #ddd;
		box-shadow: 0 2px 14px 0 rgba(0, 0, 0, 0.013);

		background: #fff;

		// color: #fff;

		/* border-bottom: 1px solid #ccd0d4; */
		width: calc(100% + 20px);
		box-sizing: border-box;

		& > * {
			max-width: var(--growthstack-view-max-width);
			// padding-block: 10px;
			padding-inline: 10px;
			margin: 0 auto;
			width: 100%;
		}
	}

	.growthstack-view-tabs:has(+ .growthstack-view-banner) {
		border: 0;
	}
}

#wpbody {
	.growthstack-view-content {
		flex-grow: 1;
		display: flex;

		&__inner {
			max-width: var(--growthstack-view-max-width);
			margin: 0 auto;
			// width: calc(100% - 20px);
			padding-right: 20px;
			width: 100%;
			display: flex;
			flex-direction: column;
		}
	}

	.growthstack-view {
		.growthstack-view-content__inner {
			margin-top: 1.5rem;
		}
	}
}

#wpbody {
	.growstrack-view__hero {
		padding-top: 1.5rem;
		padding-bottom: 3rem;
		text-align: center;

		// temp hack to hide hero for now
		// Only hide when .growthstack-analytics-site is present
		:has(.growthstack-analytics-site) & {
			display: none;
		}
	}
}

@media screen and (min-width: 783px) {
	#wpcontent:has(.notice) .growthstack-view-header {
		margin-bottom: 1rem;
	}
}

#wpcontent :has(.notice) .growthstack-view {
	margin-top: 1rem;
}

/**
 * Settings page
 */

#wpbody .growthstack-settings-old {
	box-sizing: border-box;
	width: 100%;
	display: flex;
	flex-direction: column;
}

#wpbody .growthstack-settings-old__forms {
	display: flex;
	flex-direction: column;
	gap: 2.5rem;
}

#wpbody .growthstack-settings-old__grid {

	/* max-width: 1080px; */
	max-width: var(--growthstack-view-max-width);
	margin-inline: auto;
	width: 100%;
	display: grid;
	grid-template-columns: repeat(1, minmax(0, 1fr));
	gap: 1.5rem;
}

@media (min-width: 1500px) {
	#wpbody .growthstack-settings-old__grid {
		margin-block: 2rem;
	}
}

@media (min-width: 1300px) {
	#wpbody .growthstack-settings-old__grid {
		grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
		gap: 2.5rem;
	}
}

#wpbody .growthstack-settings-old__box {
	padding: 2rem;
	background: #fff;
	border-radius: 0.75rem;
	box-shadow: 0 1px 1rem rgba(0, 0, 0, 0.025);
}

#wpbody .growthstack-settings-old__box > :first-child {
	margin-top: 0;
}

#wpbody .growthstack-settings-old__box > :last-child {
	margin-bottom: 0;
}

#wpbody .growthstack-settings-old__box h2 {
	margin-top: 0;
	margin-bottom: 0.75rem;
}

#wpbody .growthstack-settings-old__fields td,
#wpbody .growthstack-settings-old__fields th {
	display: block;
	padding: 0;
}

#wpbody .growthstack-settings-old__fields .notice {
	margin: 0 0 0.75rem 0;
}

#wpbody .growthstack-settings-old__fields .form-table {
	margin-top: 1.5rem;
}

#wpbody .growthstack-settings-old__fields p {

	/* font-size: .875rem; */
}

#wpbody .growthstack-settings-old__fields label {
	display: block;
	margin-bottom: 0.5rem;
}

#wpbody .growthstack-settings-old__fields tbody input {
	width: 100%;
}

#wpbody .growthstack-settings-old__fields tbody {
	display: grid;
	grid-template-columns: repeat(1, minmax(0, 1fr));
	gap: 0.75rem;
}

#wpbody .growthstack-settings-old__fields input {
	padding: 0.25rem 0.5rem;
}

#wpbody .growthstack-settings-old__fields .submit {
	display: flex;
	justify-content: flex-start;
	margin-top: 1rem;
	margin-bottom: 0;
	padding-bottom: 0;
}

#wpbody .growthstack-settings-old__fields .submit input {
	padding: 0.375rem 1.5rem;
}

#wpbody .growthstack-settings-old-hero {
	margin-left: -20px;
	padding-left: 20px;
	padding-right: 20px;
	width: calc(100% + 20px);
	padding-block: 1.5rem;
}

@media (min-width: 1000px) {
	#wpbody .growthstack-settings-old-hero {
		padding-block: 2rem;
	}
}

@media (min-width: 1500px) {
	#wpbody .growthstack-settings-old-hero {
		padding-block: 4rem;
	}
}

#wpbody .growthstack-settings-old__status {
	height: max-content;
	position: sticky;
	top: 32px;
}

#wpbody .growthstack-settings-old-statuses {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
}

#wpbody .growthstack-settings-old-status__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	margin: 0 0 0.75rem;
}

#wpbody .growthstack-settings-old-status h3 {
	font-size: 0.875rem;
	margin: 0;
}

#wpbody .growthstack-settings-old-status p {
	display: block;
	clear: both;
	margin: 0 0 0.625rem;
}

#wpbody .growthstack-settings-old-status__indicator {
	display: block;
	padding: 0.3125rem 0.5625rem;
	border-radius: 5rem;
	border: 1px solid;
	margin-top: -0.25rem;
}

#wpbody .growthstack-settings-old-status__indicator.is-ready {
	border-color: #3d8618;
	color: #3d8618;
}

#wpbody .growthstack-settings-old-status__indicator.is-not-ready {

	/* background: #F8D7DA; */
	border-color: #d73e3e;
	color: #d73e3e;
}

.growthstack-analytics-site-popular {
	display: grid;
	gap: 1.5rem;

	&__filters {
		display: flex;
		align-items: center;
		gap: 1rem;
		flex-wrap: wrap;
		.gs-most-popular-post-type-select {
			min-height: 36px;
			padding: 0 2rem 0 0.625rem;
			border: 0 !important;
			color: inherit;
			border-radius: 3px;
			&:focus {
				outline: 2px solid var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
				outline-offset: -2px !important;
			}
		}
	}


	@media (min-width: 700px) {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.gs-table {
		th + th,
		th + th + th,
		td + td,
		td + td + td {
			text-align: right;
			padding-inline: 14px;
		}
	}
}

.gs-header-box {
	--gs-box-padding: 1.5rem;
	--gs-box-y-padding: 0;
	padding: var(--gs-box-y-padding) var(--gs-box-padding);
	padding-inline: 0;
	margin-bottom: var(--gs-box-padding);
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 16px;

	h2 {
		margin: 0;
		@media (min-width: 600px) {
			font-size: 1.375rem;
		}
	}

	p {
		max-width: 760px;
		margin-bottom: 0;
	}

	&__actions {
		display: flex;
		align-items: center;
		gap: 24px;
		flex-wrap: wrap;
	}
}

.growthstack-analytics-site-audience {
	display: grid;
	--columns: 1;
	grid-template-columns: repeat(var(--columns), minmax(0, 1fr));
	gap: 1.5rem;
	position: relative;
	@media (min-width: 700px) {
		--columns: 2;
	}
	@media (min-width: 1000px) {
		--columns: 3;
	}
	&.is-placeholder {
		.gs-box {
			opacity: .5;
			filter: blur(2px);
			pointer-events: none;
		}
	}
}

.growthstack-analytics-site-audience-placeholder {
	position: absolute;
	top: 3.5rem;
	left: 50%;
	transform: translateX(-50%);
	width: 85%;
	max-width: 800px;
	padding: 2rem;
	margin-inline: auto;
	background: rgba(255, 255, 255, 0.9);
	z-index: 50;
	display: block;
	border-radius: .375rem;
	box-shadow: 0 3px 32px 0 rgba(0, 0, 0, 0.10);
	text-align: center;
	&__inner {
		display: block;
		max-width: 480px;
		margin-inline: auto;

		p {
			margin-bottom: 0.75rem;
		}

		.components-button {
			margin-top: 0.5rem;
		}
	}
}

.gs-audience-placeholder {
	text-align: center;
	width: 100%;

	img {
		max-width: 100%;
		width: 224px;
		height: auto;
		aspect-ratio: 1/1;
		object-fit: contain;
		margin-top: 0.75rem;
		margin-bottom: 0.75rem;
	}

}

// hide audience banner on non-audience tabs
.wp-admin:has(.growthstack-view--overview):not(:has(.gs-tab[data-slug="audience"].is-active)) .growthstack-view-banner {
	display: none !important;
}
