/**
 * Media Slider widget styles.
 *
 * @package ThemeREX\AutoDealer
 */

/* Main slide */
.trx-ad-media-slider .trx-ad-ms-main .swiper-slide {
	position: relative;
	padding-bottom: var(--trx-ad-ms-aspect, 56.25%);
	height: 0;
	overflow: hidden;
	background: #000;
	border-radius: 8px;
}

.trx-ad-media-slider .trx-ad-ms-main .swiper-slide img,
.trx-ad-media-slider .trx-ad-ms-main .swiper-slide video,
.trx-ad-media-slider .trx-ad-ms-main .swiper-slide iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
	border: 0;
}

/* Navigation arrows — self-contained so they never depend on Swiper's bundled
   swiper-icons @font-face. Elementor registers a 'swiper' handle pointing at a
   stripped v8 build with no icon font; when it won (handle collision) the arrows
   rendered as broken glyphs, and on a no-Elementor site no Swiper CSS loaded at
   all so they dropped into normal flow below the image (UAT #12pt1). We now load
   our own bundle under 'trx-ad-swiper' AND draw our own chevrons + force the
   overlay layout here, so the gallery is correct in every theme. */
.trx-ad-media-slider .trx-ad-ms-main .swiper-button-prev,
.trx-ad-media-slider .trx-ad-ms-main .swiper-button-next {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 10;
	width: 40px;
	height: 40px;
	margin: 0;
	border-radius: 50%;
	background-color: rgba(0, 0, 0, 0.45);
	background-repeat: no-repeat;
	background-position: center;
	background-size: 40% 40%;
	cursor: pointer;
	transition: background-color 0.15s ease, opacity 0.15s ease;
}

.trx-ad-media-slider .trx-ad-ms-main .swiper-button-prev {
	left: 12px;
	right: auto;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='15 18 9 12 15 6'/%3E%3C/svg%3E");
}

.trx-ad-media-slider .trx-ad-ms-main .swiper-button-next {
	right: 12px;
	left: auto;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'/%3E%3C/svg%3E");
}

/* Suppress Swiper's font-icon glyph entirely — we use the background SVGs. */
.trx-ad-media-slider .trx-ad-ms-main .swiper-button-prev::after,
.trx-ad-media-slider .trx-ad-ms-main .swiper-button-next::after {
	content: '';
	display: none;
}

.trx-ad-media-slider .trx-ad-ms-main .swiper-button-prev:hover,
.trx-ad-media-slider .trx-ad-ms-main .swiper-button-next:hover {
	background-color: rgba(0, 0, 0, 0.7);
}

.trx-ad-media-slider .trx-ad-ms-main .swiper-button-prev:focus-visible,
.trx-ad-media-slider .trx-ad-ms-main .swiper-button-next:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

/* Swiper flags the end-of-range button (non-loop) with this class. */
.trx-ad-media-slider .trx-ad-ms-main .swiper-button-disabled {
	opacity: 0.35;
	cursor: default;
}

/* Thumbs */
.trx-ad-media-slider .trx-ad-ms-thumbs {
	margin-top: 10px;
}

.trx-ad-media-slider .trx-ad-ms-thumbs .swiper-slide {
	cursor: pointer;
	opacity: 0.5;
	transition: opacity 0.2s;
	border-radius: 4px;
	overflow: hidden;
	position: relative;
	aspect-ratio: 4/3;
}

.trx-ad-media-slider .trx-ad-ms-thumbs .swiper-slide-thumb-active {
	opacity: 1;
	outline: 2px solid var(--e-global-color-primary, #2563eb);
	outline-offset: -2px;
}

.trx-ad-media-slider .trx-ad-ms-thumbs .swiper-slide:hover {
	opacity: 0.85;
}

.trx-ad-media-slider .trx-ad-ms-thumbs .swiper-slide img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* Video thumb placeholder */
.trx-ad-media-slider .trx-ad-ms-thumb-placeholder {
	display: block;
	width: 100%;
	height: 100%;
	background: #1a1a1a;
}

/* Play icon overlay — must outrank .trx-ad-ms-video-poster (z-index:2) so
   it stays visible on top of the poster image in the main slider. */
.trx-ad-media-slider .trx-ad-ms-play {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
	z-index: 3;
}

.trx-ad-media-slider .trx-ad-ms-play svg {
	width: 28px;
	height: 28px;
	fill: #fff;
	filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
}

.trx-ad-media-slider .trx-ad-ms-main .trx-ad-ms-play {
	/* Bigger circular badge for the main slide. */
	background: rgba(0, 0, 0, 0.45);
	width: 88px;
	height: 88px;
	inset: auto;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	border-radius: 50%;
	transition: background 0.15s ease, transform 0.15s ease;
}

.trx-ad-media-slider .trx-ad-ms-main .swiper-slide:hover .trx-ad-ms-play {
	background: rgba(0, 0, 0, 0.65);
	transform: translate(-50%, -50%) scale(1.05);
}

.trx-ad-media-slider .trx-ad-ms-main .trx-ad-ms-play svg {
	width: 40px;
	height: 40px;
	margin-left: 4px; /* nudge the play triangle visually centered */
}

/* Video poster (click-to-play) */
.trx-ad-media-slider .trx-ad-ms-video-poster {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
	cursor: pointer;
	z-index: 2;
}

/* Empty state */
.trx-ad-media-slider--empty {
	text-align: center;
	padding: 40px;
	/* WCAG AA: #767676 on #ffffff = 4.54:1. The previous #999 = 2.84:1 failed. */
	color: #595959;
}
