@use "@automattic/jetpack-base-styles/gutenberg-base-styles" as gb;

.services {
	outline: 1px solid var(--jp-gray-5);
	border-radius: 4px;

	.service-list-item {
		margin-bottom: 0;

		&:not(:last-child) {
			border-bottom: 1px solid var(--jp-gray-5);
		}
	}

	.service-item {
		padding: 0.75rem;

		@include gb.break-small {
			padding: 1rem;
		}
	}

	.service-item-info {
		display: flex;
		gap: 1rem;
		align-items: center;
	}

	.service-basics {
		flex: 1;
		display: flex;
		flex-direction: column;
		gap: 0.25rem;
	}

	.heading {
		display: flex;
		gap: 1rem;
		align-items: center;
	}

	.badges {
		display: flex;
		gap: 0.5rem;
	}


	.title {
		font-size: 16px;
		line-height: 24px;
		font-weight: 600;
		color: var(--jp-gray-80);
	}

	.description {
		font-size: 14px;
		color: var(--jp-gray-50);
	}

	.actions {
		display: flex;
		gap: 0.5rem;
	}

	.learn-more {

		&:global(.components-button) {
			padding-inline: 6px;
			font-size: 14px;
			font-weight: 500;
			line-height: 20px;

			span {
				display: flex;
			}
		}
	}

	.service-panel {
		border: 0;

		:global(.components-panel__body) {
			border-top: 0;
			border-bottom: 0;
			padding: 0;
		}

		:global(.components-panel__body.is-opened) {
			margin-top: 1rem;
		}
	}

	.active-connection {
		color: var(--jp-green-50);
		white-space: nowrap;
	}

	.broken-connection-alert {
		margin-block: 0;
		font-size: var(--font-body-small);
	}

	.service-connection-list {
		border-top: 1px solid var(--jp-gray-5);
		padding-top: 1rem;

		li:not(:last-child) {
			margin-bottom: 1rem;
		}

		*[inert="true"] {
			opacity: 0.7;
		}
	}
}

.example-wrapper {
	display: grid;
	grid-auto-columns: minmax(0, 1fr);
	grid-auto-flow: column;
	font-size: 15px;
	margin-top: 0.4rem;

	&.small {
		grid-auto-flow: row;
		grid-gap: 2rem;
		height: auto;
		min-height: unset;
	}

	img {
		max-height: 520px;
		max-width: 100%;
	}

	>div {
		padding: 0.4rem;

		&:has(img) {
			margin-inline-start: auto;
			margin-inline-end: auto;
		}
	}
}

.service-connection {
	display: flex;
	gap: 1rem;

	.connection-details {
		flex: 1;
		display: flex;
		flex-direction: column;
		align-items: flex-start;
		gap: 0.5rem;
	}

	.profile-pic {
		width: 38px;
		height: 38px;
	}


	.disconnect {

		&:global(.components-button.is-tertiary) {
			font-size: 1rem;
			font-weight: 400;
			color: var(--jp-gray-50);
		}
	}
}

.connect-form-wrapper {
	margin-top: 2rem;
	display: flex;
	justify-content: flex-end;
}

.connect-form {
	display: flex;
	gap: 1.5rem;
	flex-direction: column;
	justify-content: flex-end;
	width: 100%;

	.connect-button {

		&:global(.components-button) {
			padding: 6px 16px;
			font-size: 14px;
			font-weight: 500;
			line-height: 20px;
		}
	}

	.fields-wrapper {
		display: flex;
		flex-direction: column;
		justify-content: flex-end;
		width: 100%;
		gap: 1rem;

		&.input {
			justify-content: flex-start;
		}

		@include gb.break-medium {
			flex-direction: row;
		}
	}

	.fields-item {
		display: flex;
		flex-direction: column;
		gap: 0.5rem;
		flex-basis: 100%;

		@include gb.break-medium {
			flex-basis: 50%;
		}

		@include gb.break-small {

			button {
				align-self: flex-end;
			}
		}
	}

	label {
		font-weight: 600;
	}

	input {
		min-width: 220px;
		height: auto;
		font-size: var(--font-body);
		line-height: 22px;
		padding: var(--spacing-base) calc(var(--spacing-base) * 3); // To make the inputs of the same size as the Connect button

		// Override the default input styles for small screens
		@media (max-width: #{ (gb.$break-medium) }) {
			padding: 0 8px;
			font-size: 14px;
		}

		&.error {
			border-color: var(--jp-red);
			box-shadow: 0 0 0 1px var(--jp-red);
		}
	}
}

.mark-shared-wrap {
	display: flex;
	gap: 0.5rem;
}

.error-text.error-text {
	color: var(--jp-red);
	font-style: italic;
}
