/**
 * 2FOX4 Before After — Frontend Styles
 *
 * @package 2FOX4_Before_After
 */

/* Container */
.bfas-container {
	position: relative;
	overflow: hidden;
	cursor: col-resize;
	user-select: none;
	-webkit-user-select: none;
	line-height: 0;
	max-width: 100%;
	margin: 0 auto;
}

.bfas-container.bfas-vertical {
	cursor: row-resize;
}

/* Images */
.bfas-container img {
	display: block;
	max-width: 100%;
	height: auto;
	pointer-events: none;
}

.bfas-before {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	overflow: hidden;
	z-index: 2;
}

.bfas-before img {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.bfas-after {
	position: relative;
	width: 100%;
	z-index: 1;
}

.bfas-after img {
	display: block;
	width: 100%;
	height: auto;
}

/* Divider line */
.bfas-divider {
	position: absolute;
	z-index: 3;
	background: var(--bfas-divider-color, #ffffff);
}

.bfas-container:not(.bfas-vertical) .bfas-divider {
	top: 0;
	bottom: 0;
	width: 3px;
	transform: translateX(-50%);
}

.bfas-container.bfas-vertical .bfas-divider {
	left: 0;
	right: 0;
	height: 3px;
	transform: translateY(-50%);
}

/* Handle / drag button */
.bfas-handle {
	position: absolute;
	z-index: 4;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: var(--bfas-divider-color, #ffffff);
	border: 2px solid var(--bfas-divider-color, #ffffff);
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: inherit;
	transition: transform 0.15s ease;
}

.bfas-handle:hover {
	transform: scale(1.1);
}

.bfas-container:not(.bfas-vertical) .bfas-handle {
	top: 50%;
	transform: translate(-50%, -50%);
}

.bfas-container:not(.bfas-vertical) .bfas-handle:hover {
	transform: translate(-50%, -50%) scale(1.1);
}

.bfas-container.bfas-vertical .bfas-handle {
	left: 50%;
	transform: translate(-50%, -50%);
}

.bfas-container.bfas-vertical .bfas-handle:hover {
	transform: translate(-50%, -50%) scale(1.1);
}

/* Arrow icon inside handle */
.bfas-handle-arrows {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 2px;
	color: #333333;
	font-size: 14px;
	font-weight: bold;
	line-height: 1;
}

.bfas-handle-arrows svg {
	width: 20px;
	height: 20px;
	fill: #333333;
}

/* Labels */
.bfas-label {
	position: absolute;
	z-index: 5;
	padding: 6px 14px;
	font-size: 13px;
	font-weight: 600;
	color: #ffffff;
	background: rgba(0, 0, 0, 0.55);
	border-radius: 4px;
	pointer-events: none;
	letter-spacing: 0.03em;
	line-height: 1.4;
	opacity: 0;
	transition: opacity 0.3s ease;
}

.bfas-container:hover .bfas-label,
.bfas-container.bfas-active .bfas-label {
	opacity: 1;
}

.bfas-label-before {
	top: 12px;
	left: 12px;
}

.bfas-label-after {
	top: 12px;
	right: 12px;
}

.bfas-container.bfas-vertical .bfas-label-before {
	top: 12px;
	left: 12px;
}

.bfas-container.bfas-vertical .bfas-label-after {
	top: auto;
	bottom: 12px;
	right: auto;
	left: 12px;
}

/* Loading animation */
.bfas-container.bfas-loading {
	min-height: 200px;
	background: #f0f0f0;
}

.bfas-container.bfas-loading::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 40px;
	height: 40px;
	margin: -20px 0 0 -20px;
	border: 3px solid #cccccc;
	border-top-color: #333333;
	border-radius: 50%;
	z-index: 10;
	animation: bfas-spin 0.8s linear infinite;
}

@keyframes bfas-spin {
	to {
		transform: rotate(360deg);
	}
}

/* ===========================
   Reveal Mode
   Both images stay fixed; the
   before layer uses clip-path.
   =========================== */

.bfas-reveal .bfas-before {
	width: 100% !important;
	height: 100% !important;
	overflow: visible;
}

.bfas-reveal .bfas-before img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Entrance animation */
.bfas-container.bfas-animate-in .bfas-divider,
.bfas-container.bfas-animate-in .bfas-handle {
	transition: left 0.6s ease, top 0.6s ease;
}

.bfas-container.bfas-reveal.bfas-animate-in .bfas-before {
	transition: clip-path 0.6s ease;
}
