@use '../../../../admin/assets/design/scss/_variables.scss' as *;

.adpresso-analytics-entity-filters .adpresso-close {
	align-items: center;
	border-radius: .5em;
	display: flex;
	height: 1.5em;
	justify-content: center;
	padding: .25em;
	width: 1.5em;
}

#adpresso-analytics-app-root  {

	margin-bottom: 7em;

	.adpresso-settings-nav.adpresso-tab-navigation {
		width: 100%;
		gap: .4em;
		margin-bottom: 2em;

		.adpresso-settings-heading {
			flex: 0 0 auto;
		}
		.adpresso-analytics-filterbar {
			display: flex;
			align-items: center;
			width: 100%;
			padding: 2em;
			height: 4em;
			border-bottom: 0.4em solid #EEE;
			gap: 2em;
			flex: 1 1 auto;
			min-width: 0;

			.adpresso-select-container {
				width: auto;
			}

			> * {
				flex: 1 1 auto;
				min-width: 0;
			}

			.adpresso-star-button, .adpresso-calendar-button {
				flex: 0 0 auto;
				background: none;
				border: none;
				padding: 0.5em;
				cursor: pointer;
				display: flex;
				align-items: center;
				justify-content: center;
				border-radius: 0.5em;
				color: inherit;
				transition: transform 0.1s ease, background-color 0.2s ease;

				&:hover {
					background-color: $color-primary-light;
					transform: scale(1.1);
				}

				&:focus-visible {
					outline: 2px solid $color-primary;
					outline-offset: 2px;
				}
			}

			.adpresso-date-range-picker {
				display: flex;
				gap: 1em;
				align-items: center;
			}
		}
	}

	.adpresso-analytics-entity-filters {
		display: flex;
		align-items: center;
		gap: 2em;
		padding: 2em;
		margin-bottom: 2em;
		top: 32px;
		z-index: 1;
		background: $color-white;

		transition: border-bottom-color 0.2s ease, box-shadow 0.2s ease;
		border-bottom: 1px solid transparent;

		&.is-stuck {
			position: sticky;
			border-bottom-color: $color-accent;
			background: #fff;
			border-bottom-width: 0.4em;
		}

		> div {
			flex: 1 1 0;
			min-width: 0;
		}

		> button.adpresso-close {
			flex: 0 0 auto;
		}
	}

	.adpresso-compare-ui {
		.adpresso-toggle-container {
			flex-direction: row-reverse;
			align-items: center;

			label {
				margin: 0;
			}
		}
	}

	.adpresso-analytics-dashboard {
		padding: 0 2em;
	}

	.adpresso-analytics-chart-container {
		padding: 1em;
		border: 0.12em solid grey;
		border-radius: 0.4em;
		margin: 2em 0;
		max-height: 70vh;

		.adpresso-analytics-metrictoggles {
			margin-bottom: 1em;
			display: flex;
			align-items: center;
			width: 100%;

			.adpresso-checkbox-group-buttons {
				width: auto;
			}

			.adpresso-premium-label {
				font-size: $font-size;
			}
		}
	}

	.adpresso-data-table {
		width: 100%;
		background: $color-white;
		border-spacing: 0;
		color: #222;
		border-bottom: 0.4em solid $color-accent;
		margin-bottom: 2em;

		th {
			border-bottom: 0.4em solid $color-accent;
			font-weight: 500;
		}

		td, th {
			padding: 2em;
			a {
				color: $color-text;
				padding: 0;
				display: inline;
			}
		}

		td {
			border-bottom: 0.12em solid #eee;
		}
	}
}


/*** OLD BELOW */

.adpresso-analytics-widget-container {
}

.adpresso-analytics-chart-container,
.adpresso-analytics-table-container {
	position: relative;

	.adpresso-data-table {
		font-size: $font-size;
	}
}

.adpresso-analytics-overlay {
	position: absolute;
	inset: 0; // Fills the whole container
	background-color: rgba(255, 255, 255, 0.75);
	z-index: 10;

	// Zentriert den Spinner
	display: flex;
	align-items: center;
	justify-content: center;

	.components-spinner {
		width: 36px;
		height: 36px;
	}
}

.adpresso-analytics-entity-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	flex-grow: 1; // Nimmt den restlichen Platz ein

	// Passe die Breite der TokenSelect-Felder an
	.adpresso-field {
		min-width: 200px;
		flex: 1; // Lässt die Felder wachsen
	}

	// Entferne das Standard-Label von BaseControl,
	// da der Platzhalter ausreicht.
	.components-base-control__label {
		display: none;
	}
}

.adpresso-compare-cell {
	&__current {
		display: block;
		font-weight: 600;
		font-size: 1.1em;
	}
	&__previous {
		display: block;
		font-size: 0.9em;
		color: #666;
	}
	&__delta {
		margin-left: 8px;
		&.is-positive {
			color: #28a745; // Grün
		}
		&.is-negative {
			color: #dc3545; // Rot
		}
	}
}
