/* ==========================================================================
   Becomeyoo — Book Grid Widget (bew-bg)
   ========================================================================== */

.bew-bg-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr); /* fallback; Elementor control overrides */
	gap: 24px;
}

/* Card */
.bew-bg-card {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	padding: 0;
	margin-bottom: 24px;
}

/* Badge */
.bew-bg-badge {
	position: absolute;
	top: 8px;
	left: 8px;
	background: #1ba154;
	color: #fff;
	font-size: 11px;
	font-weight: 500;
	padding: 3px 10px;
	border-radius: 50px;
	letter-spacing: 0;
	z-index: 1;
	white-space: nowrap;
}

/* Link wrapper */
.bew-bg-link {
	text-decoration: none !important;
	color: inherit !important;
	display: flex;
	flex-direction: column;
	align-items: inherit;
	gap: 0;
	width: 100%;
}

.bew-bg-link:hover {
	text-decoration: none !important;
	color: inherit !important;
}

.bew-bg-link:hover .bew-bg-img {
	transform: translateY(-4px);
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
}

/* Cover */
.bew-bg-cover {
	width: 100%;
	margin-bottom: 8px;
	display: flex;
	align-items: flex-start;
	justify-content: center;
}

.bew-bg-img {
	width: 81%;
	height: auto;
	border-radius: 3px;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
	transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Placeholder (editor preview) */
.bew-bg-placeholder {
	width: 81%;
	padding-bottom: 120%;
	background: #e0e0e0;
	border-radius: 3px;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

/* Title */
.bew-bg-title {
	font-size: 16px;
	font-weight: 600;
	color: inherit;
	line-height: 1.35;
	margin: 0 0 4px;
}

/* Author */
.bew-bg-author {
	font-size: 14px;
	font-weight: 400;
	color: inherit;
	opacity: 0.7;
	line-height: 1.35;
	margin: 0;
}

/* Button */
.bew-bg-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 10px 25px;
	background-color: #EB801D;
	color: #fff !important;
	text-decoration: none !important;
	font-weight: 400;
	font-size: 14px;
	border-radius: 50px;
	transition: background-color 0.3s ease, transform 0.15s ease;
	margin-top: 11px;
}

.bew-bg-btn:hover {
	background-color: #d4711a;
	color: #fff !important;
	text-decoration: none !important;
	transform: translateY(-1px);
}

/* ==========================================================================
   Horizontal Appearance (.bew-bg--horizontal)
   ========================================================================== */

.bew-bg.bew-bg--horizontal .bew-bg-card {
	flex-direction: row !important;
	align-items: center !important;
	text-align: left !important;
	gap: 0;
	padding: 12px;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
	margin-bottom: 0;
}

.bew-bg--horizontal .bew-bg-cover {
	position: relative;
	width: 120px;
	flex-shrink: 0;
	margin-bottom: 0;
	justify-content: flex-start;
}

.bew-bg--horizontal .bew-bg-img {
	width: 100%;
	border-radius: 6px;
}

.bew-bg--horizontal .bew-bg-placeholder {
	width: 100%;
	padding-bottom: 140%;
}

.bew-bg--horizontal .bew-bg-link {
	flex-direction: row !important;
	align-items: center !important;
	gap: 16px;
	flex: 1;
	min-width: 0;
	width: auto;
}

.bew-bg--horizontal .bew-bg-info {
	flex: 1;
	min-width: 0;
}

.bew-bg--horizontal .bew-bg-title {
	font-size: 18px;
	margin-bottom: 4px;
}

.bew-bg--horizontal .bew-bg-author {
	font-size: 14px;
}

/* Badge on cover for horizontal */
.bew-bg--horizontal .bew-bg-badge {
	position: absolute;
	top: 4px;
	left: 4px;
	transform: none;
	font-size: 9px;
	padding: 2px 7px;
}

/* Circular arrow button */
.bew-bg-arrow {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: #EB801D;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	margin-left: 12px;
	text-decoration: none !important;
	transition: background-color 0.3s ease, transform 0.15s ease;
}

.bew-bg-arrow:hover {
	background-color: #d4711a;
	transform: translateY(-1px);
}

.bew-bg-arrow svg,
.bew-bg-arrow svg path {
	stroke: #fff;
	fill: none;
}

/* Disable vertical lift on hover for horizontal cards */
.bew-bg--horizontal .bew-bg-link:hover .bew-bg-img {
	transform: none;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* ==========================================================================
   Carousel Appearance (.bew-bg--carousel)
   ========================================================================== */

.bew-bg--carousel {
	position: relative;
}

.bew-bg--carousel .bew-bg-swiper {
	overflow: hidden;
}

.bew-bg--carousel .swiper-slide {
	height: auto;
}

.bew-bg--carousel .bew-bg-card {
	margin-bottom: 0;
	height: 100%;
}

/* Navigation arrows */
.bew-bg-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 10;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: #fff;
	border: none;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: opacity 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
	padding: 0;
	line-height: 1;
}

.bew-bg-nav:hover {
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
	transform: translateY(-50%) scale(1.05);
}

.bew-bg-nav.swiper-button-disabled {
	opacity: 0.35;
	cursor: default;
	pointer-events: none;
}

.bew-bg-nav svg {
	stroke: #333;
	fill: none;
}

.bew-bg-nav--prev {
	left: -20px;
}

.bew-bg-nav--next {
	right: -20px;
}

/* Pagination dots */
.bew-bg-dots.swiper-pagination {
	position: relative;
	margin-top: 20px;
	bottom: auto;
}

.bew-bg-dots .swiper-pagination-bullet {
	width: 8px;
	height: 8px;
	background: #ccc;
	opacity: 1;
	transition: background-color 0.3s ease, transform 0.3s ease;
}

.bew-bg-dots .swiper-pagination-bullet-active {
	background: #EB801D;
	transform: scale(1.3);
}

/* Editor preview for carousel */
.bew-bg-carousel-preview {
	overflow: hidden;
}

.bew-bg-carousel-track {
	display: flex;
	gap: 24px;
}

.bew-bg-carousel-slide {
	flex: 0 0 calc(25% - 18px);
	min-width: 0;
}

.bew-bg-dots-preview {
	display: flex;
	justify-content: center;
	gap: 8px;
	margin-top: 20px;
}

.bew-bg-dot-preview {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #ccc;
}

.bew-bg-dot-preview.active {
	background: #EB801D;
	transform: scale(1.3);
}

/* Carousel + Horizontal combo */
.bew-bg--carousel.bew-bg--horizontal .bew-bg-card {
	margin-bottom: 0;
	height: 100%;
}

.bew-bg--carousel.bew-bg--horizontal .bew-bg-carousel-slide {
	flex: 0 0 calc(50% - 12px);
}

/* Carousel nav arrows: shift down when dots are present in horizontal mode */
.bew-bg--carousel.bew-bg--horizontal .bew-bg-nav {
	top: calc(50% - 10px);
}

/* ==========================================================================
   Skeleton / Shimmer Loading (pre-Swiper init)
   ========================================================================== */

/* Before Swiper initializes, lay slides out side-by-side */
.bew-bg-swiper:not(.swiper-initialized) .swiper-wrapper {
	display: flex;
	gap: 24px;
	overflow: hidden;
}

.bew-bg-swiper:not(.swiper-initialized) .swiper-slide {
	flex: 0 0 calc(25% - 18px);
	min-width: 0;
}

/* Horizontal carousel: wider slides pre-init */
.bew-bg--horizontal .bew-bg-swiper:not(.swiper-initialized) .swiper-slide {
	flex: 0 0 calc(50% - 12px);
}

/* Shimmer overlay on cards before init */
.bew-bg-swiper:not(.swiper-initialized) .bew-bg-card {
	position: relative;
	overflow: hidden;
}

.bew-bg-swiper:not(.swiper-initialized) .bew-bg-card::after {
	content: '';
	position: absolute;
	inset: 0;
	z-index: 2;
	background: linear-gradient(
		90deg,
		rgba(230, 230, 230, 0) 0%,
		rgba(230, 230, 230, 0.5) 50%,
		rgba(230, 230, 230, 0) 100%
	);
	background-size: 200% 100%;
	animation: bew-bg-shimmer 1.5s ease-in-out infinite;
	border-radius: inherit;
	pointer-events: none;
}

@keyframes bew-bg-shimmer {
	0%   { background-position: 200% 0; }
	100% { background-position: -200% 0; }
}

/* NOTE: Do NOT add transition on .swiper-wrapper — Swiper controls it
   for slide transforms. The shimmer overlay auto-hides via
   :not(.swiper-initialized) selectors above. */

/* Tablet pre-init */
@media (max-width: 1024px) {
	.bew-bg-swiper:not(.swiper-initialized) .swiper-slide {
		flex: 0 0 calc(33.333% - 16px);
	}

	.bew-bg--horizontal .bew-bg-swiper:not(.swiper-initialized) .swiper-slide {
		flex: 0 0 calc(50% - 12px);
	}
}

/* Mobile pre-init */
@media (max-width: 767px) {
	.bew-bg-swiper:not(.swiper-initialized) .swiper-wrapper {
		gap: 16px;
	}

	.bew-bg-swiper:not(.swiper-initialized) .swiper-slide {
		flex: 0 0 calc(50% - 8px);
	}

	.bew-bg--horizontal .bew-bg-swiper:not(.swiper-initialized) .swiper-slide {
		flex: 0 0 100%;
	}
}

/* Hide nav/dots until Swiper is ready */
.bew-bg--carousel .bew-bg-nav,
.bew-bg--carousel .bew-bg-dots {
	opacity: 0;
	transition: opacity 0.3s ease;
}

/* Nav buttons are siblings of .bew-bg-swiper */
.bew-bg--carousel .bew-bg-swiper.swiper-initialized ~ .bew-bg-nav {
	opacity: 1;
}

/* Dots are inside .bew-bg-swiper */
.bew-bg-swiper.swiper-initialized .bew-bg-dots {
	opacity: 1;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1024px) {
	.bew-bg-grid {
		grid-template-columns: repeat(3, 1fr);
	}

	.bew-bg-nav--prev {
		left: -12px;
	}

	.bew-bg-nav--next {
		right: -12px;
	}

	.bew-bg-carousel-slide {
		flex: 0 0 calc(33.333% - 16px);
	}

	.bew-bg--carousel.bew-bg--horizontal .bew-bg-carousel-slide {
		flex: 0 0 calc(50% - 12px);
	}
}

@media (max-width: 767px) {
	.bew-bg-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 16px;
	}

	.bew-bg-title {
		font-size: 14px;
	}

	.bew-bg-author {
		font-size: 12px;
	}

	.bew-bg-btn {
		padding: 8px 18px;
		font-size: 13px;
	}

	.bew-bg-badge {
		font-size: 10px;
		padding: 3px 8px;
		top: -13px;
		left: 50%;
		transform: translateX(-50%);
	}

	.bew-bg--horizontal .bew-bg-badge {
		left: 100%;
		right: auto;
		top: 0;
		transform: none;
	}

	.bew-bg--horizontal .bew-bg-info {
		padding-top: 22px;
	}

	/* Horizontal responsive */
	.bew-bg--horizontal .bew-bg-card {
		padding: 10px;
	}

	.bew-bg--horizontal .bew-bg-cover {
		width: 80px;
	}

	.bew-bg--horizontal .bew-bg-link {
		gap: 0;
	}

	.bew-bg--horizontal .bew-bg-title {
		font-size: 14px;
	}

	.bew-bg--horizontal .bew-bg-author {
		font-size: 12px;
	}

	.bew-bg-arrow {
		width: 32px;
		height: 32px;
	}

	.bew-bg-arrow svg {
		width: 14px;
		height: 14px;
	}

	/* Carousel responsive: arrows top-right inside card, tiny */
	.bew-bg-nav {
		width: 22px !important;
		height: 22px !important;
		top: 10px;
		transform: none;
		box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
	}

	.bew-bg-nav:hover {
		transform: scale(1.05);
	}

	.bew-bg-nav svg {
		width: 10px;
		height: 10px;
	}

	.bew-bg-nav--prev {
		left: auto;
		right: 36px;
	}

	.bew-bg-nav--next {
		right: 10px;
	}

	.bew-bg--carousel.bew-bg--horizontal .bew-bg-nav {
		top: 10px;
	}


	.bew-bg-dots.swiper-pagination {
		margin-top: 14px;
	}

	.bew-bg-carousel-slide {
		flex: 0 0 calc(50% - 8px);
	}

	/* Carousel horizontal: full width on mobile */
	.bew-bg--carousel.bew-bg--horizontal .bew-bg-carousel-slide {
		flex: 0 0 100%;
	}

	.bew-bg-mobile-hide {
		display: none !important;
	}
}

@media (min-width: 768px) {
	.bew-bg-desktop-hide {
		display: none !important;
	}
}
