/**
 * CDLR Elementor Marquee Widget - Stylesheet
 * Handles hardware-accelerated movement, edge fades, responsive gaps, and premium editor indicators.
 */

/* Main container defaults */
.elementor-marquee-container {
	position: relative;
	width: 100%;
}

/* When the marquee track is running (active) or on the frontend */
.elementor-marquee-container.elementor-marquee-preview-active,
.elementor-marquee-container:not(.elementor-editor-active) {
	overflow: hidden !important;
	display: flex;
	align-items: center;
}

/* Background-agnostic edge fade masking */
.elementor-marquee-container[data-marquee-edge-fade="yes"] {
	mask-image: linear-gradient(
		to right,
		transparent 0%,
		black var(--marquee-fade-width, 10%),
		black calc(100% - var(--marquee-fade-width, 10%)),
		transparent 100%
	);
	-webkit-mask-image: linear-gradient(
		to right,
		transparent 0%,
		black var(--marquee-fade-width, 10%),
		black calc(100% - var(--marquee-fade-width, 10%)),
		transparent 100%
	);
}

/* Marquee track containing all clones */
.elementor-marquee-container .marquee-track {
	display: flex !important;
	flex-direction: row !important;
	width: max-content;
	align-items: inherit;
	justify-content: inherit;
	will-change: transform;
	animation-name: var(--marquee-animation-name, marquee-left);
	animation-duration: var(--marquee-duration, 15s);
	animation-timing-function: linear;
	animation-iteration-count: infinite;
}

/* Individual content wrapper blocks */
.elementor-marquee-container .marquee-content {
	display: flex !important;
	flex-direction: row !important;
	flex-shrink: 0;
	align-items: inherit;
	justify-content: inherit;
	gap: var(--marquee-gap, 30px) !important;
	padding-right: var(--marquee-gap, 30px) !important;
	box-sizing: border-box !important;
}

/* Prevent widgets from squishing */
.elementor-marquee-container .marquee-content > * {
	flex-shrink: 0 !important;
}

/* Force all text elements inside the marquee to stay in a single line (no wrapping) */
.elementor-marquee-container .marquee-content,
.elementor-marquee-container .marquee-content * {
	white-space: nowrap !important;
}

/* Pause on hover interaction */
.elementor-marquee-container[data-marquee-hover="pause"]:hover .marquee-track {
	animation-play-state: paused !important;
}

/* Keyframes for sliding left */
@keyframes marquee-left {
	0% {
		transform: translate3d(0, 0, 0);
	}
	100% {
		transform: translate3d(var(--marquee-translate, -50%), 0, 0);
	}
}

/* Keyframes for sliding right */
@keyframes marquee-right {
	0% {
		transform: translate3d(var(--marquee-translate, -50%), 0, 0);
	}
	100% {
		transform: translate3d(0, 0, 0);
	}
}

/* --- Elementor Editor Enhancements --- */

/* Normal edit mode visual helper (when animation is not running in editor) */
.elementor-editor-active .elementor-marquee-container:not(.elementor-marquee-preview-active) {
	border: 2px dashed rgba(99, 102, 241, 0.4) !important;
	background: rgba(99, 102, 241, 0.02) !important;
	border-radius: 8px;
	transition: border-color 0.3s ease, background-color 0.3s ease;
	min-height: 120px;
	padding: 20px !important;
}

.elementor-editor-active .elementor-marquee-container:not(.elementor-marquee-preview-active):hover {
	border-color: rgba(99, 102, 241, 0.8) !important;
	background: rgba(99, 102, 241, 0.04) !important;
}

/* Premium editor floating badge - placed inside container to prevent clipping */
.elementor-editor-active .elementor-marquee-container:not(.elementor-marquee-preview-active)::before {
	content: "Contenedor Marquee (Pausado en Editor)";
	position: absolute;
	top: 10px;
	right: 10px;
	background: #6366f1;
	color: #ffffff;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", sans-serif;
	font-size: 10px;
	font-weight: 600;
	padding: 3px 10px;
	border-radius: 20px;
	box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.2), 0 2px 4px -1px rgba(99, 102, 241, 0.1);
	z-index: 100;
	pointer-events: none;
}

/* When preview is active in editor, show a green dashed border */
.elementor-editor-active .elementor-marquee-container.elementor-marquee-preview-active {
	border: 1px dashed rgba(16, 185, 129, 0.5) !important;
	position: relative;
}

/* Ensure placeholder is properly sized for drag and drop */
.elementor-marquee-container .marquee-container-placeholder {
	width: 100%;
	min-height: 100px;
	display: block;
	box-sizing: border-box;
}

/* If placeholder is empty, ensure it has a helper height and text */
.elementor-marquee-container .marquee-container-placeholder:empty::after {
	content: "Arrastra elementos aquí dentro";
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100px;
	color: #999;
	font-size: 14px;
	border: 1px dashed #ccc;
	border-radius: 4px;
	background: #fafafa;
}
