/* AI Product Images (Pro): product box, settings tab and bulk card. */

.aifi-product-box .aifi-pb-section {
	margin-bottom: 16px;
}

.aifi-product-box .aifi-pb-label {
	margin: 0 0 8px;
	font-weight: 600;
}

.aifi-pb-sources {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.aifi-pb-source,
.aifi-pb-replace-target {
	padding: 0;
	border: 2px solid #dcdcde;
	border-radius: 4px;
	background: #fff;
	cursor: pointer;
	line-height: 0;
}

.aifi-pb-source img,
.aifi-pb-replace-target img {
	width: 64px;
	height: 64px;
	object-fit: cover;
	border-radius: 2px;
}

.aifi-pb-source[aria-checked="true"] {
	border-color: #2271b1;
	box-shadow: 0 0 0 1px #2271b1;
}

.aifi-pb-source:focus-visible,
.aifi-pb-replace-target:focus-visible {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}

.aifi-pb-empty {
	margin: 0 0 8px;
	color: #b32d2e;
}

.aifi-pb-look {
	display: flex;
	flex-wrap: wrap;
	gap: 12px 16px;
	align-items: flex-end;
}

.aifi-pb-look label {
	display: flex;
	flex-direction: column;
	gap: 4px;
	font-weight: 600;
}

.aifi-pb-look select {
	min-width: 140px;
}

.aifi-pb-look .aifi-pb-extra {
	flex: 1 1 280px;
}

.aifi-pb-extra input {
	width: 100%;
	font-weight: 400;
}

.aifi-pb-transparent-note {
	width: 100%;
	margin: 0;
}

.aifi-pb-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
}

.aifi-pb-actions .spinner {
	float: none;
	margin: 0;
}

.aifi-pb-cost {
	margin: 8px 0 0;
}

.aifi-product-box .aifi-message {
	margin-top: 12px;
}

.aifi-pb-note {
	margin-top: 4px;
	font-weight: 400;
}

.aifi-pb-results {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	gap: 16px;
	margin-top: 16px;
}

.aifi-pb-card {
	padding: 8px;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	background: #fff;
}

.aifi-pb-card.is-saved {
	border-color: #00a32a;
}

.aifi-pb-card > img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 2px;
	background-color: #f6f7f7;
	background-image: linear-gradient(45deg, #e0e0e0 25%, transparent 25%), linear-gradient(-45deg, #e0e0e0 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e0e0e0 75%), linear-gradient(-45deg, transparent 75%, #e0e0e0 75%);
	background-size: 16px 16px;
	background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

.aifi-pb-role {
	margin: 6px 0 0;
	color: #50575e;
	font-size: 12px;
}

.aifi-pb-card-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin-top: 8px;
}

.aifi-pb-replace {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 8px;
}

.aifi-pb-replace p {
	width: 100%;
	margin: 0;
}

.aifi-pb-replace[hidden] {
	display: none;
}

.aifi-pb-card-status {
	margin: 6px 0 0;
	color: #00a32a;
	font-size: 12px;
}

.aifi-pb-use-set-row,
.aifi-pb-footer {
	margin: 16px 0 0;
}

.aifi-pb-restore {
	color: #b32d2e;
}

.aifi-product-box-locked .aifi-pro-badge {
	vertical-align: middle;
}

/* Settings tab */
#aifi-panel-products .form-table select {
	width: 100%;
	max-width: 25rem;
}

/* Label and dropdown in two columns, so Main image and the gallery rows line up. */
#aifi-panel-products .aifi-product-set-modes label {
	display: grid;
	grid-template-columns: 8.5rem auto;
	align-items: center;
	gap: 8px;
}

#aifi-panel-products .aifi-product-set-modes select {
	width: 12rem;
}

.aifi-product-backgrounds {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 16px;
}

.aifi-product-background-option {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.aifi-product-bg-dot {
	display: inline-block;
	width: 18px;
	height: 12px;
	border: 1px solid #8c8f94;
	border-radius: 2px;
	flex: none;
}

.aifi-product-bg-dot-white {
	background: #ffffff;
}

.aifi-product-bg-dot-light_grey {
	background: #e5e5e5;
}

.aifi-product-bg-dot-beige {
	background: #f1e7d8;
}

.aifi-product-bg-dot-transparent {
	background-color: #ffffff;
	background-image: linear-gradient(45deg, #c3c4c7 25%, transparent 25%, transparent 75%, #c3c4c7 75%), linear-gradient(45deg, #c3c4c7 25%, transparent 25%, transparent 75%, #c3c4c7 75%);
	background-size: 6px 6px;
	background-position: 0 0, 3px 3px;
}

.aifi-product-hex-row[hidden],
.aifi-product-transparent-note[hidden] {
	display: none;
}

.aifi-product-set-modes {
	margin: 8px 0 0 18px;
}

.aifi-product-set-modes li {
	margin-bottom: 6px;
}

/* Bulk card */
.aifi-products-bulk-fields {
	display: grid;
	gap: 16px;
	margin: 16px 0;
}

.aifi-pbulk-row {
	display: grid;
	grid-template-columns: 9rem minmax(0, 1fr);
	gap: 6px 16px;
	align-items: start;
	margin: 0;
	padding: 0;
	border: 0;
	min-width: 0;
}

.aifi-pbulk-row-label {
	float: left;
	padding: 6px 0 0;
	font-weight: 600;
	color: #1d2327;
}

fieldset.aifi-pbulk-row > legend.aifi-pbulk-row-label {
	/* A legend cannot sit in a grid cell, so it floats into the label column. */
	width: 9rem;
	margin-right: 16px;
}

fieldset.aifi-pbulk-row {
	display: block;
}

fieldset.aifi-pbulk-row > .aifi-pbulk-row-controls {
	margin-left: calc(9rem + 16px);
}

.aifi-pbulk-row-controls {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 12px;
	min-width: 0;
}

.aifi-pbulk-row-controls select {
	min-width: 0;
	max-width: 100%;
}

.aifi-pbulk-option {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	flex: 1 1 100%;
}

.aifi-pbulk-option input {
	flex: none;
	margin-top: 3px;
}

.aifi-pbulk-option .description {
	display: block;
	margin-top: 2px;
}

/* Said once for all three choices: nothing is lost. */
.aifi-products-bulk .aifi-pbulk-kept {
	flex: 1 1 100%;
	margin: 4px 0 0;
}

/* Product filters: small labelled fields that wrap, like the Bulk Generate filters. */
.aifi-pbulk-filters {
	align-items: flex-end;
}

.aifi-pbulk-filter {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.aifi-pbulk-filter > span:first-child {
	font-size: 12px;
	color: #50575e;
}

.aifi-pbulk-filter[hidden] {
	display: none;
}

.aifi-pbulk-date-pair {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
}

.aifi-pbulk-date-pair input[type="date"] {
	min-width: 0;
}

.aifi-products-bulk .aifi-pbulk-which {
	display: flex;
	flex: 1 1 100%;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 10px;
	/* Lines up with the text of the choice it belongs to. */
	margin: -2px 0 0 26px;
}

.aifi-products-bulk .aifi-pbulk-which[hidden] {
	display: none;
}

.aifi-products-bulk .aifi-pbulk-fix-note {
	flex: 1 1 100%;
	margin: 0;
}

.aifi-pbulk-category[hidden] {
	display: none;
}

.aifi-pbulk-progress {
	margin: 12px 0 0;
}

.aifi-pbulk-progress-track {
	height: 8px;
	border-radius: 4px;
	background: #dcdcde;
	overflow: hidden;
}

.aifi-pbulk-progress-bar {
	width: 0;
	height: 100%;
	background: #2271b1;
}

.aifi-pbulk-progress .description {
	margin: 6px 0 0;
}

@media (max-width: 600px) {
	.aifi-pbulk-row {
		grid-template-columns: minmax(0, 1fr);
	}

	fieldset.aifi-pbulk-row > legend.aifi-pbulk-row-label {
		float: none;
		width: auto;
		margin: 0 0 6px;
	}

	fieldset.aifi-pbulk-row > .aifi-pbulk-row-controls {
		margin-left: 0;
	}
}

.aifi-products-bulk-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
}

.aifi-products-bulk-actions .spinner {
	float: none;
	margin: 0;
}

/* WordPress core shows every .button; keep the hidden ones (Stop before a run) hidden. */
.aifi-products-bulk .button[hidden],
.aifi-products-bulk [hidden] {
	display: none;
}

.aifi-products-bulk-log {
	max-height: 240px;
	overflow-y: auto;
	margin: 8px 0 0 18px;
}

.aifi-pbulk-error {
	color: #b32d2e;
}

/* Load products: the same icon as Load Posts above. */
.aifi-products-bulk .aifi-bulk-load-btn .dashicons {
	font-size: 18px;
	width: 18px;
	height: 18px;
	line-height: 18px;
	margin: 0;
}

/* Product list: the same rows as the posts list above, inside the card's own padding. */
.aifi-pbulk-list-wrap {
	margin: 12px 0 0;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	overflow: hidden;
}

.aifi-products-bulk .aifi-pbulk-list-header {
	padding: 10px 14px;
}

.aifi-pbulk-list {
	margin: 0;
	list-style: none;
}

.aifi-products-bulk .aifi-pbulk-item {
	flex-wrap: wrap;
	gap: 4px 12px;
	margin: 0;
	padding: 8px 14px;
}

.aifi-pbulk-item-label {
	display: flex;
	flex: 1 1 16rem;
	align-items: center;
	gap: 12px;
	min-width: 0;
	cursor: pointer;
}

.aifi-pbulk-item-label input {
	flex: none;
	margin: 0;
}

.aifi-pbulk-item.is-disabled .aifi-pbulk-item-label {
	cursor: default;
	color: #646970;
}

.aifi-pbulk-thumb {
	flex: none;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: 4px;
	background: #f0f0f1;
	overflow: hidden;
}

.aifi-products-bulk .aifi-pbulk-thumb img {
	width: 40px;
	height: 40px;
}

.aifi-pbulk-thumb .dashicons {
	color: #a7aaad;
}

/* Matching list: the product name, then one line per photo that differs. */
.aifi-pbulk-item-text {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.aifi-pbulk-reasons {
	display: flex;
	flex-direction: column;
	font-size: 12px;
	line-height: 1.5;
	color: #50575e;
}

.aifi-pbulk-item .aifi-bulk-post-title {
	overflow-wrap: anywhere;
}

.aifi-pbulk-item-note {
	font-size: 12px;
	color: #646970;
}

.aifi-pbulk-item-note.is-warn {
	color: #996800;
}

.aifi-pbulk-list .aifi-bulk-empty {
	padding: 16px 14px;
}

.aifi-pbulk-pages {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 10px 14px;
	border-top: 1px solid #f0f0f1;
}

.aifi-pbulk-page-info {
	font-size: 13px;
	color: #646970;
}

.aifi-pbulk-run-row {
	padding: 12px 14px;
	border-top: 1px solid #dcdcde;
	background: #f6f7f7;
}

.aifi-pbulk-run-row .aifi-products-bulk-actions {
	margin: 0;
}

.aifi-pbulk-cost {
	margin: 6px 0 0;
}

.aifi-products-bulk-status:empty {
	display: none;
}

/* One-line pointers to the product tools, under the Bulk and Audit filters. */
.aifi-products-pointer {
	margin: 6px 0 0;
}

.aifi-audit-controls + .aifi-products-pointer {
	margin: 2px 0 12px;
}
