/* Books Carousel Block Styles with Splide.js */

/* Override WordPress constrained layout for carousel */
.wp-block-group.is-layout-constrained .books-carousel-wrapper,
.is-layout-constrained .books-carousel-wrapper {
	max-width: var(--wp--style--global--wide-size, 1340px) !important;
	width: 100% !important;
}

/* Support for WordPress wide alignment */
.alignwide .books-carousel-wrapper,
.wp-block-group.alignwide .books-carousel-wrapper {
	max-width: var(--wp--style--global--wide-size, 1340px);
	width: 100%;
}

.books-carousel-wrapper {
	position: relative;
	max-width: var(--wp--style--global--wide-size, 1340px);
	margin: 2rem auto;
	padding: 0 1rem;
	width: 100%;
}

/* Override Splide default styles */
.books-carousel-wrapper section.splide {
	padding: 2rem 0;
}


.books-carousel-wrapper .splide__list {
	align-items: stretch;
}

.books-carousel-wrapper .splide__slide {
	display: flex;
	align-items: stretch;
}

/* Individual Book Item */
.book-carousel-item {
	display: flex;
	background: white;
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
	transition: transform 0.3s ease, box-shadow 0.3s ease;
	min-height: 280px;
	max-height: 280px;
	align-items: stretch;
	width: 100%;
	min-width: 600px; /* Minimum width to accommodate cover + content */
}

.book-carousel-item:hover {
	transform: translateY(-8px);
	box-shadow: 0 12px 35px rgba(0, 0, 0, 0.15);
}

/* Custom Splide Arrows */
.books-carousel-arrow {
	background: white !important;
	border: 2px solid #e1e1e1 !important;
	border-radius: 50% !important;
	width: 60px !important;
	height: 60px !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	cursor: pointer !important;
	transition: all 0.3s ease !important;
	color: #333 !important;
	z-index: 10 !important;
	font-size: 1.2rem !important;
	opacity: 1 !important;
}

.books-carousel-arrow:hover {
	background: #c0ebf1 !important;
	border-color: #c0ebf1 !important;
	color: #111 !important;
	transform: scale(1.1) translateY(-50%) !important;
}

.books-carousel-arrow.is-disabled {
	opacity: 0.3 !important;
	cursor: not-allowed !important;
}

.books-carousel-arrow svg {
	width: 20px !important;
	height: 20px !important;
	fill: currentColor !important;
}

/* Custom Splide Pagination */
.books-carousel-pagination {
	display: flex !important;
	justify-content: center !important;
	align-items: center !important;
	margin-top: 2rem !important;
	gap: 0.5rem !important;
}

.books-carousel-page {
	width: 12px !important;
	height: 12px !important;
	border-radius: 50% !important;
	background: #ddd !important;
	border: none !important;
	cursor: pointer !important;
	transition: all 0.3s ease !important;
	opacity: 1 !important;
}

.books-carousel-page.is-active {
	background: #c0ebf1  !important;
	transform: scale(1.2) !important;
}

/* Book Cover - Left Side */
.book-carousel-cover {
	position: relative;
	width: 200px;
	min-width: 200px;
	background: #d1d1e1;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

.book-carousel-cover img {
	width: auto;
	height: 77%;
	object-fit: contain;
	transition: transform 0.3s ease;
	transform: skew(7deg, -10deg) translate(20%, 17%);
    box-shadow: 3px 11px 16px -7px rgba(0, 0, 0, 0.8);
}

.book-carousel-item:hover .book-carousel-cover img {
	transform: scale(1.05) translate(9%, 17%);
    box-shadow: 3px 11px 16px -7px rgba(0, 0, 0, 0.8);
}

.book-carousel-cover a {
	display: block;
	width: 100%;
	height: 100%;
}

/* Fallback for books without covers */
.book-carousel-cover:not(:has(img))::after {
	content: "📚";
	font-size: 3rem;
	color: #999;
}

/* Book Content - Right Side */
.book-carousel-content {
	padding: 2rem;
	flex: 1;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	min-width: 300px;
}

.book-carousel-title {
	margin: 0 0 1rem 0;
	font-size: 1.4rem;
	font-weight: 600;
	line-height: 1.3;
	color: #2c3e50;
}

.book-carousel-title a {
	color: inherit;
	text-decoration: none;
	transition: color 0.3s ease;
}

.book-carousel-title a:hover {
	color: #005a87;
}

.book-carousel-publisher,
.book-carousel-published-date {
	font-size: 1rem;
	color: #7f8c8d;
	margin-bottom: 1rem;
	font-weight: 500;
}

.book-carousel-description {
	font-size: 0.95rem;
	line-height: 1.6;
	color: #555;
	margin-bottom: 1.5rem;
	flex: 1;
}

.book-carousel-bottom {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-top: auto;
}

.book-carousel-price {
	font-size: 1.3rem;
	font-weight: bold;
	color: #e74c3c;
}

/* Buy Button */
.book-carousel-button {
	flex-shrink: 0;
}

.book-carousel-button .book-buy-button {
	display: inline-block;
	padding: 0.8rem 1.5rem;
	background: #c0ebf1;
	color: #111;
	text-decoration: none;
	border-radius: 8px;
	font-weight: 600;
	font-size: 0.95rem;
	text-align: center;
	transition: all 0.3s ease;
	border: none;
	cursor: pointer;
	white-space: nowrap;
}

.book-carousel-button .book-buy-button:hover {
	background: #005a87;
	color: white;
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}


.book-carousel-button .book-read-more-button {
	background: #eee;
	color: #111;
    margin-left: 12px;
}

.book-carousel-button .book-read-more-button:hover {
	background: #aaa;
}

/* Empty State */
.books-carousel-empty {
	text-align: center;
	padding: 4rem 1rem;
	color: #666;
	font-style: italic;
}

/* Loading State */
.books-carousel-loading {
	text-align: center;
	padding: 4rem 1rem;
	color: #666;
}

/* Responsive Design */
@media (max-width: 1024px) {
	.books-carousel-wrapper {
		padding: 0 0.5rem;
	}
	
	.books-carousel-arrow {
		width: 50px !important;
		height: 50px !important;
		font-size: 1rem !important;
	}

	.book-carousel-cover {
		width: 160px;
		min-width: 160px;
	}

	.book-carousel-content {
		padding: 1.5rem;
		min-width: 250px;
	}
}

@media (max-width: 768px) {
	.books-carousel-wrapper {
		margin: 1.5rem auto;
	}
	
	.book-carousel-item {
		flex-direction: column;
		min-height: 400px;
		min-width: unset; /* Remove minimum width constraint on mobile */
	}

	.book-carousel-cover {
		width: 100%;
		min-width: unset;
		height: 200px;
	}
	
	.book-carousel-content {
		padding: 1.5rem;
		min-width: unset;
	}
	
	.book-carousel-title {
		font-size: 1.2rem;
	}

	.book-carousel-bottom {
		flex-direction: column;
		align-items: stretch;
		gap: 1rem;
	}

	.book-carousel-button .book-buy-button {
		width: 100%;
	}
	
	.books-carousel-arrow {
		width: 45px !important;
		height: 45px !important;
	}

	.book-carousel-button .book-read-more-button {
		margin-left: 0;
		margin-top: 12px;
	}
	.book-carousel-content {
		text-align: center;
	}
}

@media (max-width: 480px) {
	.books-carousel-wrapper section.splide {
		padding: 1rem 0;
	}
	
	.book-carousel-item {
		min-height: 350px;
	}
	
	.book-carousel-cover {
		height: 160px;
	}
	
	.book-carousel-content {
		padding: 1rem;
	}
	
	.book-carousel-title {
		font-size: 1.1rem;
	}
	
	.books-carousel-arrow {
		width: 40px !important;
		height: 40px !important;
		font-size: 0.9rem !important;
	}
}

/* Block Editor Styles */
.books-carousel-preview {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.books-carousel-preview h3 {
	font-family: inherit;
}

.books-carousel-preview p {
	font-family: inherit;
}

/* Accessibility */
.books-carousel-arrow:focus {
	outline: 3px solid #c0ebf1 !important;
	outline-offset: 2px !important;
}

.books-carousel-page:focus {
	outline: 3px solid #c0ebf1 !important;
	outline-offset: 2px !important;
}

.book-carousel-title a:focus,
.book-carousel-button .book-buy-button:focus {
	outline: 3px solid #c0ebf1;
	outline-offset: 2px;
}

/* Animation for smooth transitions */
@media (prefers-reduced-motion: reduce) {
	.books-carousel-track,
	.book-carousel-item,
	.book-carousel-cover img,
	.carousel-nav,
	.book-buy-button {
		transition: none;
	}
}

/* High contrast mode support */
@media (prefers-contrast: high) {
	.book-carousel-item {
		border: 2px solid #000;
	}
	
	.carousel-nav {
		border: 2px solid #000;
	}
}
