/*
 * Admit admin screens. WooCommerce and WordPress classes do the styling;
 * this only fills the gaps they leave. Loaded on Admit's screens only.
 */

/* Ticket tab: WooCommerce floats text and number inputs but not date-time
   ones, which put the help tip before the field instead of after it. */
.woocommerce_options_panel input[type="datetime-local"] {
	float: left;
}

/* Ticket tab section intros: a label with text beside it, like a
   checkbox row. */

/* WooCommerce drops a field's description under the field on narrower
   screens; an intro's text stays level with its label. */
.woocommerce_options_panel .salus-admit-section-intro .description {
	display: inline;
	clear: none;
	margin-left: 0;
}

/* Ticket tab tables (bundle parts, price tiers) start in the field column,
   under the field they belong to. */
.salus-admit-panel-table {
	overflow-x: auto;
	padding: 0 20px 12px 162px;
}

.woocommerce_options_panel .salus-admit-panel-table p {
	margin: 9px 0;
	padding: 0;
}

.salus-admit-panel-table td {
	vertical-align: middle;
}

/* Keep the Add button clear of the table's bottom border. */
.salus-admit-panel-table table {
	margin-bottom: 12px;
}

.woocommerce_options_panel .salus-admit-panel-table input,
.woocommerce_options_panel .salus-admit-panel-table select {
	float: none;
	width: 100%;
	max-width: 100%;
	margin: 0;
}

.salus-admit-bundle-parts table {
	max-width: 32em;
}

.salus-admit-col-short {
	width: 7em;
}

.woocommerce_options_panel .salus-admit-panel-table .salus-admit-tier-name,
.woocommerce_options_panel .salus-admit-bundle-parts select {
	min-width: 8em;
}

.salus-admit-col-action {
	width: 5em;
	text-align: right;
}

/* Tables with many columns use the panel's full width, like WooCommerce's
   downloadable files table. */
.salus-admit-panel-table-wide {
	padding-left: 12px;
	padding-right: 12px;
}

/* WooCommerce stacks the labels at this width. */
@media only screen and (max-width: 500px) {

	.salus-admit-panel-table {
		padding-left: 20px;
	}
}

/* Event screen tables: keep the inputs inside the box and line the cells up. */
.salus-admit-edit-table td {
	vertical-align: middle;
}

.salus-admit-edit-table input[type="text"],
.salus-admit-edit-table textarea {
	width: 100%;
}

/* Settings > Products > Events: leave the same space after a full-width
   table as WooCommerce's form table leaves after its last row. */
.salus-admit-steps,
#salus-admit-emails,
.salus-admit-steps-done {
	margin-bottom: 2em;
}

.salus-admit-steps-done .salus-admit-steps {
	margin-bottom: 0;
}

/* Settings > Products > Events: setup steps not done yet. */
.salus-admit-step-todo {
	display: inline-block;
	box-sizing: border-box;
	width: 18px;
	height: 18px;
	border: 2px solid #c3c4c7;
	border-radius: 50%;
	vertical-align: middle;
}

table.wc_emails .salus-admit-step-text {
	font-weight: 400;
	color: #646970;
}

table.wc_emails .salus-admit-step-links {
	font-weight: 400;
}

/* Each step has one button. The column shrinks to the widest button and
   every button fills it, so they line up on both edges whatever the label
   or language. */
table.wc_emails td.salus-admit-step-action {
	width: 1%;
	white-space: nowrap;
	text-align: right;
}

table.wc_emails td.salus-admit-step-action .button {
	box-sizing: border-box;
	width: 100%;
	text-align: center;
}

/* Phones and narrow tablets (WordPress's admin breakpoint): the status
   stays on the left and everything else stacks beside it, so the text is
   not squeezed into a narrow column next to the buttons. */
@media screen and (max-width: 782px) {

	table.salus-admit-steps tr,
	table#salus-admit-emails tbody tr {
		display: grid;
		grid-template-columns: auto 1fr;
	}

	table.salus-admit-steps td.wc-email-settings-table-status,
	table#salus-admit-emails td.wc-email-settings-table-status {
		grid-row: 1 / span 3;
	}

	table.salus-admit-steps td + td,
	table#salus-admit-emails td + td {
		grid-column: 2;
	}

	table.salus-admit-steps td + td,
	table#salus-admit-emails td + td {
		padding-bottom: 0.5em !important;
	}

	table.salus-admit-steps td + td + td,
	table#salus-admit-emails td + td + td {
		padding-top: 0 !important;
	}

	table.salus-admit-steps td:last-child,
	table#salus-admit-emails td:last-child {
		padding-bottom: 1em !important;
	}

	table#salus-admit-emails td:empty {
		display: none !important;
	}

	table.wc_emails td.salus-admit-step-action {
		width: auto;
		text-align: left;
	}

	table.wc_emails td.salus-admit-step-action .button,
	table#salus-admit-emails .button {
		width: auto;
		float: none;
	}

	/* The column headings have nothing to label once the cells stack. */
	table#salus-admit-emails thead {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
	}
}

/* Setup complete: the steps fold under a "Show steps" toggle. */
.salus-admit-steps-done summary {
	margin: 1em 0;
	cursor: pointer;
}

.salus-admit-steps-toggle {
	color: var(--wp-admin-theme-color, #2271b1);
	text-decoration: underline;
}

.salus-admit-steps-done[open] .salus-admit-steps-toggle {
	display: none;
}
