.photo-restore {
	max-width: 960px;
	margin: 0 auto;
	padding: 24px;
	font-family: inherit;
}

.photo-restore__header {
	display: flex;
	justify-content: space-between;
	align-items: stretch;
	gap: 16px;
	margin-bottom: 20px;
	padding: 16px 20px;
	background: #f6f7f7;
	border-radius: 12px;
}

.photo-restore__stat {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}

.photo-restore__stat-label {
	font-size: 0.875rem;
	color: #646970;
	font-weight: 500;
	line-height: 1.3;
}

.photo-restore__balance-value,
.photo-restore__cost-value {
	color: #2271b1;
	font-size: 1.5rem;
	line-height: 1.2;
	font-weight: 700;
}

.photo-restore__stat--cost {
	text-align: right;
	align-items: flex-end;
}

.photo-restore__provider {
	margin-bottom: 20px;
}

.photo-restore__provider label {
	display: block;
	margin-bottom: 8px;
	font-weight: 600;
}

.photo-restore__provider select {
	width: 100%;
	max-width: 420px;
	padding: 10px 12px;
	border: 1px solid #dcdcde;
	border-radius: 8px;
	background: #fff;
}

.photo-restore__provider-name {
	margin: 0 0 20px;
	color: #646970;
}

/* Respect the HTML `hidden` attribute (avoid broken img icon). */
.photo-restore [hidden] {
	display: none !important;
}

.photo-restore__upload {
	border: 2px dashed #c3c4c7;
	border-radius: 12px;
	padding: 40px 20px;
	text-align: center;
	cursor: pointer;
	transition: border-color 0.2s, background 0.2s;
	background: #fff;
}

.photo-restore__upload:hover,
.photo-restore__upload.is-dragover {
	border-color: #2271b1;
	background: #f0f6fc;
}

.photo-restore__upload-title {
	margin: 0 0 8px;
	font-size: 1.1rem;
	font-weight: 600;
}

.photo-restore__upload-sub {
	margin: 0;
	color: #646970;
	font-size: 0.9rem;
}

/* Before / after compare slider */
.photo-restore__compare-wrap {
	margin-top: 24px;
}

.photo-restore__compare {
	max-width: 100%;
}

.photo-restore__debug-banner {
	margin-bottom: 16px;
	padding: 12px 16px;
	background: #fff8e5;
	border: 1px solid #f0c33c;
	border-radius: 8px;
	color: #6d4c00;
	font-size: 0.9rem;
}

.photo-restore__compare-inner {
	position: relative;
	overflow: hidden;
	border-radius: 16px;
	background: #e8ecf0;
	line-height: 0;
	cursor: ew-resize;
	touch-action: none;
	user-select: none;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

.photo-restore__compare-inner.is-dragging {
	cursor: grabbing;
}

.photo-restore__compare-inner.is-dragging .photo-restore__compare-after,
.photo-restore__compare-inner.is-dragging .photo-restore__compare-before {
	pointer-events: none;
}

.photo-restore__compare-after {
	width: 100%;
	height: auto;
	display: block;
	vertical-align: top;
	position: relative;
	z-index: 1;
}

.photo-restore__compare-before {
	width: 100%;
	height: auto;
	display: block;
	vertical-align: top;
	position: absolute;
	top: 0;
	left: 0;
	z-index: 2;
	clip-path: inset(0 50% 0 0);
}

/* 上传预览：仅显示原图，不露出空的修复层 */
.photo-restore__compare-inner.is-preview-only .photo-restore__compare-before {
	position: relative;
	clip-path: none;
}

.photo-restore__compare-inner.is-preview-only .photo-restore__compare-after {
	display: none !important;
}

.photo-restore__compare-handle {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 50%;
	width: 3px;
	margin-left: -1px;
	background: #fff;
	z-index: 3;
	cursor: ew-resize;
	touch-action: none;
	box-shadow: 0 0 12px rgba(0, 0, 0, 0.25);
	transform: translateX(-50%);
}

.photo-restore__compare-inner.is-dragging .photo-restore__compare-handle {
	cursor: grabbing;
}

.photo-restore__compare-knob {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
	display: flex;
	align-items: center;
	justify-content: center;
}

.photo-restore__compare-knob::before,
.photo-restore__compare-knob::after {
	content: '';
	display: block;
	width: 0;
	height: 0;
	border-style: solid;
}

.photo-restore__compare-knob::before {
	border-width: 6px 8px 6px 0;
	border-color: transparent #1d2327 transparent transparent;
	margin-right: 4px;
}

.photo-restore__compare-knob::after {
	border-width: 6px 0 6px 8px;
	border-color: transparent transparent transparent #1d2327;
	margin-left: 4px;
}

.photo-restore__compare-labels {
	display: flex;
	justify-content: space-between;
	margin-top: 12px;
	font-size: 0.9rem;
	color: #646970;
	font-weight: 600;
}

.photo-restore__compare-hint {
	margin: 12px 0 0;
	text-align: center;
	color: #646970;
	font-size: 0.9rem;
}

.photo-restore__preview {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 20px;
	margin-top: 24px;
}

.photo-restore__panel {
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 12px;
	padding: 16px;
}

.photo-restore__panel h3 {
	margin: 0 0 12px;
	font-size: 1rem;
}

.photo-restore__panel img,
.photo-restore__result img {
	width: 100%;
	height: auto;
	border-radius: 8px;
	display: block;
}

.photo-restore__result {
	min-height: 200px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #f6f7f7;
	border-radius: 8px;
}

.photo-restore__placeholder {
	margin: 0;
	color: #646970;
	text-align: center;
	padding: 20px;
}

.photo-restore__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-top: 24px;
	align-items: center;
}

.photo-restore__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 12px 24px;
	border-radius: 8px;
	font-size: 1rem;
	text-decoration: none;
	border: none;
	cursor: pointer;
	transition: opacity 0.2s;
}

.photo-restore__btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.photo-restore__btn-primary {
	background: #2271b1;
	color: #fff;
}

.photo-restore__btn-primary:hover:not(:disabled) {
	background: #135e96;
}

.photo-restore__btn-link {
	background: transparent;
	color: #2271b1;
	border: 1px solid #2271b1;
}

.photo-restore__btn-link:hover {
	background: #f0f6fc;
}

.photo-restore__notice {
	padding: 24px;
	background: #fff8e5;
	border: 1px solid #f0c33c;
	border-radius: 12px;
	text-align: center;
}

.photo-restore__message {
	margin-top: 16px;
	padding: 12px 16px;
	border-radius: 8px;
}

.photo-restore__message.is-error {
	background: #fcf0f1;
	color: #b32d2e;
	border: 1px solid #f0aeb1;
}

.photo-restore__message.is-success {
	background: #edfaef;
	color: #1e7e34;
	border: 1px solid #9fd89f;
}

.photo-restore__message.is-loading {
	background: #f0f6fc;
	color: #2271b1;
	border: 1px solid #9ec2e6;
}

.is-hidden {
	display: none !important;
}

.photo-restore__history-link {
	margin-top: 20px;
	text-align: center;
}

.photo-restore__history-link a {
	color: #2271b1;
	text-decoration: none;
}

.photo-restore__history-link a:hover {
	text-decoration: underline;
}

.photo-restore-history {
	margin-top: 8px;
}

.photo-restore-history h3 {
	margin: 0 0 16px;
}

.photo-restore-history__empty {
	color: #646970;
}

.photo-restore-history__table {
	width: 100%;
	border-collapse: collapse;
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 8px;
	overflow: hidden;
}

.photo-restore-history__table th,
.photo-restore-history__table td {
	padding: 12px 16px;
	text-align: left;
	border-bottom: 1px solid #dcdcde;
	vertical-align: middle;
}

.photo-restore-history__table th {
	background: #f6f7f7;
	font-weight: 600;
}

.photo-restore-history__table tbody tr:last-child td {
	border-bottom: none;
}

.photo-restore-history__thumb img {
	width: 64px;
	height: 64px;
	object-fit: cover;
	border-radius: 6px;
	display: block;
}

.photo-restore-history__table a {
	color: #2271b1;
}

.photo-restore-history__actions {
	white-space: nowrap;
}

.photo-restore-history__sep {
	margin: 0 8px;
	color: #c3c4c7;
}

.photo-restore-history__delete {
	background: none;
	border: none;
	padding: 0;
	font: inherit;
	color: #b32d2e;
	cursor: pointer;
	text-decoration: none;
}

.photo-restore-history__delete:hover:not(:disabled) {
	text-decoration: underline;
}

.photo-restore-history__delete:disabled {
	opacity: 0.6;
	cursor: wait;
}

.woocommerce-account .photo-restore-history {
	max-width: 100%;
}

@media (max-width: 768px) {
	.photo-restore__header {
		flex-direction: column;
		align-items: stretch;
	}

	.photo-restore__stat--cost {
		text-align: left;
		align-items: flex-start;
	}

	.photo-restore__preview {
		grid-template-columns: 1fr;
	}

	.photo-restore__compare-knob {
		width: 36px;
		height: 36px;
	}
}
