/**
 * Phase 3A.3+ — Car detail gallery: transform carousel (no Swiper JS), contain images,
 * vertical thumbs desktop, hidden scrollbars, arrows, dots, lightbox. Car scope only.
 */

.leocar-single-car-scope {
	--leocar-gallery-radius: 10px;
}

/* --- Scrollbar hiding (gallery only) --- */
.leocar-single-car-scope .mySwiperCarousel,
.leocar-single-car-scope .mySwiperThumbs .swiper-wrapper,
.leocar-single-car-scope .leocar-car-main-stage {
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.leocar-single-car-scope .mySwiperCarousel::-webkit-scrollbar,
.leocar-single-car-scope .mySwiperThumbs .swiper-wrapper::-webkit-scrollbar,
.leocar-single-car-scope .leocar-car-main-stage::-webkit-scrollbar {
	display: none;
	width: 0;
	height: 0;
}

/* --- Gallery row (JS adds .leocar-car-gallery-row on parent of carousel + thumbs) --- */
@media (max-width: 819px) {
	.leocar-single-car-scope .leocar-car-gallery-row {
		display: flex !important;
		flex-direction: column !important;
		flex-wrap: nowrap !important;
		align-items: stretch !important;
		gap: 10px !important;
	}

	.leocar-single-car-scope .leocar-car-gallery-row .mySwiperCarousel {
		width: 100% !important;
		order: 1;
	}

	.leocar-single-car-scope .leocar-car-gallery-row .mySwiperThumbs {
		width: 100% !important;
		max-width: 100% !important;
		order: 2;
		margin-top: 0 !important;
		padding: 4px;
		box-sizing: border-box;
	}

	.leocar-single-car-scope .leocar-car-gallery-row .mySwiperThumbs .swiper-wrapper {
		flex-direction: row;
		flex-wrap: wrap;
		justify-content: center;
		align-content: flex-start;
		overflow-x: hidden;
		overflow-y: hidden;
		max-height: none;
		gap: 8px;
		padding: 4px;
		box-sizing: border-box;
	}

	.leocar-single-car-scope .leocar-car-gallery-row .mySwiperThumbs .swiper-slide {
		flex: 0 0 72px;
		width: 72px !important;
		min-width: 72px;
		max-width: 72px;
		height: 56px;
	}
}

@media (min-width: 820px) {
	.leocar-single-car-scope .leocar-car-gallery-row {
		display: flex !important;
		flex-direction: row-reverse !important;
		align-items: flex-start !important;
		justify-content: space-between !important;
		gap: 12px;
	}

	.leocar-single-car-scope .leocar-car-gallery-row .mySwiperThumbs {
		width: 112px !important;
		max-width: 112px !important;
		flex-shrink: 0;
		margin-top: 0 !important;
		padding: 4px;
		box-sizing: border-box;
		display: flex;
		flex-direction: column;
		align-self: flex-start;
		/* Height set by JS to match .leocar-car-main-stage (square); fallback before paint */
		height: var(--leocar-stage-h, min(560px, 72vh));
		max-height: var(--leocar-stage-h, min(560px, 72vh));
		min-height: 0;
		overflow: hidden;
	}

	.leocar-single-car-scope .leocar-car-gallery-row .mySwiperThumbs .swiper-wrapper {
		display: flex;
		flex: 1 1 auto;
		flex-direction: column;
		flex-wrap: nowrap;
		align-items: stretch;
		min-height: 0;
		max-height: none;
		overflow-x: hidden;
		overflow-y: auto;
		gap: 8px;
		padding: 4px;
		box-sizing: border-box;
	}

	.leocar-single-car-scope .leocar-car-gallery-row .mySwiperThumbs .swiper-slide {
		flex: 0 0 auto;
		width: 100% !important;
		min-width: 0 !important;
		max-width: 100% !important;
		height: 72px;
	}
}

/* --- Main carousel chrome --- */
.leocar-single-car-scope .mySwiperCarousel {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	width: 100%;
	background-color: transparent;
}

.leocar-single-car-scope .leocar-car-main-stage {
	position: relative;
	overflow: hidden;
	width: 100%;
	align-self: stretch;
	aspect-ratio: 1 / 1;
	max-width: 100%;
	background-color: rgb(20 20 20);
	border-radius: var(--leocar-gallery-radius);
	touch-action: manipulation;
	outline: none;
}

.leocar-single-car-scope .leocar-car-main-stage .swiper-wrapper {
	display: flex;
	flex-direction: row;
	flex-wrap: nowrap;
	height: 100%;
	width: calc(var(--leocar-slides, 1) * 100%);
	will-change: transform;
}

.leocar-single-car-scope .leocar-car-main-stage .swiper-slide {
	flex: 0 0 calc(100% / var(--leocar-slides, 1)) !important;
	width: auto !important;
	min-width: 0 !important;
	max-width: none !important;
	height: 100%;
	box-sizing: border-box;
	overflow: hidden;
	border-radius: var(--leocar-gallery-radius);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
}

.leocar-single-car-scope .leocar-car-main-stage .swiper-slide img {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain !important;
	object-position: center center !important;
	display: block;
	border-radius: inherit;
	cursor: zoom-in;
}

.leocar-single-car-scope .leocar-car-main-stage .swiper-slide > div[role='img'] {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* --- Thumbnails (contain — no cropping of vehicle details) --- */
.leocar-single-car-scope .mySwiperThumbs .swiper-slide {
	position: relative;
	overflow: hidden;
	border-radius: var(--leocar-gallery-radius);
	box-sizing: border-box;
	cursor: pointer;
	opacity: 0.85;
	transition: opacity 0.15s ease;
	display: flex;
	align-items: center;
	justify-content: center;
}

.leocar-single-car-scope .mySwiperThumbs .swiper-slide img {
	position: relative;
	z-index: 1;
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain !important;
	object-position: center center !important;
	display: block;
	border-radius: inherit;
}

/* Active ring: pseudo overlay above image (inset box-shadow sits under img paint) */
.leocar-single-car-scope .mySwiperThumbs .swiper-slide.leocar-car-thumb-active::after,
.leocar-single-car-scope .mySwiperThumbs .swiper-slide.swiper-slide-thumb-active::after {
	content: '';
	position: absolute;
	inset: 0;
	border: 2px solid #27ac5b;
	border-radius: inherit;
	pointer-events: none;
	z-index: 3;
	box-sizing: border-box;
}

.leocar-single-car-scope .mySwiperThumbs .swiper-slide.leocar-car-thumb-active,
.leocar-single-car-scope .mySwiperThumbs .swiper-slide.swiper-slide-thumb-active {
	opacity: 1;
}

/* Single slide: hide controls + thumbs */
.leocar-single-car-scope .mySwiperCarousel.leocar-car-gallery--single ~ .mySwiperThumbs,
.leocar-single-car-scope .leocar-car-gallery--single .mySwiperThumbs {
	display: none !important;
}

.leocar-single-car-scope .mySwiperCarousel.leocar-car-gallery--single,
.leocar-single-car-scope .leocar-car-gallery--single .mySwiperCarousel {
	width: 100% !important;
}

.leocar-single-car-scope .mySwiperCarousel.leocar-car-gallery--single .swiper-pagination,
.leocar-single-car-scope .mySwiperCarousel.leocar-car-gallery--single .swiper-button-prev,
.leocar-single-car-scope .mySwiperCarousel.leocar-car-gallery--single .swiper-button-next {
	display: none !important;
}

/* --- Pagination dots (centered under main stage width = carousel column) --- */
.leocar-single-car-scope .mySwiperCarousel .swiper-pagination {
	position: relative !important;
	display: flex !important;
	flex-wrap: wrap;
	align-items: center !important;
	justify-content: center !important;
	align-self: stretch;
	gap: 8px;
	min-height: 22px;
	width: 100% !important;
	max-width: 100%;
	margin: 0 !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
	padding: 0 !important;
	left: 0 !important;
	right: auto !important;
	bottom: auto !important;
	top: auto !important;
	transform: none !important;
	text-align: center;
}

.leocar-single-car-scope .mySwiperCarousel .swiper-pagination-bullet {
	width: 9px;
	height: 9px;
	border-radius: 999px;
	background: rgba(250 250 250 / 0.35);
	opacity: 1;
	cursor: pointer;
	border: none;
	padding: 0;
	margin: 0 !important;
	position: relative !important;
	left: auto !important;
	right: auto !important;
	transform: none !important;
	display: inline-block;
	box-sizing: border-box;
	transition: background 0.15s ease, transform 0.15s ease;
}

.leocar-single-car-scope .mySwiperCarousel .swiper-pagination-bullet-active {
	background: #27ac5b;
	transform: scale(1.15) !important;
}

/* --- Arrows --- */
.leocar-single-car-scope .leocar-car-main-stage .swiper-button-prev,
.leocar-single-car-scope .leocar-car-main-stage .swiper-button-next {
	position: absolute;
	top: 50%;
	z-index: 4;
	transform: translateY(-50%);
	width: 40px;
	height: 40px;
	margin: 0;
	border: none;
	border-radius: 999px;
	background: rgba(0 0 0 / 0.45);
	cursor: pointer;
	display: flex !important;
	align-items: center;
	justify-content: center;
	color: #fafafa;
	transition: background 0.15s ease, opacity 0.15s ease;
}

.leocar-single-car-scope .leocar-car-main-stage .swiper-button-prev {
	left: 10px;
}

.leocar-single-car-scope .leocar-car-main-stage .swiper-button-next {
	right: 10px;
}

.leocar-single-car-scope .leocar-car-main-stage .swiper-button-prev::after,
.leocar-single-car-scope .leocar-car-main-stage .swiper-button-next::after {
	display: none;
}

.leocar-single-car-scope .leocar-car-main-stage .swiper-button-prev::before {
	content: '';
	display: block;
	width: 10px;
	height: 10px;
	border-left: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg) translate(2px, -2px);
}

.leocar-single-car-scope .leocar-car-main-stage .swiper-button-next::before {
	content: '';
	display: block;
	width: 10px;
	height: 10px;
	border-right: 2px solid currentColor;
	border-top: 2px solid currentColor;
	transform: rotate(45deg) translate(-2px, 2px);
}

.leocar-single-car-scope .leocar-car-main-stage .swiper-button-prev.leocar-gallery-nav-disabled,
.leocar-single-car-scope .leocar-car-main-stage .swiper-button-next.leocar-gallery-nav-disabled {
	opacity: 0.35;
	cursor: default;
}

/* --- Fullscreen lightbox (appended to body by car JS only) --- */
.leocar-car-lightbox {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 52px 10px 12px;
	box-sizing: border-box;
}

.leocar-car-lightbox[hidden] {
	display: none !important;
}

.leocar-car-lightbox__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0 0 0 / 0.92);
	cursor: pointer;
}

/* Control buttons only (not full-screen backdrop) — flex centering, no glyph baseline drift */
.leocar-car-lightbox button.leocar-car-lightbox__close,
.leocar-car-lightbox button.leocar-car-lightbox__nav {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	padding: 0;
	margin: 0;
	-webkit-appearance: none;
	appearance: none;
	font: inherit;
}

.leocar-car-lightbox__close .leocar-car-lightbox__icon,
.leocar-car-lightbox__nav .leocar-car-lightbox__icon {
	display: block;
	flex-shrink: 0;
	width: 22px;
	height: 22px;
}

.leocar-car-lightbox__nav .leocar-car-lightbox__icon {
	width: 28px;
	height: 28px;
}

@media (min-width: 768px) {
	.leocar-car-lightbox__close .leocar-car-lightbox__icon {
		width: 24px;
		height: 24px;
	}

	.leocar-car-lightbox__nav .leocar-car-lightbox__icon {
		width: 34px;
		height: 34px;
	}
}

.leocar-car-lightbox__close {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 3;
	width: 44px;
	height: 44px;
	border: none;
	border-radius: 999px;
	background: rgba(255 255 255 / 0.12);
	color: #fafafa;
	cursor: pointer;
	box-sizing: border-box;
}

.leocar-car-lightbox__close:hover {
	background: rgba(255 255 255 / 0.2);
}

.leocar-car-lightbox__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 3;
	width: 48px;
	height: 48px;
	border: none;
	border-radius: 999px;
	background: rgba(0 0 0 / 0.5);
	color: #fafafa;
	cursor: pointer;
	box-sizing: border-box;
}

.leocar-car-lightbox__nav--prev {
	left: 16px;
}

.leocar-car-lightbox__nav--next {
	right: 16px;
}

@media (min-width: 768px) {
	.leocar-car-lightbox__nav {
		width: 60px;
		height: 60px;
	}

	.leocar-car-lightbox__nav--prev {
		left: 40px;
	}

	.leocar-car-lightbox__nav--next {
		right: 40px;
	}
}

.leocar-car-lightbox__nav.leocar-gallery-nav-disabled {
	opacity: 0.3;
	pointer-events: none;
}

.leocar-car-lightbox__frame {
	position: relative;
	z-index: 2;
	width: 100%;
	max-width: min(98vw, 1680px);
	max-height: min(94vh, 100dvh - 64px);
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
}

.leocar-car-lightbox__img {
	max-width: min(98vw, 1680px);
	max-height: min(94vh, 100dvh - 64px);
	width: auto;
	height: auto;
	object-fit: contain;
	object-position: center center;
	pointer-events: auto;
}

/* --- Form: CTA row (car detail only) --- */
.leocar-single-car-scope .form-buttons-wrapper {
	display: flex !important;
	flex-direction: row;
	flex-wrap: nowrap;
	align-items: center !important;
	justify-content: flex-start;
	gap: 12px;
	margin-top: 1.5rem !important;
	margin-bottom: 0 !important;
}

.leocar-single-car-scope .form-buttons-wrapper .issue-button.button,
.leocar-single-car-scope .form-buttons-wrapper .show-tariff.button {
	height: 48px;
	min-height: 48px;
	max-height: 48px;
	box-sizing: border-box;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	line-height: 1 !important;
	margin-top: 0 !important;
	margin-bottom: 0 !important;
	padding-top: 0;
	padding-bottom: 0;
}

.leocar-single-car-scope .form-buttons-wrapper .issue-button.button {
	background: #27ac5b !important;
	background-image: none !important;
	color: #fafafa !important;
	border: 0 !important;
	border-radius: 15px !important;
	padding-left: 20px !important;
	padding-right: 20px !important;
	font-weight: 700 !important;
	font-size: 1.25rem !important;
	max-width: none !important;
	width: auto !important;
	min-width: 11.5rem;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color 0.15s ease, filter 0.15s ease;
}

.leocar-single-car-scope .form-buttons-wrapper .issue-button.button:hover {
	background: #2fc468 !important;
	filter: brightness(1.03);
}

.leocar-single-car-scope .form-buttons-wrapper .issue-button.button:focus-visible {
	outline: 2px solid #fafafa;
	outline-offset: 2px;
}

@media (max-width: 639px) {
	.leocar-single-car-scope .form-buttons-wrapper {
		flex-direction: column;
		align-items: stretch !important;
		flex-wrap: wrap;
	}

	.leocar-single-car-scope .form-buttons-wrapper .issue-button.button,
	.leocar-single-car-scope .form-buttons-wrapper .show-tariff.button {
		width: 100%;
		max-width: 100%;
	}
}

.leocar-single-car-scope .form-buttons-wrapper .show-tariff.button,
.leocar-single-car-scope .form-buttons-wrapper .show-tariff.show-prices {
	background-color: #163e25 !important;
	background-image: none !important;
	color: #27ac5b !important;
	border: 1px solid rgba(255 255 255 / 0.08);
	border-radius: 15px;
	padding-left: 16px;
	padding-right: 16px;
	font-weight: 600;
}

.leocar-single-car-scope .form-buttons-wrapper .show-tariff.button:hover,
.leocar-single-car-scope .form-buttons-wrapper .show-tariff.show-prices:hover {
	filter: brightness(1.06);
}

/* --- Single car: catalog-style list price row --- */
.leocar-single-car-scope form .leocar-single-car-price-row.leocar-catalog-terms-price-row {
	display: flex !important;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.5rem;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
}

.leocar-single-car-scope form .leocar-single-car-price-row .leocar-single-car-price-amount-wrap {
	margin-top: 0 !important;
	justify-content: flex-end !important;
	flex: 1 1 auto;
	min-width: 0;
	text-align: right;
}

.leocar-single-car-scope form .leocar-single-car-price-row .font-400.text-4xl,
.leocar-single-car-scope form .leocar-single-car-price-row .text-accent {
	display: inline;
	width: auto;
	text-align: right;
}

/* --- Car detail: price + deposit row (desktop — align to form column, not viewport) --- */
@media (min-width: 1024px) {
	.leocar-single-car-scope .leo-car .container > div:has(> form) {
		min-width: 0;
		max-width: 100%;
		box-sizing: border-box;
	}

	.leocar-single-car-scope .leo-car .container > div:has(> form) form {
		width: 100%;
		max-width: 100%;
		min-width: 0;
		box-sizing: border-box;
	}

	.leocar-single-car-scope form > div:has(> .price):has(> .deposit) {
		width: 100%;
		max-width: 100%;
		box-sizing: border-box;
		display: flex;
		justify-content: space-between;
		align-items: baseline;
		gap: 12px;
		padding-left: 12px;
		padding-right: 12px;
	}

	.leocar-single-car-scope form > div:has(> .price):has(> .deposit) .deposit {
		margin-left: auto;
		text-align: right;
		flex-shrink: 0;
	}
}

/* Radio tariff / safety labels (from export inline CSS) */
.leocar-single-car-scope input[type='radio']:checked + label {
	--tw-bg-opacity: 1;
	background-color: rgb(33 33 33 / var(--tw-bg-opacity));
}

.leocar-single-car-scope label[for='additional'] {
	--tw-text-opacity: 1;
	color: rgb(248 177 50 / var(--tw-text-opacity));
}

.leocar-single-car-scope label[for='plus'] {
	--tw-text-opacity: 1;
	color: rgb(39 172 91 / var(--tw-text-opacity));
}

/* --- Plain listing page: hide legacy rental UI --- */
.leocar-single-car-scope form fieldset.additional-security,
.leocar-single-car-scope form fieldset.car-days,
.leocar-single-car-scope form > div:has(> fieldset.additional-security),
.leocar-single-car-scope form > div:has(> fieldset.car-days),
.leocar-single-car-scope .form-buttons-wrapper .show-tariff.show-prices,
.leocar-single-car-scope .car-description,
.leocar-single-car-scope section.leo-safety,
.leocar-single-car-scope section.leo-additional-services,
.leocar-single-car-scope section.leo-fines,
.leocar-single-car-scope .require-call {
	display: none !important;
}

.leocar-single-car-scope .form-buttons-wrapper:has(.issue-button):not(:has(.show-tariff.show-prices)) {
	justify-content: flex-start;
}

.leocar-single-car-scope .form-buttons-wrapper:has(.issue-button):not(:has(.show-tariff.show-prices)) .issue-button {
	margin-right: 0;
	max-width: 300px;
}
