/*
 * Send and update flow: the parts only this flow has. Shared components come from
 * ktmp-ui.css; the values here use its custom properties, so everything sits inside .ktmp-wrap.
 */

/* "Step X of Y" above the stepper. */
.ktmp-flow .ktmp-flow-progress {
	margin: var(--ktmp-space-4) 0 var(--ktmp-space-3);
	font-size: var(--ktmp-type-small-size);
	line-height: var(--ktmp-type-small-line);
	color: var(--ktmp-text-muted);
}

/* Stepper: a marker over each step name, joined by a line. */
.ktmp-flow-steps {
	display: flex;
	margin: 0 0 var(--ktmp-space-6);
	padding: 0;
	list-style: none;
}

.ktmp-flow-steps .ktmp-flow-step {
	position: relative;
	flex: 1 1 0;
	min-width: 0;
	margin: 0;
	text-align: center;
	font-size: var(--ktmp-type-body-size);
	color: var(--ktmp-text-secondary);
}

/* The line to the previous step, at the height of the marker's centre. */
.ktmp-flow-steps .ktmp-flow-step::before {
	content: "";
	position: absolute;
	top: 14px;
	inset-inline-start: calc(-50% + 22px);
	inset-inline-end: calc(50% + 22px);
	height: 2px;
	background: var(--ktmp-border-strong);
}

.ktmp-flow-steps .ktmp-flow-step:first-child::before {
	display: none;
}

.ktmp-flow-steps .ktmp-flow-step.is-complete::before,
.ktmp-flow-steps .ktmp-flow-step.is-current::before {
	background: var(--ktmp-accent);
}

.ktmp-flow-step a,
.ktmp-flow-step-text {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--ktmp-space-2);
	padding: 0 var(--ktmp-space-1);
	border-radius: var(--ktmp-radius-sm);
	color: inherit;
	text-decoration: none;
}

.ktmp-flow-step-number {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: 30px;
	height: 30px;
	border: 2px solid var(--ktmp-border);
	border-radius: var(--ktmp-radius-pill);
	background: var(--ktmp-surface-card);
	font-size: var(--ktmp-type-body-size);
	font-weight: var(--ktmp-weight-strong);
	line-height: 1;
	color: var(--ktmp-text-secondary);
}

.ktmp-flow-step-label {
	display: block;
	max-width: 160px;
	line-height: 1.4;
}

.ktmp-flow-step.is-current .ktmp-flow-step-number {
	border-color: var(--ktmp-accent);
	color: var(--ktmp-accent);
	box-shadow: 0 0 0 4px var(--ktmp-accent-tint);
}

.ktmp-flow-step.is-current .ktmp-flow-step-label {
	font-weight: var(--ktmp-weight-strong);
	color: var(--ktmp-text);
}

/* A done step shows a check in place of its number. */
.ktmp-flow-step.is-complete .ktmp-flow-step-number {
	border-color: var(--ktmp-accent);
	background: var(--ktmp-accent);
	font-size: 0;
	color: #fff;
}

.ktmp-flow-step.is-complete .ktmp-flow-step-number::before {
	content: "\f147";
	font: normal 20px/1 dashicons;
}

.ktmp-flow-step.is-complete .ktmp-flow-step-label {
	color: var(--ktmp-text);
}

.ktmp-flow-step a:hover .ktmp-flow-step-label {
	color: var(--ktmp-accent);
	text-decoration: underline;
}

/* Action row under the panel. */
.ktmp-flow .ktmp-flow-actions {
	min-height: var(--ktmp-control-height);
	margin-top: var(--ktmp-space-4);
}

.ktmp-flow .ktmp-flow-start-over {
	margin-inline-start: auto;
	color: var(--ktmp-text-secondary);
}

.ktmp-flow .ktmp-flow-start-over:hover {
	color: var(--ktmp-text);
}

.ktmp-flow .ktmp-flow-intro {
	max-width: 680px;
	margin: 0 0 var(--ktmp-space-5);
	color: var(--ktmp-text-secondary);
}

/* Marketplace step: hooked rows keep their core form-table, lined up with the rows above. */
.ktmp-flow-mp-area .form-table {
	margin: 0;
}

.ktmp-flow-mp-area .form-table th {
	width: var(--ktmp-form-label-width);
	padding: var(--ktmp-space-4) var(--ktmp-space-6) var(--ktmp-space-4) 0;
	font-size: var(--ktmp-type-label-size);
}

.ktmp-flow-mp-area .form-table td {
	padding: var(--ktmp-space-4) 0;
}

.ktmp-flow-mp-area .form-table tr {
	border-top: 1px solid var(--ktmp-border-light);
}

.ktmp-flow-mp-area .form-table td > select {
	max-width: 480px;
}

.ktmp-flow-process,
.ktmp-flow-fields {
	max-width: 720px;
	margin-top: var(--ktmp-space-5);
}

.ktmp-flow-process > legend,
.ktmp-flow-fields-label {
	margin: 0 0 var(--ktmp-space-3);
	padding: 0;
	font-size: var(--ktmp-type-label-size);
	line-height: var(--ktmp-type-label-line);
	font-weight: var(--ktmp-weight-strong);
	color: var(--ktmp-text);
}

/* Products step: the picker sections and the bar with the count and the pages. */
.ktmp-flow-section {
	margin-top: var(--ktmp-space-6);
}

.ktmp-flow-picker-searchbox {
	margin-inline-start: auto;
}

.ktmp-flow-picker-status {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--ktmp-space-2) var(--ktmp-space-3);
	min-height: 44px;
	margin: 0 0 var(--ktmp-space-3);
	padding: var(--ktmp-space-1) var(--ktmp-space-4);
	border-radius: var(--ktmp-radius-sm);
	background: var(--ktmp-accent-tint);
	font-size: var(--ktmp-type-body-size);
}

.ktmp-flow-picker-status .tablenav-pages {
	float: none;
	margin: 0 0 0 auto;
}

.ktmp-flow-picker-notice {
	margin: 0 0 var(--ktmp-space-3);
}

.ktmp-flow-picker .tablenav.bottom {
	height: auto;
	margin: var(--ktmp-space-3) 0 0;
}

.ktmp-flow-picker-table .ktmp-flow-col-cb,
.ktmp-flow-picker-table .check-column {
	width: 2.2em;
}

.ktmp-flow-picker-table .ktmp-flow-col-cb input {
	margin: 0 0 0 var(--ktmp-space-2);
}

.ktmp-flow-picker-table .column-thumb {
	width: 48px;
}

.ktmp-flow-picker-table .column-thumb img {
	display: block;
}

.ktmp-flow-picker-table .column-sku {
	width: 16%;
}

.ktmp-flow-picker-table .column-type,
.ktmp-flow-picker-table .column-stock,
.ktmp-flow-picker-table .column-price {
	width: 13%;
}

.ktmp-flow-picker-table .column-sku,
.ktmp-flow-picker-table .column-name {
	overflow-wrap: anywhere;
}

.ktmp-flow-picker-table .ktmp-flow-expand {
	gap: 2px;
	margin-inline-start: var(--ktmp-space-1);
	font-size: var(--ktmp-type-small-size);
}

.ktmp-flow-picker-table[aria-busy="true"] tbody {
	opacity: 0.5;
}

.ktmp-flow-picker-table .no-items td {
	padding: var(--ktmp-space-8) var(--ktmp-space-3);
	text-align: center;
	color: var(--ktmp-text-secondary);
}

/* Review step: the check under the summary, and the skipped products. */
.ktmp-flow-summary {
	max-width: 760px;
}

.ktmp-flow-precheck {
	margin-top: var(--ktmp-space-5);
	padding-top: var(--ktmp-space-5);
	border-top: 1px solid var(--ktmp-border-light);
}

.ktmp-flow-precheck-bar {
	max-width: 560px;
}

.ktmp-flow-skipped {
	margin: 0 0 var(--ktmp-space-4);
}

.ktmp-flow-skipped-icon {
	color: var(--ktmp-warning);
}

.ktmp-flow-skipped-body {
	padding: var(--ktmp-space-3) var(--ktmp-space-4) var(--ktmp-space-4);
}

.ktmp-flow-skipped-table .column-sku {
	width: 16%;
}

.ktmp-flow-skipped-table .column-reasons {
	width: 44%;
}

.ktmp-flow-skipped-table .column-actions {
	width: 16%;
}

.ktmp-flow-skipped-table .column-name,
.ktmp-flow-skipped-table .column-sku {
	overflow-wrap: anywhere;
}

.ktmp-flow-reasons {
	margin: 0;
	padding-inline-start: 18px;
	list-style: disc;
}

.ktmp-flow-reasons li {
	margin: 0 0 2px;
}

.ktmp-flow-precheck-again-row {
	margin: 0;
}

/* Sending step: the four stages as tiles, then the bar, the status line and the log. */
.ktmp-flow .ktmp-flow-sending-title {
	margin: 0 0 var(--ktmp-space-4);
	font-size: 15px;
	font-weight: var(--ktmp-weight-strong);
	color: var(--ktmp-text);
}

.ktmp-flow-pipeline {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: var(--ktmp-space-2);
	margin: 0 0 var(--ktmp-space-4);
	padding: 0;
	list-style: none;
}

.ktmp-flow-pipeline-step {
	display: grid;
	grid-template-columns: 20px minmax(0, 1fr);
	align-items: center;
	gap: 0 10px;
	min-height: 52px;
	margin: 0;
	padding: 10px var(--ktmp-space-3);
	box-sizing: border-box;
	border: 1px solid var(--ktmp-border-light);
	border-radius: var(--ktmp-radius-lg);
	background: var(--ktmp-surface-card);
	font-size: var(--ktmp-type-body-size);
	color: var(--ktmp-text-muted);
}

.ktmp-flow-pipeline-icon {
	grid-row: 1 / span 2;
	width: 20px;
	height: 20px;
	font-size: 20px;
}

/* Waiting: a clock. */
.ktmp-flow-pipeline-icon::before {
	content: "\f469";
	color: var(--ktmp-border);
}

.ktmp-flow-pipeline-number {
	font-size: var(--ktmp-type-small-size);
	color: var(--ktmp-text-muted);
}

.ktmp-flow-pipeline-label {
	line-height: 1.35;
}

.ktmp-flow-pipeline-step[data-state="running"] {
	border-color: var(--ktmp-accent);
	background: var(--ktmp-accent-tint);
	box-shadow: inset 0 0 0 1px var(--ktmp-accent);
	font-weight: var(--ktmp-weight-strong);
	color: var(--ktmp-text);
}

.ktmp-flow-pipeline-step[data-state="running"] .ktmp-flow-pipeline-icon::before {
	content: "\f463";
	color: var(--ktmp-accent);
}

.ktmp-flow-pipeline-step[data-state="done"] {
	color: var(--ktmp-text);
}

.ktmp-flow-pipeline-step[data-state="done"] .ktmp-flow-pipeline-icon::before {
	content: "\f12a";
	color: var(--ktmp-success-text);
}

.ktmp-flow-pipeline-step[data-state="failed"] {
	border-color: var(--ktmp-error);
	background: var(--ktmp-error-tint);
	font-weight: var(--ktmp-weight-strong);
	color: var(--ktmp-error-text);
}

.ktmp-flow-pipeline-step[data-state="failed"] .ktmp-flow-pipeline-icon::before {
	content: "\f153";
	color: var(--ktmp-error-text);
}

.ktmp-flow-sending-bar {
	margin: 0 0 var(--ktmp-space-3);
}

.ktmp-flow .ktmp-flow-sending-text {
	min-height: 28px;
	margin: 0 0 var(--ktmp-space-4);
}

.ktmp-flow-log {
	padding: var(--ktmp-space-2);
}

.ktmp-flow-log:empty {
	display: none;
}

.ktmp-flow-log .ktmp-log-row p {
	margin: var(--ktmp-space-2) 0;
}

.ktmp-flow-sending-error-link {
	margin: 0 0 var(--ktmp-space-2);
}

/* Result step: the large message on top. */
.ktmp-flow-hero {
	display: flex;
	align-items: center;
	gap: 14px;
	margin: 0 0 var(--ktmp-space-5);
	padding: var(--ktmp-space-4) 18px;
	border-radius: var(--ktmp-radius-lg);
	background: var(--ktmp-success-tint);
}

.ktmp-flow-hero__icon.dashicons {
	flex: 0 0 32px;
	width: 32px;
	height: 32px;
	font-size: 32px;
	color: var(--ktmp-success-text);
}

.ktmp-flow-hero__text {
	margin: 0;
	font-size: 15px;
	line-height: 1.4;
	font-weight: var(--ktmp-weight-strong);
	color: var(--ktmp-text);
}

.ktmp-flow-hero--error {
	background: var(--ktmp-error-tint);
}

.ktmp-flow-hero--error .ktmp-flow-hero__icon.dashicons {
	color: var(--ktmp-error-text);
}

.ktmp-flow .ktmp-flow-status {
	margin: var(--ktmp-space-1) 0 0;
}

.ktmp-flow-token {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--ktmp-space-2);
}

.ktmp-flow-links {
	margin: var(--ktmp-space-5) 0 0;
}

.ktmp-flow-repeat {
	max-width: 760px;
	margin-top: var(--ktmp-space-6);
}

.ktmp-flow-repeat .ktmp-flow-repeat-help {
	margin: 2px 0 0;
}

.ktmp-flow-repeat-icon {
	flex-shrink: 0;
	color: var(--ktmp-accent);
}

.ktmp-flow-repeat-actions {
	justify-content: flex-end;
}

.ktmp-flow-repeat-notice {
	margin-top: var(--ktmp-space-5);
}

/* File path: labels sit above their controls. */
.ktmp-flow-label {
	display: block;
	margin: 0 0 var(--ktmp-space-2);
	font-size: var(--ktmp-type-label-size);
	line-height: var(--ktmp-type-label-line);
	font-weight: var(--ktmp-weight-strong);
	color: var(--ktmp-text);
}

.ktmp-flow-filebody > * + *,
.ktmp-flow-columns > * + *,
.ktmp-flow-file-products > * + * {
	margin-top: var(--ktmp-space-5);
}

.ktmp-flow-filefield {
	max-width: 640px;
}

.ktmp-flow-filefield > .ktmp-flow-label {
	display: inline-block;
}

/* File step: the drop zone over the file input, then the chosen file as a row. */
.ktmp-flow-dropzone {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--ktmp-space-2);
	padding: var(--ktmp-space-8) var(--ktmp-space-6);
	border: 1px dashed var(--ktmp-border);
	border-radius: var(--ktmp-radius-lg);
	background: var(--ktmp-surface);
	text-align: center;
	transition: background-color var(--ktmp-motion), border-color var(--ktmp-motion);
}

.ktmp-flow-dropzone:focus-within,
.ktmp-flow-dropzone.ktmp-flow-dropzone--over {
	border-color: var(--ktmp-accent);
	background: var(--ktmp-accent-tint);
}

.ktmp-flow-dropzone:focus-within {
	outline: var(--ktmp-focus-width) solid var(--ktmp-accent);
	outline-offset: var(--ktmp-focus-offset);
}

.ktmp-flow-dropzone.ktmp-flow-dropzone--invalid {
	border-color: var(--ktmp-error);
	background: var(--ktmp-error-tint);
}

.ktmp-flow-dropzone__icon.dashicons {
	width: 32px;
	height: 32px;
	font-size: 32px;
	color: var(--ktmp-text-muted);
}

.ktmp-flow-dropzone__title,
.ktmp-flow-dropzone__hint {
	margin: 0;
}

.ktmp-flow-dropzone__hint {
	font-size: var(--ktmp-type-small-size);
	color: var(--ktmp-text-muted);
}

/* The input stays focusable for the keyboard; its label is the visible button. */
.ktmp-flow-dropzone__input {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.ktmp-flow-filerow {
	display: flex;
	align-items: center;
	gap: var(--ktmp-space-3);
	padding: var(--ktmp-space-3) var(--ktmp-space-4);
	border: 1px solid var(--ktmp-border-strong);
	border-radius: var(--ktmp-radius-lg);
	background: var(--ktmp-surface-card);
}

.ktmp-flow-filerow__icon.dashicons {
	color: var(--ktmp-accent);
}

.ktmp-flow-filerow__info {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-width: 0;
}

.ktmp-flow-filerow__name {
	overflow-wrap: anywhere;
	font-weight: var(--ktmp-weight-strong);
	color: var(--ktmp-text);
}

.ktmp-flow-filerow__meta {
	font-size: var(--ktmp-type-small-size);
	color: var(--ktmp-text-muted);
}

/* Excel sheet choice. */
.ktmp-flow-sheet {
	max-width: 640px;
	padding: var(--ktmp-space-4);
	border: 1px solid var(--ktmp-border-light);
	border-radius: var(--ktmp-radius-lg);
	background: var(--ktmp-surface);
}

.ktmp-flow-sheet__title,
.ktmp-flow-shortcut__title,
.ktmp-flow-subhead {
	margin: 0 0 var(--ktmp-space-3);
	font-size: var(--ktmp-type-card-title-size);
	line-height: var(--ktmp-type-card-title-line);
	font-weight: var(--ktmp-weight-strong);
	color: var(--ktmp-text);
}

.ktmp-flow-sheet__row,
.ktmp-flow-shortcut__row {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: var(--ktmp-space-3);
}

.ktmp-flow-sheet__row .ktmp-flow-label {
	margin: 0;
	align-self: center;
}

/* Preview of the file's rows and of the filled rows. */
.ktmp-flow-preview__meta {
	margin: 0 0 var(--ktmp-space-2);
	font-size: var(--ktmp-type-small-size);
	color: var(--ktmp-text-secondary);
}

.ktmp-flow-previewtable td,
.ktmp-flow-previewtable th {
	max-width: 320px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.ktmp-flow-previewtable .ktmp-flow-rownum {
	width: 3em;
	text-align: end;
	font-variant-numeric: tabular-nums;
	color: var(--ktmp-text-muted);
}

/* Columns step: one row per file column. */
.ktmp-flow-colmeta {
	display: flex;
	flex-wrap: wrap;
	gap: var(--ktmp-space-2) var(--ktmp-space-4);
	justify-content: space-between;
	font-size: var(--ktmp-type-body-size);
}

.ktmp-flow-colmeta__source {
	color: var(--ktmp-text-secondary);
	overflow-wrap: anywhere;
}

.ktmp-flow-map__frame {
	max-height: 560px;
}

.ktmp-flow-map tbody th {
	font-weight: var(--ktmp-weight-strong);
	overflow-wrap: anywhere;
}

.ktmp-flow-map .ktmp-flow-map__sample {
	max-width: 200px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	color: var(--ktmp-text-muted);
}

.ktmp-flow-map__select select,
.ktmp-flow-map__value select,
.ktmp-flow-map__value input {
	width: 100%;
	min-width: 180px;
}

/* The value cell is as wide as the fixed value box from the start, so showing the box does not move the table. */
.ktmp-flow-map .ktmp-flow-map__value {
	width: 180px;
}

.ktmp-flow-map .ktmp-flow-map__clear {
	width: 36px;
	text-align: end;
}

.ktmp-flow-map .ktmp-flow-map__row--mapped > th,
.ktmp-flow-map .ktmp-flow-map__row--mapped > td {
	background: var(--ktmp-accent-tint);
}

.ktmp-flow-map .ktmp-flow-map__row--invalid > th {
	box-shadow: inset 3px 0 0 var(--ktmp-error);
}

/* Products step of a send: the category shortcut first, then the list. */
.ktmp-flow-shortcut {
	padding: var(--ktmp-space-4);
	border: 1px solid var(--ktmp-border-light);
	border-radius: var(--ktmp-radius-lg);
	background: var(--ktmp-surface);
}

.ktmp-flow-shortcut__field {
	min-width: 200px;
}

.ktmp-flow-file-products .ktmp-flow-section {
	margin-top: 0;
}

/* The copy of Continue that rides at the bottom of the list. */
.ktmp-flow-floating {
	position: sticky;
	bottom: var(--ktmp-space-4);
	z-index: 3;
	display: flex;
	justify-content: flex-end;
	pointer-events: none;
}

.ktmp-flow-floating > * {
	pointer-events: auto;
	box-shadow: var(--ktmp-shadow-overlay);
}

/* Download step: the file type, the button and the name the file gets. */
.ktmp-flow-dl {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: var(--ktmp-space-3) var(--ktmp-space-4);
	padding: var(--ktmp-space-4);
	border: 1px solid var(--ktmp-border-light);
	border-radius: var(--ktmp-radius-lg);
	background: var(--ktmp-surface);
}

.ktmp-flow-dl select {
	min-height: var(--ktmp-control-height);
}

/* The shared button row spaces and centres the icon; this only gives it the icon size. */
.ktmp-flow-dl .dashicons {
	width: 18px;
	height: 18px;
	font-size: 18px;
	line-height: 1;
}

.ktmp-flow-dl p {
	flex-basis: 100%;
	margin: 0;
	color: var(--ktmp-text-secondary);
}

.ktmp-flow-dl__file {
	overflow-wrap: anywhere;
}

@media screen and (max-width: 782px) {
	/* The stepper becomes the current step's name over a bar of segments. */
	.ktmp-flow-steps {
		position: relative;
		gap: var(--ktmp-space-1);
		padding-top: 26px;
		margin-bottom: var(--ktmp-space-4);
	}

	.ktmp-flow-steps .ktmp-flow-step {
		position: static;
		height: 4px;
		border-radius: 2px;
		background: var(--ktmp-border-light);
	}

	.ktmp-flow-steps .ktmp-flow-step.is-complete,
	.ktmp-flow-steps .ktmp-flow-step.is-current {
		background: var(--ktmp-accent);
	}

	.ktmp-flow-steps .ktmp-flow-step::before,
	.ktmp-flow-step-number {
		display: none;
	}

	/* The other step names stay readable to screen readers. */
	.ktmp-flow-step-label {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
		white-space: nowrap;
	}

	.ktmp-flow-step a,
	.ktmp-flow-step-text {
		display: block;
		height: 100%;
		padding: 0;
	}

	.ktmp-flow-step.is-current .ktmp-flow-step-label {
		position: absolute;
		top: 0;
		inset-inline-start: 0;
		display: block;
		width: auto;
		height: auto;
		max-width: none;
		overflow: visible;
		clip: auto;
		white-space: normal;
		font-size: var(--ktmp-type-label-size);
	}

	.ktmp-flow-mp-area .form-table th,
	.ktmp-flow-mp-area .form-table td {
		display: block;
		width: auto;
		padding: var(--ktmp-space-2) 0;
	}

	.ktmp-flow-pipeline {
		grid-template-columns: minmax(0, 1fr);
	}

	.ktmp-flow-picker-searchbox {
		margin-inline-start: 0;
	}

	.ktmp-flow-picker-status .tablenav-pages {
		width: 100%;
		margin: 0;
	}

	.ktmp-flow-sheet__row,
	.ktmp-flow-shortcut__row,
	.ktmp-flow-dl {
		flex-direction: column;
		align-items: stretch;
	}

	.ktmp-flow-sheet__row .ktmp-flow-label {
		align-self: flex-start;
	}
}
