/* Eventbrite Checkout block: editor-only styles. */

.wpeec-placeholder-form {
	display: flex;
	gap: 8px;
	width: 100%;
	max-width: 560px;

	.components-base-control {
		flex: 1 1 auto;
	}
}

.wpeec-placeholder-error {
	margin: 8px 0 0;
	color: #cc1818;
	font-size: 13px;
}

.wpeec-editor-preview {
	position: relative;
	width: 100%;

	iframe {
		display: block;
		width: 100%;
		border: 0;
		transition: height 0.2s ease;
	}

	// Blocks clicks so the block gets selected instead of the checkout. Removed once selected.
	&__overlay {
		position: absolute;
		inset: 0;
		cursor: pointer;
	}

	&__note {
		margin: 0.5em 0 0;
		font-size: 12px;
		opacity: 0.7;
	}
}

// Buttons are previews only; clicks select the block.
.wpeec-editor-button {
	pointer-events: none;
}

// The two picture cards in the sidebar.
.wpeec-mode-cards {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 8px;

	&__help {
		grid-column: 1 / -1;
		margin: 4px 0 0;
	}
}

.wpeec-mode-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	padding: 8px 4px;
	border: 1px solid #ddd;
	border-radius: 4px;
	background: #fff;
	color: #1e1e1e;
	font: inherit;
	font-size: 11px;
	line-height: 1.25;
	text-align: center;
	cursor: pointer;
	transition: border-color 0.1s ease, box-shadow 0.1s ease;

	&:hover {
		border-color: #949494;
	}

	&:focus-visible {
		outline: 2px solid var(--wp-admin-theme-color, #3858e9);
		outline-offset: 1px;
	}

	&.is-selected {
		border-color: var(--wp-admin-theme-color, #3858e9);
		box-shadow: inset 0 0 0 1px var(--wp-admin-theme-color, #3858e9);
		background: color-mix(in srgb, var(--wp-admin-theme-color, #3858e9) 6%, #fff);
	}

	&__picture {
		display: block;
		width: 100%;
		max-width: 80px;
	}

	svg {
		display: block;
		width: 100%;
		height: auto;
		fill: none;
		stroke: currentColor;
		stroke-width: 1.5;
		opacity: 0.75;

		.is-fill {
			fill: currentColor;
			stroke: none;
		}

		.is-light {
			opacity: 0.35;
		}

		.is-card {
			fill: #fff;
		}

		// The dimmed page behind the popup.
		.is-shade {
			fill: currentColor;
			stroke: none;
			opacity: 0.22;
		}

		.is-accent {
			fill: var(--wp-admin-theme-color, #3858e9);
			opacity: 1;
		}
	}

	&.is-selected svg {
		opacity: 1;
	}

	&__label {
		display: block;
		min-height: 2.5em;
	}
}

// http sites: Eventbrite refuses to show the checkout.
.wpeec-editor-notice {
	padding: 16px;
	border: 1px dashed rgba(128, 128, 128, 0.5);
	border-radius: 6px;

	p {
		margin: 0;
		font-size: 13px;
	}
}

// "Preview the popup" link after the note under the button.
.wpeec-editor-preview__open.components-button.is-link {
	font-size: inherit;
	vertical-align: baseline;
}

// The popup checkout preview: Eventbrite's popup is sized for a full window,
// so the dialog's content area is given to it edge to edge.
.wpeec-popup-preview {
	width: min(1100px, 92vw);
	max-width: none;

	.components-modal__content {
		padding: 0;
		overflow: hidden;
	}

	.components-modal__header {
		padding-left: 24px;
		padding-right: 24px;
	}

	iframe {
		display: block;
		width: 100%;
		height: min(620px, calc(100vh - 380px));
		border: 0;
	}
}

// Colour settings: slim rows in a bordered list, like WordPress's own
// colour rows, each opening a small panel.
.wpeec-color-list {
	margin-bottom: 12px;
	border: 1px solid #e0e0e0;
	border-radius: 2px;

	.wpeec-color-field + .wpeec-color-field {
		border-top: 1px solid #e0e0e0;
	}
}

.wpeec-color-field {
	display: block;
	width: 100%;
}

.wpeec-color-field__toggle.components-button {
	width: 100%;
	height: 40px;
	gap: 8px;
	padding: 0 12px;
	border-radius: 0;
	color: #1e1e1e;

	&:hover,
	&[aria-expanded="true"] {
		background: #f0f0f0;
		color: #1e1e1e;
	}

	.component-color-indicator {
		flex: none;
		width: 20px;
		height: 20px;
		border-radius: 50%;
	}
}

.wpeec-color-field__name {
	flex: 1 1 auto;
	text-align: left;
}

.wpeec-color-field__value {
	color: #757575;
	font-size: 12px;

	&.is-hex {
		color: #1e1e1e;
		font-family: monospace;
	}
}

.wpeec-color-field__content {
	display: flex;
	flex-direction: column;
	gap: 12px;
	width: 232px;
	padding: 12px;
	box-sizing: border-box;
}

.wpeec-color-field__swatches {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.wpeec-color-field__swatch {
	width: 24px;
	height: 24px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
	cursor: pointer;

	&.is-selected {
		box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2), 0 0 0 2px #fff, 0 0 0 4px var(--wp-admin-theme-color, #3858e9);
	}

	&:focus-visible {
		outline: 2px solid var(--wp-admin-theme-color, #3858e9);
		outline-offset: 2px;
	}
}

.wpeec-color-field__custom {
	display: flex;
	align-items: center;
	gap: 8px;
}

.wpeec-color-field__picker {
	flex: none;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 1px solid #949494;
	border-radius: 2px;
	background: none;
	cursor: pointer;

	&::-webkit-color-swatch-wrapper {
		padding: 2px;
	}

	&::-webkit-color-swatch {
		border: 0;
		border-radius: 1px;
	}
}

.wpeec-color-field__hex {
	display: flex;
	flex: 1 1 auto;
	align-items: center;
	min-width: 0;
	height: 32px;
	padding: 0 8px;
	border: 1px solid #949494;
	border-radius: 2px;
	font-family: monospace;

	span {
		color: #757575;
	}

	input[type="text"] {
		width: 100%;
		min-width: 0;
		height: 30px;
		min-height: 0;
		padding: 0 0 0 2px;
		border: 0;
		box-shadow: none;
		background: transparent;
		font-family: monospace;
		font-size: 13px;

		&:focus {
			outline: none;
			box-shadow: none;
		}
	}

	&:focus-within {
		border-color: var(--wp-admin-theme-color, #3858e9);
		box-shadow: 0 0 0 1px var(--wp-admin-theme-color, #3858e9);
	}
}
