/**
 * CBO-WP Dynamic Engine — Elementor loop widgets, shared pagination styling.
 *
 * Deliberately minimal, matching assets/css/frontend/query-loop.css
 * (the Gutenberg block's own pagination styling) — same visual language
 * across both, styled to inherit the active theme's colors rather than
 * impose a fixed palette this plugin has no way to know matches the site.
 */

.dynamic-engine-elementor-loop[aria-busy="true"] {
	transition: opacity 0.15s ease;
}

.dynamic-engine-elementor-loop {
	display: flex;
	flex-direction: column;
	/* Fill the parent even when it is a shrink-to-fit flex/grid item
	   (Elementor containers). Without this a carousel inside measured
	   its own content, so slides came out the wrong size or collapsed. */
	width: 100%;
	max-width: 100%;
	min-width: 0;
	box-sizing: border-box;
}

.dynamic-engine-elementor-loop > * {
	order: 3;
	min-width: 0;
}

.dynamic-engine-elementor-loop > .dynamic-engine-elementor-loop__filters { order: 1; }
.dynamic-engine-elementor-loop > .dynamic-engine-elementor-loop__grid {
	display: grid;
	grid-template-columns: repeat(var(--de-loop-cols, 3), minmax(0, 1fr));
	gap: 24px;
}

.dynamic-engine-elementor-loop__pagination { order: 4; }
.dynamic-engine-elementor-loop > .dynamic-engine-elementor-loop__pagination--above { order: 2; margin-top: 0; margin-bottom: 24px; }

.dynamic-engine-elementor-loop__pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	flex-wrap: wrap;
	margin-top: 24px;
}

button.dynamic-engine-elementor-loop__pagination-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.45em;
	box-sizing: border-box;
	min-width: 2.25em;
	padding: 0.5em 0.85em;
	border: 1px solid currentColor;
	border-radius: 3px;
	background: transparent;
	cursor: pointer;
	font: inherit;
}

button.dynamic-engine-elementor-loop__pagination-btn:hover:not(:disabled) {
	opacity: 0.8;
}

button.dynamic-engine-elementor-loop__pagination-btn:disabled {
	opacity: 0.35;
	cursor: default;
}

button.dynamic-engine-elementor-loop__pagination-btn.is-current {
	font-weight: 700;
	text-decoration: underline;
}

.dynamic-engine-elementor-loop__pagination-ellipsis {
	padding: 0 4px;
}

.dynamic-engine-elementor-loop__results-summary {
	font-size: 0.9em;
	opacity: 0.75;
	margin: 8px 0;
}

.de-summary-place-top .dynamic-engine-elementor-loop > .dynamic-engine-elementor-loop__results-summary { order: 0; }
.de-summary-place-bottom .dynamic-engine-elementor-loop > .dynamic-engine-elementor-loop__results-summary { order: 5; }

.dynamic-engine-elementor-loop__error {
	color: #b32d2e;
	margin-top: 12px;
}

.dynamic-engine-post-term-loop__empty,
.dynamic-engine-repeater-loop__empty {
	color: #50575e;
	font-style: italic;
}

.dynamic-engine-elementor-loop__filters {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 20px;
	margin-bottom: 20px;
}

.dynamic-engine-elementor-loop__filter-group {
	border: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 14px;
}

.dynamic-engine-elementor-loop__filter-group legend {
	font-weight: 700;
	width: 100%;
	margin-bottom: 4px;
	padding: 0;
}

.dynamic-engine-elementor-loop__filter-option {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	cursor: pointer;
	font: inherit;
}

/* Pills — real, explicit request: highly customizable display type for
   the taxonomy filter, alongside the original checkboxes and a new
   radio (single-select) option. The underlying <input> is still a real
   checkbox/radio (same class, same :checked contract the existing
   filter JS already depends on) — just visually hidden, since the
   pill itself IS the clickable control now. */
.dynamic-engine-elementor-loop__filter-option--pill {
	padding: 6px 14px;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.06);
	transition: background-color 150ms ease, color 150ms ease;
}

.dynamic-engine-elementor-loop__filter-option--pill input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
	pointer-events: none;
}

.dynamic-engine-elementor-loop__filter-option--pill.is-active {
	background: #1f2937;
	color: #ffffff;
}

.dynamic-engine-elementor-loop__filter-option-count {
	opacity: 0.7;
	font-size: 0.9em;
}

/* Icon Cards — same hidden-native-input technique as Pills, arranged
   as a real grid of cards rather than an inline wrapped row. */
.dynamic-engine-elementor-loop__filter-group--icon-cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
	gap: 12px;
	width: 100%;
}

.dynamic-engine-elementor-loop__filter-option--icon-card {
	flex-direction: column;
	justify-content: center;
	text-align: center;
	gap: 8px;
	padding: 14px 10px;
	border-radius: 6px;
	background: rgba(0, 0, 0, 0.04);
	transition: background-color 150ms ease;
}

.dynamic-engine-elementor-loop__filter-option--icon-card input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
	pointer-events: none;
}

.dynamic-engine-elementor-loop__filter-option--icon-card.is-active {
	background: rgba(0, 0, 0, 0.12);
}

.dynamic-engine-elementor-loop__filter-option--icon-card img {
	display: block;
	margin: 0 auto;
	object-fit: cover;
	border-radius: 4px;
}

.dynamic-engine-elementor-loop__filter-option--icon-card i {
	display: block;
	line-height: 1;
}

.dynamic-engine-elementor-loop__filter-search {
	font: inherit;
	padding: 0.5em 0.75em;
	border: 1px solid currentColor;
	border-radius: 3px;
	background: transparent;
	min-width: 220px;
}

/* Field-based filters (checkbox/radio/exact-match/range) reuse the
   same .dynamic-engine-elementor-loop__filter-group / __filter-option
   classes as the taxonomy facet above — no separate styling needed for
   those. Only the range inputs and the exact-match text field need
   their own rules. */
.dynamic-engine-elementor-loop__filter-field-exact {
	font: inherit;
	padding: 0.5em 0.75em;
	border: 1px solid currentColor;
	border-radius: 3px;
	background: transparent;
	min-width: 160px;
}

.dynamic-engine-elementor-loop__filter-range {
	display: flex;
	align-items: center;
	gap: 8px;
}

.dynamic-engine-elementor-loop__filter-field-range-min,
.dynamic-engine-elementor-loop__filter-field-range-max {
	font: inherit;
	padding: 0.5em 0.6em;
	border: 1px solid currentColor;
	border-radius: 3px;
	background: transparent;
	width: 90px;
}

/* Loop Widgets Phase C — carousel display mode, works identically for
   both the Swiper and Built-in Carousel Engines. Base structural rules
   (position/overflow) are written here directly rather than relying on
   swiper-bundle.min.css's own `.swiper{...}` rule for them — the
   Built-in engine deliberately never loads that stylesheet at all
   (loading it would defeat the entire point of a dependency-free
   option), so both engines need these rules from this plugin's own
   CSS regardless. Arrows are real <button> elements with inline SVG
   icons (LoopCarouselMarkup::render_arrow_button()) — deliberately NOT
   Swiper's own icon-font approach (`font-family: swiper-icons` +
   `content: 'prev'`), which silently renders as literal text if
   Swiper's own CSS isn't loaded (a real bug hit during live testing) —
   real SVG + `stroke="currentColor"` is both more robust and the only
   way to make arrows genuinely stylable at all. */
.dynamic-engine-elementor-loop__carousel {
	position: relative;
	width: 100%;
	max-width: 100%;
	min-width: 0;
	box-sizing: border-box;
	overflow: hidden;
	padding-bottom: 8px;
	z-index: 1;
}

.dynamic-engine-elementor-loop__carousel .swiper-wrapper {
	display: flex;
	will-change: transform;
	user-select: none;
}

.dynamic-engine-elementor-loop__carousel .swiper-slide,
.dynamic-engine-elementor-loop__carousel .swiper-slide img {
	-webkit-user-drag: none;
	user-drag: none;
}

.dynamic-engine-elementor-loop__carousel .swiper-slide {
	flex-shrink: 0;
	position: relative;
}

button.dynamic-engine-elementor-loop__carousel-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 2.25em;
	height: 2.25em;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 1px solid rgba(0, 0, 0, 0.15);
	border-radius: 50%;
	/* Explicit, readable defaults. The icon used to inherit the section's
	   text colour, which is white on a dark card: a white icon on the
	   (white) circle = an empty circle on the front end, while the editor
	   showed it dark. The Style tab's Icon / Background colours override. */
	background: rgba(255, 255, 255, 0.92);
	color: #1f2937;
	padding: 0;
	cursor: pointer;
	z-index: 2;
}

button.dynamic-engine-elementor-loop__carousel-arrow svg {
	display: block;
	width: 60%;
	height: 60%;
}

/* Real bug fixed here, confirmed via live testing: the Icon Color
   control changed the button's own `color`, which the hand-built
   Chevron/Arrow/Caret SVGs correctly inherit via stroke/fill=
   "currentColor" — but Icon Library output (Elementor's own
   Icons_Manager::render_icon()) didn't visibly change color at all.
   This forces color inheritance explicitly on whatever Elementor
   actually renders — an icon-font <i> tag (Font Awesome's older,
   more common integration, which normally already inherits `color`
   correctly, but a more specific rule from Elementor's own Font
   Awesome stylesheet could still win depending on load order) or an
   inline <svg> (newer Font Awesome SVG output) — rather than relying
   on inheritance alone. */
button.dynamic-engine-elementor-loop__carousel-arrow i {
	color: inherit;
}

button/* Icon-library SVGs are solid shapes; the plugin's own stroke-only
   chevrons declare fill="none" and must keep it (a forced fill turned
   them into triangles). */
button.dynamic-engine-elementor-loop__carousel-arrow svg:not([fill="none"]) {
	fill: currentColor;
}

button.dynamic-engine-elementor-loop__carousel-arrow svg {
	stroke: currentColor;
}

.dynamic-engine-elementor-loop__carousel-arrow--disabled,
button.dynamic-engine-elementor-loop__carousel-arrow.swiper-button-disabled {
	/* .swiper-button-disabled: real bug, confirmed via live testing.
	   Swiper's own navigation module auto-applies this class directly to
	   whatever element reference was passed as navigation.nextEl/prevEl
	   (see elementor-loop-carousel.js) — it doesn't require or check for
	   Swiper's own .swiper-button-next/-prev classes to do so. When the
	   arrow markup moved to this plugin's own custom classes (real SVG
	   buttons, not Swiper's icon-font approach), Swiper kept correctly
	   adding its class exactly as before — but nothing here was still
	   styling it, so the grey-out-at-the-end behavior silently stopped
	   working for the Swiper engine specifically (the Built-in engine's
	   own --disabled modifier class was unaffected, which is why only
	   Swiper showed this regression). Same visual treatment either way,
	   just now covering both engines' own way of signaling "disabled." */
	opacity: 0.35;
	cursor: default;
	pointer-events: none;
}

.dynamic-engine-elementor-loop__carousel-arrow--prev {
	left: 8px;
}

.dynamic-engine-elementor-loop__carousel-arrow--next {
	right: 8px;
}

/* "Show on Hover Only" (Carousel Style tab → Arrows → Visibility) —
   pure CSS, no JS involved. Only applied when the widget owner actually
   chose it; the default (no modifier class) keeps arrows always visible. */
.dynamic-engine-elementor-loop__carousel--arrows-hover button.dynamic-engine-elementor-loop__carousel-arrow {
	opacity: 0;
	transition: opacity 200ms ease;
}

.dynamic-engine-elementor-loop__carousel--arrows-hover:hover button.dynamic-engine-elementor-loop__carousel-arrow {
	opacity: 1;
}

.dynamic-engine-elementor-loop__carousel > .swiper-pagination.swiper-pagination {
	top: auto;
	bottom: auto;
	left: auto;
	width: 100%;
}

.dynamic-engine-elementor-loop__carousel .swiper-pagination {
	position: relative;
	margin-top: 16px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
}

.dynamic-engine-elementor-loop__carousel .swiper-pagination-bullet {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: currentColor;
	opacity: 0.3;
	cursor: pointer;
	display: inline-block;
}

.dynamic-engine-elementor-loop__carousel .swiper-pagination-bullet-active {
	opacity: 1;
}

.dynamic-engine-elementor-loop__carousel-progress {
	height: 3px;
	background: rgba(0, 0, 0, 0.15);
	overflow: hidden;
}

.dynamic-engine-elementor-loop__carousel-progress .swiper-pagination-progressbar-fill {
	display: block;
	height: 100%;
	width: 100%;
	background: currentColor;
	transform-origin: left center;
	transition: transform 200ms ease;
}

/**
 * Real, confirmed fix for a real, live bug, found via a real report and
 * screenshot rather than guessed at: Coverflow slides showed mirrored,
 * upside-down-looking text instead of tilting normally in 3D — traced
 * directly to Swiper's own bundled CSS. Swiper applies
 * backface-visibility: hidden to slides inside .swiper-cube,
 * .swiper-flip, .swiper-creative, .swiper-cards, and
 * .swiper-backface-hidden — confirmed by searching that exact CSS file
 * — but never to .swiper-coverflow. With this plugin's own real default
 * (50deg) and a widget commonly showing 3-4+ slides at once, side
 * slides easily rotate past 90deg, the threshold where an element
 * without backface-visibility: hidden shows its own mirrored reverse
 * face rather than becoming invisible. Adding the missing rule
 * ourselves, scoped to Coverflow specifically, is the real, direct fix
 * — not a workaround.
 */
.dynamic-engine-elementor-loop__carousel.swiper-coverflow .swiper-slide {
	backface-visibility: hidden;
	-webkit-backface-visibility: hidden;
}

/**
 * Real, direct answer to two confirmed requests — "the center item
 * needs to be bigger" and "spacing around the center item." Applied to
 * a real, dedicated inner wrapper (LoopCarouselMarkup::wrap_item_content()),
 * never to .swiper-slide itself: Swiper sets that element's own inline
 * transform directly, in JS, for real 3D positioning, and a CSS rule
 * targeting the same element would simply overwrite it outright rather
 * than combine with it. The custom properties themselves are set (via
 * real Elementor controls, LoopCarouselControlsTrait) on the real
 * .swiper-slide-active element — safe there, since defining a variable
 * never touches transform — and inherited down to this real child,
 * which is the one that actually reads and applies them.
 */
.dynamic-engine-elementor-loop__carousel-inner {
	display: block;
	height: 100%;
	transform: scale(var(--de-coverflow-center-scale, 1));
	margin: 0 var(--de-coverflow-center-spacing, 0px);
	transition: transform 200ms ease;
}

/**
 * Real, confirmed fix for a real, reported bug: "the rounded corners
 * were lost" when Center Item Size Boost was increased. Traced
 * directly to Swiper's own bundled CSS — its top-level .swiper
 * container has a real, hard overflow:hidden, core to how it hides
 * off-screen slides. The scaled-up center item above, with nowhere
 * else to grow, was extending past that outer boundary and getting
 * genuinely clipped — cutting straight through its own rounded
 * corners. This gives it real, physical room instead, proportional to
 * how much it actually grows. Real, confirmed correction: the
 * multiplier below was raised from an earlier 150px to 280px, after a
 * direct, real report that a real card's own min-height is 300px —
 * closer to that real, actual figure than the original, more generic
 * "typical card" guess. Still a real approximation, not a pixel-exact
 * measurement (which would require real JavaScript, not pure CSS, to
 * know) — real, direct testing against your own actual card height may
 * still want the new, real, manual Extra Vertical Room control below
 * (0 by default, purely additive on top of this automatic figure) for
 * final fine-tuning, rather than only this automatic calculation
 * alone.
 */
.dynamic-engine-elementor-loop__carousel.swiper-coverflow {
	padding-top: calc(((var(--de-coverflow-center-scale-outer, 1) - 1) * 280px) + var(--de-coverflow-extra-room, 0px));
	padding-bottom: calc(((var(--de-coverflow-center-scale-outer, 1) - 1) * 280px) + var(--de-coverflow-extra-room, 0px));
}

/* Carousel slides must never stay hidden. Elementor marks entrance-animated
   elements .elementor-invisible (visibility:hidden) and only un-hides the
   originals when they scroll into view; slides a carousel moves or clones
   (the infinite-loop wrap) never get un-hidden, so the whole carousel
   seemed to vanish at the wrap point. */
.dynamic-engine-elementor-loop--carousel .elementor-invisible,
.dynamic-engine-elementor-loop__carousel .elementor-invisible,
.dynamic-engine-elementor-loop .swiper-slide .elementor-invisible {
	visibility: visible !important;
}

/* Pagination: icons, label, shapes (all overridable from the widget's Style tab). */
.dynamic-engine-elementor-loop__pagination-icon {
	display: inline-flex;
	align-items: center;
	line-height: 1;
}

.dynamic-engine-elementor-loop__pagination-icon svg {
	width: 1em;
	height: 1em;
	fill: currentColor;
}

.dynamic-engine-elementor-loop__pagination-info {
	padding: 0 8px;
}

.dynamic-engine-elementor-loop__pagination--shape-circle .dynamic-engine-elementor-loop__pagination-num {
	border-radius: 50%;
	aspect-ratio: 1 / 1;
	padding: 0;
	min-width: 2.5em;
}

.dynamic-engine-elementor-loop__pagination--shape-square .dynamic-engine-elementor-loop__pagination-num {
	border-radius: 0;
}

.dynamic-engine-elementor-loop__pagination--shape-pill .dynamic-engine-elementor-loop__pagination-num {
	border-radius: 999px;
}

.dynamic-engine-elementor-loop__pagination--shape-plain .dynamic-engine-elementor-loop__pagination-num {
	border-color: transparent;
}

.dynamic-engine-elementor-loop__pagination-nav {
	white-space: nowrap;
}

/* Themes (Hello Elementor's reset.css among them) style every
   [type=button] — pink text/border, 0.5rem 1rem padding — and re-colour it
   on :hover. That padding squeezed the arrow icon to ~1px wide (an "empty
   circle" on the front end only, where the theme CSS loads). The element
   prefix on the rules above out-ranks the theme's attribute selector; these
   rules do the same for the theme's hover/focus states. The Style tab's
   hover colours are more specific still and override them. */
button.dynamic-engine-elementor-loop__carousel-arrow:hover,
button.dynamic-engine-elementor-loop__carousel-arrow:focus {
	background: #fff;
	color: #1f2937;
	border-color: rgba(0, 0, 0, 0.15);
	text-decoration: none;
}
