/* 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: zoom-in;
}

/* Кнопка лайтбокса (иконка) поверх зума — z-index выше слоя jquery.zoom */
.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: rgba(255, 255, 255, 0.95);
	color: #333;
	font: inherit;
	line-height: 1;
}

.product-gallery-lightbox-btn:hover {
	background: #fff;
	color: #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 {
	background-color: #fff;
	max-width: min(96vw, 1200px);
	margin-left: auto;
	margin-right: auto;
}

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

.product-gallery-modal .popup-close.arcticmodal-close:hover {
	color: #333;
}

.product-gallery-modal__content {
	padding: 44px 20px 24px;
	text-align: center;
	box-sizing: border-box;
}

.product-gallery-modal__img {
	display: inline-block;
	max-width: 100%;
	max-height: min(78vh, 880px);
	width: auto;
	height: auto;
	object-fit: contain;
	vertical-align: middle;
}

/* 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: #999;
	cursor: pointer;
	transition: all 0.2s ease;
	outline: none;
}
.photo_order_toggle_btn:hover {
	background: #f0f2f5;
	color: #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;
}

.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_list {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}
.photo_order_loading,
.photo_order_msg {
	color: #666;
	font-size: 14px;
}
.photo_order_item {
	display: inline-flex;
	justify-content: center;
	align-items: center;
	height: 80px;
	min-width: 60px;
	max-width: 200px;
	border: 1px solid #ddd;
	background: #fff;
	border-radius: 4px;
	overflow: hidden;
	cursor: grab;
	user-select: none;
	position: relative;
	transition: box-shadow 0.2s, border-color 0.2s;
}
.photo_order_item img {
	height: 100%;
	width: auto;
	max-width: 100%;
	object-fit: contain;
	display: block;
	transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1);
}
.photo_order_item:active {
	cursor: grabbing;
}
.photo_order_item:hover {
	border-color: #005bff;
	transform: scale(1.05);
	box-shadow: 0 4px 8px rgba(0,0,0,0.1);
	z-index: 2;
}
.photo_order_drag {
	cursor: grabbing !important;
	opacity: 0.9;
	transform: scale(1.05);
	box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}
.photo_order_ghost {
	opacity: 0.4;
	background-color: #f8f9fa;
	border: 2px dashed #005bff;
	border-radius: 4px;
}

/* Premium Image Rotation Overlay */
.photo_order_overlay {
	position: absolute;
	inset: 0;
	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: auto;
}
.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;
}

