/**
 * Mishtam — cake photo upload on PDP, cart, admin
 */

.mishtam-theme .ms-cake-photo {
	display: block;
	width: 100%;
	margin: 0 0 var(--space-4);
	padding: var(--space-4);
	background: var(--ms-bg-soft);
	border: 1px solid var(--ms-border-light);
	border-radius: var(--ms-radius-md);
	box-sizing: border-box;
}

.mishtam-theme .ms-cake-photo__label {
	display: block;
	margin: 0 0 var(--space-2);
	font-size: var(--ms-small);
	font-weight: 700;
	color: var(--ms-text);
}

.mishtam-theme .ms-cake-photo__label .required {
	color: var(--ms-primary);
}

.mishtam-theme .ms-cake-photo__hint {
	margin: 0 0 var(--space-3);
	font-size: 13px;
	line-height: 1.5;
	color: var(--ms-text-muted);
}

.mishtam-theme .ms-cake-photo__control {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: var(--space-3);
}

.mishtam-theme .ms-cake-photo__input {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.mishtam-theme .ms-cake-photo__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-2) var(--space-3);
}

.mishtam-theme .ms-cake-photo__choose {
	flex-shrink: 0;
	min-height: 44px;
	padding: 0 var(--space-5);
	margin: 0;
	border-radius: var(--ms-radius-pill);
	font-weight: 600;
	background: var(--ms-bg) !important;
	color: var(--ms-primary) !important;
	border: 1.5px solid var(--ms-primary) !important;
	box-shadow: none;
	transition:
		background-color var(--ms-duration) var(--ms-ease),
		border-color var(--ms-duration) var(--ms-ease),
		color var(--ms-duration) var(--ms-ease),
		transform var(--ms-duration) var(--ms-ease),
		box-shadow var(--ms-duration) var(--ms-ease);
}

.mishtam-theme .ms-cake-photo__choose:hover,
.mishtam-theme .ms-cake-photo__choose:focus-visible {
	background: var(--ms-primary) !important;
	color: var(--ms-text-inverse) !important;
	border-color: var(--ms-primary) !important;
	transform: translateY(-1px);
	box-shadow: 0 4px 14px var(--ms-primary-glow);
}

.mishtam-theme .ms-cake-photo__choose:active {
	background: var(--ms-primary-hover) !important;
	border-color: var(--ms-primary-hover) !important;
	color: var(--ms-text-inverse) !important;
	transform: translateY(0);
	box-shadow: 0 2px 8px var(--ms-primary-glow);
}

.mishtam-theme .ms-cake-photo__choose:focus-visible {
	outline: 2px solid var(--ms-primary-light);
	outline-offset: 2px;
}

.mishtam-theme .ms-cake-photo__formats {
	font-size: 12px;
	line-height: 1.4;
	color: var(--ms-text-muted);
}

.mishtam-theme .ms-cake-photo__preview {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	padding: var(--space-3);
	background: var(--ms-bg);
	border: 1px solid var(--ms-border);
	border-radius: var(--ms-radius-md);
}

.mishtam-theme .ms-cake-photo__preview[hidden] {
	display: none !important;
}

.mishtam-theme .ms-cake-photo__preview-media {
	flex-shrink: 0;
	width: 64px;
	height: 64px;
	border-radius: var(--ms-radius-sm);
	overflow: hidden;
	background: var(--ms-bg-soft);
	border: 1px solid var(--ms-border-light);
}

.mishtam-theme .ms-cake-photo__preview-media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.mishtam-theme .ms-cake-photo__preview-meta {
	display: flex;
	flex-direction: column;
	gap: var(--space-1);
	min-width: 0;
}

.mishtam-theme .ms-cake-photo__preview-label {
	font-size: 12px;
	font-weight: 600;
	color: var(--ms-text-muted);
	text-transform: uppercase;
	letter-spacing: 0.02em;
}

.mishtam-theme .ms-cake-photo__filename {
	font-size: 13px;
	font-weight: 600;
	color: var(--ms-text);
	line-height: 1.4;
	word-break: break-word;
}

.mishtam-theme .ms-cake-photo.is-invalid {
	border-color: var(--ms-error);
	box-shadow: 0 0 0 2px rgba(198, 40, 40, 0.12);
}

.mishtam-theme .ms-cake-photo__error {
	margin: 0;
	font-size: 13px;
	font-weight: 600;
	color: var(--ms-error);
}

.mishtam-theme .ms-cake-photo__cart-thumb,
.mishtam-theme .ms-cake-photo__order-media img {
	display: block;
	width: 48px;
	height: 48px;
	object-fit: cover;
	border-radius: var(--ms-radius-sm);
	border: 1px solid var(--ms-border-light);
	flex-shrink: 0;
}

.mishtam-theme .ms-cake-photo__order-meta {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	margin-top: var(--space-1);
	padding: var(--space-2) var(--space-3);
	background: var(--ms-bg-soft);
	border: 1px solid var(--ms-border-light);
	border-radius: var(--ms-radius-md);
}

.mishtam-theme .ms-cake-photo__order-media {
	flex-shrink: 0;
	line-height: 0;
}

.mishtam-theme .ms-cake-photo__order-name,
.mishtam-theme .ms-cake-photo__cart-name {
	display: block;
	min-width: 0;
	font-size: 12px;
	font-weight: 600;
	color: var(--ms-text-muted);
	line-height: 1.4;
	word-break: break-word;
}

/* Checkout + cart item meta */
.mishtam-theme.ms-checkout-page .woocommerce-checkout-review-order-table .product-name dl.variation,
.mishtam-theme.ms-cart-page .woocommerce-cart-form__contents dl.variation {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: var(--space-1) var(--space-3);
	align-items: start;
	margin: var(--space-2) 0 0;
	padding: 0;
}

.mishtam-theme.ms-checkout-page .woocommerce-checkout-review-order-table .product-name dl.variation dt,
.mishtam-theme.ms-cart-page .woocommerce-cart-form__contents dl.variation dt {
	margin: 0;
	padding: 0;
	font-size: 12px;
	font-weight: 600;
	color: var(--ms-text-muted);
	line-height: 1.4;
}

.mishtam-theme.ms-checkout-page .woocommerce-checkout-review-order-table .product-name dl.variation dd,
.mishtam-theme.ms-cart-page .woocommerce-cart-form__contents dl.variation dd {
	margin: 0;
	padding: 0;
	font-size: 12px;
	line-height: 1.4;
}

.mishtam-theme.ms-checkout-page .woocommerce-checkout-review-order-table .product-name dl.variation dd .ms-cake-photo__order-meta,
.mishtam-theme.ms-cart-page .woocommerce-cart-form__contents dl.variation dd .ms-cake-photo__order-meta {
	margin-top: 0;
}

.mishtam-theme.ms-checkout-page .woocommerce-checkout-review-order-table .product-name dl.variation dt:has(+ dd .ms-cake-photo__order-meta),
.mishtam-theme.ms-cart-page .woocommerce-cart-form__contents dl.variation dt:has(+ dd .ms-cake-photo__order-meta) {
	grid-column: 1 / -1;
}

.mishtam-theme.ms-checkout-page .woocommerce-checkout-review-order-table .product-name dl.variation dd:has(.ms-cake-photo__order-meta),
.mishtam-theme.ms-cart-page .woocommerce-cart-form__contents dl.variation dd:has(.ms-cake-photo__order-meta) {
	grid-column: 1 / -1;
}

.mishtam-theme.ms-order-received-page .ms-cake-photo__order-meta {
	padding: var(--space-2) 0 0;
	background: transparent;
	border: 0;
}

.mishtam-theme .ms-cake-photo__cart-thumb {
	margin-right: 0;
}

.mishtam-theme .ms-cake-photo__admin {
	margin-top: var(--space-3);
	padding-top: var(--space-3);
	border-top: 1px solid #ddd;
}

.mishtam-theme .ms-cake-photo__admin-label {
	margin: 0 0 var(--space-2);
}

.mishtam-theme .ms-cake-photo__admin-thumb {
	display: block;
	width: 120px;
	height: 120px;
	object-fit: cover;
	border-radius: var(--ms-radius-md);
	border: 1px solid var(--ms-border);
}

.mishtam-theme .ms-cake-photo__admin-link {
	margin: var(--space-2) 0 0;
	font-size: 13px;
}

@media (max-width: 767px) {
	.mishtam-theme .ms-cake-photo__actions {
		flex-direction: column;
		align-items: flex-start;
	}
}
