/* product_gallery: слайдер товара и блок порядка фото (админ) */

/* Обёртка основного слайда: якорь для кнопки lightbox (вне трансформируемых ячеек Flickity) */
.product_slider_main_outer {
	position: relative;
	width: 100%;
}

/* ——— Крупный просмотр фото: arcticModal в стиле прочих модалок (container/stage/medium_radius + popup-close) ——— */
.product_slider_main .file_archive.image img.view {
	cursor: default;
}

/* Карандаш редактора — вне ячеек Flickity (как lightbox) */
.pdp-gallery .product_slider_main .file_archive.image .redaction_interface {
	display: none !important;
}

.pdp-gallery .product-gallery-edit-btn {
	position: absolute;
	top: 8px;
	right: 8px;
	z-index: 121;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 8px;
	margin: 0;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
	background: color-mix(in srgb, var(--color-stage, #fff) 95%, transparent);
	opacity: 0.85;
	font: inherit;
	line-height: 1;
}

.pdp-gallery .product-gallery-edit-btn:hover {
	opacity: 1;
	background: var(--color-stage, #fff);
}

.pdp-gallery .product-gallery-edit-btn:focus {
	outline: 2px solid #4f8cff;
	outline-offset: 2px;
}

.pdp-gallery .product-gallery-edit-btn img {
	display: block;
	width: 20px;
	height: 20px;
	max-width: 20px;
}

@media (max-width: 991px) {
	.pdp-gallery .product-gallery-edit-btn {
		top: 6px;
		right: 6px;
	}
}

/* Кнопка лайтбокса (иконка) в углу слайда */
.product-gallery-lightbox-btn {
	position: absolute;
	right: 8px;
	bottom: 8px;
	z-index: 120;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	min-height: 40px;
	padding: 8px;
	margin: 0;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
	background: color-mix(in srgb, var(--color-stage, #fff) 95%, transparent);
	color: var(--color-text-stage, #333);
	font: inherit;
	line-height: 1;
}

.product-gallery-lightbox-btn:hover {
	background: var(--color-stage, #fff);
	color: var(--color-text-stage, #111);
}

.product-gallery-lightbox-btn:focus {
	outline: 2px solid #4f8cff;
	outline-offset: 2px;
}

.product-gallery-lightbox-btn__icon {
	display: flex;
	flex-shrink: 0;
	align-items: center;
	justify-content: center;
}

.product-gallery-lightbox-btn__icon svg {
	display: block;
}

@media (max-width: 991px) {
	.product-gallery-lightbox-btn {
		min-width: 48px;
		min-height: 48px;
		padding: 10px;
		right: 6px;
		bottom: 6px;
	}
}

.product-gallery-modal {
	--pg-modal-viewport-h: min(78vh, 880px);
	background-color: var(--color-stage, #fff);
	max-width: min(96vw, 1200px);
	margin-left: auto;
	margin-right: auto;
	user-select: none;
	-webkit-user-select: none;
}

.air-modal-overlay:has(.product-gallery-modal) > div {
	user-select: none;
	-webkit-user-select: none;
}

/* Закрытие — как в components/system/url/style.css */
.product-gallery-modal .popup-close.air-modal-close {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 2;
	font-size: 30px;
	line-height: 1;
	color: var(--color-deep-stage, #999);
	text-decoration: none;
	cursor: pointer;
	padding: 4px 10px;
}

.product-gallery-modal .popup-close.air-modal-close:hover {
	color: var(--color-text-stage, #333);
}

.product-gallery-modal__content {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	padding: 44px 56px 24px;
	text-align: center;
	box-sizing: border-box;
	background: color-mix(in srgb, var(--color-back-stage, #eef1f5) 72%, var(--color-stage, #fff));
}

.air-modal-overlay:has(.product-gallery-modal.is-loupe-active) > div {
	cursor: none;
}

.product-gallery-modal:not(.is-loupe-active) {
	cursor: crosshair;
}

.product-gallery-modal__viewport {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: var(--pg-modal-viewport-h);
	min-height: var(--pg-modal-viewport-h);
	max-width: 100%;
	overflow: visible;
}

.product-gallery-modal__img {
	display: block;
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	-webkit-user-drag: none;
	pointer-events: none;
}

.product-gallery-modal__loupe {
	position: fixed;
	z-index: 1000001;
	display: none;
	width: 280px;
	height: 280px;
	overflow: hidden;
	border: 2px solid #fff;
	border-radius: 50%;
	pointer-events: none;
	box-shadow:
		0 0 0 1px rgb(0 0 0 / 12%),
		0 8px 24px rgb(0 0 0 / 22%);
}

.product-gallery-modal.is-loupe-active .product-gallery-modal__loupe {
	display: block;
}

.product-gallery-modal__loupe-inner {
	width: 100%;
	height: 100%;
	background-repeat: no-repeat;
	background-color: var(--color-stage, #fff);
}

.product-gallery-modal__nav,
.product-gallery-modal__counter {
	cursor: default;
}

.product-gallery-modal__nav {
	position: absolute;
	top: 50%;
	z-index: 5;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	transform: translateY(-50%);
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
	background: color-mix(in srgb, var(--color-stage, #fff) 96%, transparent);
	color: var(--color-text-stage, #333);
	box-shadow: 0 6px 15px rgb(0 0 0 / 13%);
}

.product-gallery-modal__nav:hover {
	background: var(--color-stage, #fff);
	color: var(--color-text-stage, #111);
}

.product-gallery-modal__nav:focus {
	outline: 2px solid #4f8cff;
	outline-offset: 2px;
}

.product-gallery-modal__nav--prev {
	left: 8px;
}

.product-gallery-modal__nav--next {
	right: 8px;
}

.product-gallery-modal__counter {
	margin-top: 12px;
	font-size: 14px;
	line-height: 1.4;
	color: var(--color-deep-stage, #999);
}

@media (max-width: 991px) {
	.product-gallery-modal {
		--pg-modal-viewport-h: min(62vh, 560px);
	}

	.product-gallery-modal__content {
		padding: 44px 48px 20px;
	}

	.product-gallery-modal__nav {
		width: 48px;
		height: 48px;
	}

	.product-gallery-modal__nav--prev {
		left: 4px;
	}

	.product-gallery-modal__nav--next {
		right: 4px;
	}
}

.product_gallery_youtube {
	margin-top: 16px;
	overflow: hidden;
	background: var(--color-back-stage);
	aspect-ratio: 16 / 9;
}

.product_gallery_youtube iframe {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
}

/*
 * PDP gallery — Ozon: vertical thumbs + compact main frame
 * (does not stretch to buy-box height).
 */
.pdp-shell .pdp-gallery {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 8px;
	align-items: start;
}

.pdp-shell .pdp-gallery.pdp-gallery--has-nav {
	grid-template-columns: 84px minmax(0, 1fr);
}

.pdp-shell .pdp-gallery .product_slider_nav_shell {
	position: relative;
	width: 84px;
	min-width: 84px;
}

.pdp-shell .pdp-gallery .product_slider_nav {
	display: flex;
	flex-direction: column;
	gap: 6px;
	width: 100%;
	max-height: min(56vh, 520px);
	overflow-x: hidden;
	overflow-y: auto;
	scrollbar-width: none;
	-ms-overflow-style: none;
	overscroll-behavior: contain;
}

.pdp-shell .pdp-gallery .pdp-nav-scroll-btn {
	position: absolute;
	width: 34px;
	height: 34px;
	border: none;
	border-radius: 50%;
	padding: 0;
	background-color: #fff;
	background-repeat: no-repeat;
	background-position: center;
	background-size: 18px 18px;
	box-shadow: 0 2px 8px rgb(14 26 50 / 0.16);
	cursor: pointer;
	z-index: 3;
}

.pdp-shell .pdp-gallery .pdp-nav-scroll-btn[hidden] {
	display: none;
}

.pdp-shell .pdp-gallery .pdp-nav-scroll-btn--down {
	left: 50%;
	bottom: 8px;
	transform: translateX(-50%);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23111827' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 5v14M19 12l-7 7-7-7'/%3E%3C/svg%3E");
}

.pdp-shell .pdp-gallery .pdp-nav-scroll-btn--up {
	left: 50%;
	top: 8px;
	transform: translateX(-50%);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23111827' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 19V5M5 12l7-7 7 7'/%3E%3C/svg%3E");
}

.pdp-shell .pdp-gallery .pdp-nav-scroll-btn--right {
	top: 50%;
	right: 8px;
	transform: translateY(-50%);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23111827' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 5l7 7-7 7'/%3E%3C/svg%3E");
}

.pdp-shell .pdp-gallery .pdp-nav-scroll-btn--left {
	top: 50%;
	left: 8px;
	transform: translateY(-50%);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23111827' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 12H5M11 5l-7 7 7 7'/%3E%3C/svg%3E");
}

.pdp-shell .pdp-gallery .product_slider_nav::-webkit-scrollbar {
	display: none;
	width: 0;
	height: 0;
}

.pdp-shell .pdp-gallery .product_slider_nav .nav-item {
	width: 84px;
	min-width: 84px;
	height: 112px;
	margin: 0;
	box-sizing: border-box;
	border: 2px solid var(--color-border);
	border-radius: 10px;
	overflow: hidden;
	flex: 0 0 112px;
	opacity: 1;
	background: var(--color-stage);
	cursor: pointer;
	position: relative;
}

.pdp-shell .pdp-gallery .product_slider_nav .nav-item img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.pdp-shell .pdp-gallery .product_slider_nav .nav-item.is-nav-selected,
.pdp-shell .pdp-gallery .product_slider_nav .nav-item.is-selected {
	border-color: var(--tv-action-primary, #6366f1);
}

.pdp-shell .pdp-gallery .product_slider_main_outer {
	min-width: 0;
	border: 1px solid var(--color-border);
	border-radius: 12px;
	background: var(--color-stage);
	--pdp-gallery-frame-height-default: min(56vh, 520px);
}

.pdp-shell .pdp-gallery .product_slider_main {
	margin-bottom: 0;
	width: 100%;
	display: block;
	border-radius: 12px;
}

.pdp-shell .pdp-gallery .product_slider_main:not(.flickity-enabled) {
	overflow: hidden;
}

.pdp-shell .pdp-gallery .product_slider_main .flickity-viewport {
	border-radius: 12px;
}

.pdp-shell .pdp-gallery .product_slider_main .file_archive.image {
	width: 100%;
	height: 100%;
	min-height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--color-stage);
	border-radius: 12px;
	overflow: hidden;
}

.pdp-shell .pdp-gallery .product_slider_main .file_archive.image {
	cursor: zoom-in;
}

.pdp-shell .pdp-gallery .product_slider_main .file_archive.image img.view {
	border-radius: 12px;
	display: block;
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	margin: 0 auto;
	cursor: zoom-in;
}

.pdp-shell .pdp-gallery .product_slider img {
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	margin: 0 auto;
}

@media (min-width: 992px) {
	.pdp-shell .pdp-gallery .product_slider_main_outer {
		height: var(--pdp-gallery-frame-height, var(--pdp-gallery-frame-height-default));
		min-height: var(--pdp-gallery-frame-height-default);
		display: flex;
		flex-direction: column;
		box-sizing: border-box;
	}

	.pdp-shell .pdp-gallery .product_slider_main {
		flex: 1 1 auto;
		min-height: 0;
		height: 100%;
	}

	.pdp-shell .pdp-gallery .product_slider_main .flickity-viewport {
		height: 100% !important;
		min-height: 100%;
	}

	.pdp-shell .pdp-gallery .product_slider_main .flickity-slider {
		height: 100%;
	}
}

.pdp-shell .pdp-gallery .product_gallery_youtube {
	grid-column: 1 / -1;
	margin-top: 0;
}

@media (max-width: 991px) {
	.pdp-shell .pdp-gallery.pdp-gallery--has-nav {
		display: flex;
		flex-direction: column;
	}

	.pdp-shell .pdp-gallery .product_slider_main_outer {
		order: 0;
		--pdp-gallery-frame-height-default: min(70vw, 420px);
		min-height: var(--pdp-gallery-frame-height-default);
		display: flex;
		flex-direction: column;
	}

	.pdp-shell .pdp-gallery .product_slider_main {
		flex: 1 1 auto;
		min-height: var(--pdp-gallery-frame-height-default);
	}

	.pdp-shell .pdp-gallery .product_slider_main .flickity-viewport {
		height: 100% !important;
		min-height: var(--pdp-gallery-frame-height-default);
	}

	.pdp-shell .pdp-gallery .product_slider_main .file_archive.image {
		min-height: var(--pdp-gallery-frame-height-default);
	}

	.pdp-shell .pdp-gallery .product_slider_nav_shell {
		order: 1;
		width: 100%;
		min-width: 0;
	}

	.pdp-shell .pdp-gallery .product_slider_nav {
		order: 0;
		flex-direction: row;
		width: 100%;
		max-height: none;
		overflow-x: auto;
		overflow-y: hidden;
		scrollbar-width: none;
		-ms-overflow-style: none;
		padding-bottom: 2px;
	}

	.pdp-shell .pdp-gallery .product_slider_nav .nav-item {
		flex: 0 0 84px;
	}

	.pdp-shell .pdp-gallery .product_slider_nav::-webkit-scrollbar {
		display: none;
	}

	.pdp-shell .pdp-gallery .product_gallery_youtube {
		order: 2;
	}
}

/* Product Slider */
.product_slider_main {
	margin-bottom: 40px;
	display: -webkit-inline-flex;
	display: inline-flex;
	overflow: hidden;
}
.product_slider_main .main-item {
	width: 100%;
}
.product_slider_main .file_archive.image {
	width: 100%;
	height: 270px;
	display: flex;
	align-items: center;
}
/* Anti-FOUC (Flash of Unstyled Content): Скрываем всё кроме первого слайда до инициализации Flickity */
.product_slider_main:not(.flickity-enabled) {
	width: 100%;
}
.product_slider_main:not(.flickity-enabled) .file_archive.image:not(:first-child) {
	display: none;
}
.product_slider_main:not(.flickity-enabled) .file_archive.image {
	flex: 0 0 100%;
	justify-content: center;
}
.product_slider img {
	width: 100%;
	display: block;
	max-height: 270px;
	margin: 0 auto;
	object-fit: contain;
}

/* Nav Slider */
.product_slider_nav {
	display: flex;
	overflow: hidden;
}
.product_slider_nav .nav-item {
	width: calc(25% - 3px);
	min-width: calc(25% - 3px);
	height: 90px;
	margin-right: 4px;
}
.product_slider_nav .nav-item:last-child {
	margin-right: 0;
}
.product_slider_nav .nav-item {
	cursor: pointer;
}
.product_slider_nav .nav-item img {
	width: 100%;
	height: 100%;
	/* Releon: реле-товары часто имеют нейтральные поля вокруг объекта,
	   `contain` показывает изделие целиком, не обрезая по краям. */
	object-fit: contain;
}

/* Порядок фото (админ) */
.photo_order_admin_wrap {
	margin-top: 1rem;
}
.photo_order_toggle_btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	margin: 0 auto;
	border-radius: 50%;
	background: transparent;
	border: none;
	color: var(--color-deep-stage, #999);
	cursor: pointer;
	transition: all 0.2s ease;
	outline: none;
}
.photo_order_toggle_btn:hover {
	background: #f0f2f5;
	color: var(--color-text-stage, #333);
}
.photo_order_toggle_btn.expanded {
	background: #f0f2f5;
	color: #005bff;
}
.photo_order_toggle_btn .chevron_icon {
	transition: transform 0.3s ease;
}
.photo_order_toggle_btn.expanded .chevron_icon {
	transform: rotate(-180deg);
}

.photo_order_content {
	border-radius: 12px;
	background: linear-gradient(145deg, #ffffff, #f4f9ff);
	box-shadow: 0 4px 24px rgba(0, 50, 150, 0.06);
	position: relative;
	overflow: hidden;
	
	max-height: 0;
	opacity: 0;
	margin-top: 0;
	padding: 0 1.5rem;
	transition: max-height 0.4s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.3s ease, margin-top 0.3s ease, padding 0.3s ease;
}
.photo_order_content.expanded {
	max-height: 1000px;
	opacity: 1;
	margin-top: 12px;
	padding: 1.5rem;
}
/* Во время drag overflow:hidden обрезает сдвигающиеся карточки и «ломает» превью. */
.photo_order_admin_wrap.is-pg-dragging .photo_order_content.expanded {
	overflow: visible;
}

.photo_order_content::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	width: 4px;
	height: 100%;
	background: #005bff;
}
.photo_order_content h3 {
	color: #1a1a1a;
	font-weight: 600;
	font-size: 1.2rem;
	margin-bottom: 0.5rem;
}
.photo_order_content p {
	color: #555;
	font-size: 0.95rem;
	margin-bottom: 1.2rem;
}
.photo_order_hint {
	color: #64748b;
	font-size: 13px;
	margin: 0 0 8px;
}
.photo_order_status {
	min-height: 1.25em;
	font-size: 13px;
	margin: 0 0 8px;
	color: #64748b;
}
.photo_order_status.is-saving {
	color: #0284c7;
}
.photo_order_status.is-saved {
	color: #059669;
}
.photo_order_status.is-error {
	color: #dc2626;
}
.photo_order_list {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	min-height: 88px;
}
.photo_order_list.is-dragging {
	cursor: grabbing;
}
body.pg-no-select,
body.pg-no-select * {
	user-select: none !important;
	cursor: grabbing !important;
}
.photo_order_list.is-busy {
	pointer-events: none;
	opacity: 0.85;
}
.photo_order_meta_list {
	display: none;
	margin-top: 10px;
	border: 1px solid #e3e8f0;
	border-radius: 10px;
	overflow: hidden;
	background: #fafbfd;
}
.photo_order_meta_row {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 12px;
	font-size: 12px;
	line-height: 1.35;
	border-top: 1px solid #eef2f7;
}
.photo_order_meta_row:first-child {
	border-top: none;
}
.photo_order_meta_row__pos {
	flex: 0 0 28px;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	color: #64748b;
	text-align: center;
}
.photo_order_meta_row:first-child .photo_order_meta_row__pos {
	color: #005bff;
}
.photo_order_meta_row__name {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
	color: #1e293b;
}
.photo_order_meta_row__name_wrap {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	align-items: center;
	gap: 0;
}
.photo_order_meta_row__name_input {
	flex: 1 1 auto;
	min-width: 0;
	width: 100%;
	margin: 0;
	padding: 4px 8px;
	border: 1px solid #dbe3ef;
	border-radius: 6px;
	background: #fff;
	font: inherit;
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
	color: #1e293b;
}
.photo_order_meta_row__name_input:focus {
	outline: none;
	border-color: #005bff;
	box-shadow: 0 0 0 2px rgba(0, 91, 255, 0.12);
}
.photo_order_meta_list.is-busy .photo_order_meta_row__name_input {
	pointer-events: none;
	opacity: 0.7;
}
.photo_order_meta_row__ext {
	flex: 0 0 auto;
	padding-right: 4px;
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
	color: #64748b;
	white-space: nowrap;
}
.photo_order_meta_row__size {
	flex: 0 0 auto;
	font-variant-numeric: tabular-nums;
	color: #64748b;
	white-space: nowrap;
}
.photo_order_meta_row__download {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	gap: 4px;
	margin: 0;
	padding: 4px 10px;
	border: 1px solid #dbe3ef;
	border-radius: 6px;
	background: #fff;
	color: #005bff;
	font-size: 11px;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	white-space: nowrap;
	transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.photo_order_meta_row__download:hover {
	background: #eff6ff;
	border-color: #93c5fd;
	color: #0047cc;
}
.photo_order_meta_row__download svg {
	flex-shrink: 0;
}
.photo_order_meta_list.is-busy .photo_order_meta_row__download {
	pointer-events: none;
	opacity: 0.6;
}
html.dark .photo_order_meta_row__download {
	background: #1f2937;
	border-color: #374151;
	color: #93c5fd;
}
html.dark .photo_order_meta_row__download:hover {
	background: rgb(99 102 241 / 0.18);
	border-color: #818cf8;
	color: #bfdbfe;
}
.photo_order_loading,
.photo_order_msg {
	color: #666;
	font-size: 14px;
}
.photo_order_item {
	display: inline-flex;
	justify-content: center;
	align-items: center;
	height: 88px;
	min-width: 66px;
	max-width: 200px;
	border: 1px solid #e3e8f0;
	background: #fff;
	border-radius: 10px;
	overflow: hidden;
	cursor: grab;
	user-select: none;
	position: relative;
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
	transition: box-shadow 0.2s ease, border-color 0.2s ease, opacity 0.16s ease,
		transform 0.22s cubic-bezier(0.2, 0.9, 0.25, 1);
}
.photo_order_list.is-dragging .photo_order_item {
	touch-action: none;
}
/* Пока тащим, трансформ карточек — это анимация перестройки строя,
   поэтому переход оставляем только на нём. */
.photo_order_list.is-dragging .photo_order_item {
	transition: transform 0.22s cubic-bezier(0.2, 0.9, 0.25, 1), opacity 0.16s ease;
	will-change: transform;
}
.photo_order_item__index {
	position: absolute;
	top: 5px;
	left: 5px;
	z-index: 4;
	min-width: 20px;
	height: 20px;
	padding: 0 6px;
	border-radius: 6px;
	background: rgba(15, 23, 42, 0.5);
	-webkit-backdrop-filter: blur(6px) saturate(140%);
	backdrop-filter: blur(6px) saturate(140%);
	color: #fff;
	font-size: 11px;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.02em;
	line-height: 20px;
	text-align: center;
	cursor: grab;
	pointer-events: auto;
	touch-action: none;
	transition: opacity 0.16s ease, background 0.2s ease;
}
/* Первый слот — обложка товара, её отмечаем акцентом. */
.photo_order_item:first-child .photo_order_item__index {
	background: rgba(0, 91, 255, 0.88);
}
.photo_order_item__index:active {
	cursor: grabbing;
}
/* Во время перетаскивания номера соврали бы: они обновляются после
   отпускания, а положение показывает сам строй. */
.photo_order_list.is-dragging .photo_order_item__index {
	opacity: 0;
	cursor: grabbing;
}
.photo_order_item img {
	height: 100%;
	width: auto;
	max-width: 100%;
	object-fit: contain;
	display: block;
	position: relative;
	z-index: 1;
	transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1);
	-webkit-user-drag: none;
	user-drag: none;
}
.photo_order_item:active {
	cursor: grabbing;
}
/* Трансформ карточки занят анимацией перестройки, поэтому подъём при
   наведении включаем только вне перетаскивания. */
.photo_order_list:not(.is-dragging) .photo_order_item:hover {
	border-color: #bfd4ff;
	transform: translateY(-3px);
	box-shadow: 0 10px 20px rgba(15, 23, 42, 0.12);
	z-index: 2;
}
/* Карточка остаётся в потоке (геометрия списка заморожена на время drag,
   поэтому расчёт позиции вставки стабилен), но её место выглядит пустым:
   под курсором её показывает призрак. */
.photo_order_item.pg_dragging {
	cursor: grabbing !important;
	opacity: 0;
	box-shadow: none;
}
/* Рамка на освободившемся месте — куда встанет фото после отпускания. */
.photo_order_drop_zone {
	position: fixed;
	z-index: 100000;
	box-sizing: border-box;
	border: 2px dashed rgba(0, 91, 255, 0.55);
	border-radius: 10px;
	background: rgba(0, 91, 255, 0.06);
	pointer-events: none;
	transition: left 0.22s cubic-bezier(0.2, 0.9, 0.25, 1),
		top 0.22s cubic-bezier(0.2, 0.9, 0.25, 1),
		width 0.22s ease, height 0.22s ease;
}
.photo_order_ghost_drag {
	position: fixed;
	left: 0;
	top: 0;
	z-index: 100001;
	pointer-events: none;
	transition: none;
	box-sizing: border-box;
	border-color: #dbe6ff;
	border-radius: 10px;
	background: #fff;
	box-shadow: 0 18px 40px rgba(2, 32, 92, 0.28), 0 2px 8px rgba(2, 32, 92, 0.16);
	cursor: grabbing;
}
.photo_order_ghost_drag .photo_order_item__index,
.photo_order_ghost_drag .photo_order_overlay {
	display: none;
}
.photo_order_list.is-dragging .photo_order_overlay {
	display: none !important;
}

@media (prefers-reduced-motion: reduce) {
	.photo_order_item,
	.photo_order_list.is-dragging .photo_order_item,
	.photo_order_drop_zone {
		transition: none;
	}
}

/* Premium Image Rotation Overlay */
.photo_order_overlay {
	position: absolute;
	inset: 0;
	z-index: 6;
	background: rgba(0, 0, 0, 0.65);
	display: flex;
	justify-content: space-evenly;
	align-items: center;
	opacity: 0;
	transition: opacity 0.2s;
	border-radius: 3px;
	pointer-events: none;
}
.photo_order_item:hover .photo_order_overlay {
	opacity: 1;
	pointer-events: none;
}
.photo_order_overlay .rotate_btn,
.photo_order_overlay .delete_btn {
	pointer-events: auto;
	touch-action: manipulation;
}
.rotate_btn {
	background: none;
	border: none;
	color: #fff;
	font-size: 16px;
	cursor: pointer;
	padding: 0;
	outline: none;
	transition: transform 0.15s, background 0.15s;
	display: flex;
	justify-content: center;
	align-items: center;
	width: 24px;
	height: 24px;
	border-radius: 50%;
}
.rotate_btn:hover {
	transform: scale(1.15);
	background: rgba(255, 255, 255, 0.25);
}
.rotate_btn:active {
	transform: scale(0.9);
}

/* Кнопка удаления фотки — тот же стиль, что у rotate, но с акцентом */
.photo_order_overlay .delete_btn {
	background: none;
	border: none;
	color: #fff;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	padding: 0;
	outline: none;
	transition: transform 0.15s, background 0.15s, color 0.15s;
	display: flex;
	justify-content: center;
	align-items: center;
	width: 24px;
	height: 24px;
	border-radius: 50%;
}
.photo_order_overlay .delete_btn:hover {
	transform: scale(1.15);
	background: rgba(255, 80, 80, 0.85);
	color: #fff;
}
.photo_order_overlay .delete_btn:active {
	transform: scale(0.9);
}

.photo_order_status {
	min-height: 1.2em;
	color: #666;
}
