/* Book Gridder Styles - Based on jQuery Gridder */

/* Base Gridder Styles */
.gridder {
	margin: 0;
	padding: 0;
	list-style-type: none;
	font-size: 0;
}

.gridder-list,
.gridder-show {
	font-size: 16px;
}

.gridder-list {
	display: inline-block;
	vertical-align: top;
	width: calc(100% / 4 - 1%);
	margin-bottom: 1%;
	margin-right: 1%;
	cursor: pointer;
	transition: transform 0.3s ease, box-shadow 0.3s ease;
	height: 0;
	padding-bottom: calc(143% / 4);
	position: relative;
}

.gridder-list:hover {
	transform: translateY(-5px);
	box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.gridder-show {
	display: block;
	float: left;
	width: 100%;
	position: relative;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 4px 20px rgba(0,0,0,0.1);
	margin-bottom: 2rem;
	overflow: visible; /* Changed from hidden to allow sticky positioning */
}
.gridder-content {
	display: none;
}

/* Book Image Styling */
.book-image-wrapper {
	position: absolute;
	overflow: hidden;
	border-radius: 8px;
	background: #f8f9fa;
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
	width: 100%;
}

.book-image-wrapper img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.3s ease;
}

.gridder-list:hover .book-image-wrapper img {
	transform: scale(1.05);
}

/* Placeholder for books without images */
.book-image-wrapper.no-image {
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	color: white;
	text-align: center;
	padding: 2rem;
}

.book-placeholder {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	height: 100%;
}

.book-icon {
	font-size: 3rem;
	margin-bottom: 1rem;
	opacity: 0.8;
}

.book-title {
	font-size: 1.1rem;
	font-weight: 600;
	line-height: 1.3;
	text-align: center;
	word-break: break-word;
}

/* Gridder Panel Content */
.gridder-padding {
	padding: 2rem;
	overflow: visible; /* Ensure sticky positioning works */
}

.gridder-navigation {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 2rem;
	padding-bottom: 1rem;
	border-bottom: 2px solid #e9ecef;
}

.gridder-close,
.gridder-nav {
	background: #c0ebf1;
	color: #111;
	text-decoration: none;
	padding: 0.8rem 1.5rem;
	border-radius: 6px;
	font-weight: 600;
	font-size: 0.9rem;
	transition: all 0.3s ease;
	cursor: pointer;
	border: none;
	display: inline-block;
}

.gridder-nav.prev {
	margin-left: auto;
	margin-right: 1em;
}

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

.gridder-nav.disabled {
	background: #6c757d;
	opacity: 0.6;
	cursor: not-allowed;
	transform: none;
	box-shadow: none;
}

.gridder-nav.disabled:hover {
	background: #6c757d;
	transform: none;
	box-shadow: none;
}

.gridder-close {
	background: #d1d1e1;
    color: #111;
}

.gridder-close:hover {
	background: #7373de;
    color: #fff;
	box-shadow: 0 4px 12px rgb(115, 115, 222, .5);
}

/* Book Detail Content */
.book-detail-content {
	display: flex;
	gap: 2rem;
	align-items: flex-start; /* Required for sticky positioning */
}

.book-detail-left {
	flex: 0 0 300px;
	display: flex;
	justify-content: center;
	position: sticky;
	top: 40px; /* Start with 0 to test if sticky works at all */
	align-self: flex-start; /* Ensures proper sticky behavior */
	height: fit-content; /* Important for sticky behavior */
}

.book-detail-cover {
	width: 100%;
	max-width: 300px;
}

.book-detail-cover img {
	width: 100%;
	height: auto;
	border-radius: 8px;
	box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.book-detail-right {
	flex: 1;
	min-width: 0;
}

.book-detail-title {
	margin: 0 0 1.5rem 0;
	font-size: 2rem;
	font-weight: 700;
	color: #2c3e50;
	line-height: 1.2;
}

.book-detail-meta {
	background: #f8f9fa;
	padding: 1.5rem;
	border-radius: 8px;
	border-left: 4px solid #c0ebf1;
	margin-bottom: 2rem;
}

.meta-item {
	margin-bottom: 0.8rem;
	font-size: 1rem;
	color: #555;
}

.meta-item:last-child {
	margin-bottom: 0;
}

.meta-item strong {
	color: #2c3e50;
	margin-right: 0.5rem;
}

.book-detail-description {
	font-size: 1.1rem;
	line-height: 1.7;
	color: #444;
	margin-bottom: 2rem;
}

.book-detail-description p {
	margin-bottom: 1rem;
}

.book-detail-footer {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding-top: 2rem;
	border-top: 2px solid #e9ecef;
	gap: 2rem;
}

.book-detail-price {
	font-size: 1.5rem;
	font-weight: 700;
	color: #e74c3c;
}

.book-detail-actions {
	display: flex;
	gap: 1rem;
}

.book-buy-button,
.book-view-button {
	padding: 0.8rem 1.5rem;
	border-radius: 8px;
	text-decoration: none;
	font-weight: 600;
	font-size: 1rem;
	transition: all 0.3s ease;
	display: inline-block;
	text-align: center;
}

.book-buy-button {
	background: #c0ebf1;
	color: #111;
}

.book-buy-button.secondary {
	background: #28a745;
	margin-left: 8px;
}

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

.book-buy-button.secondary:hover {
	background: #218838;
	box-shadow: 0 4px 12px rgba(40,167,69,0.3);
}

.book-view-button {
	background: #6c757d;
	color: white;
}

.book-view-button:hover {
	background: #495057;
	color: white;
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(108,117,125,0.3);
}

/* Archive Header */
.page-header {
	text-align: center;
	margin-bottom: 3rem;
	padding: 2rem 0;
}

.page-title {
	margin: 0;
	font-size: 2.5rem;
	font-weight: 700;
	color: #2c3e50;
}

.archive-description {
	margin-top: 1rem;
	font-size: 1.1rem;
	color: #6c757d;
}

/* Wrapper */
.wrapper {
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 1rem;
}

.top-spacing {
	margin-top: 2rem;
}

/* Breadcrumbs */
#breadcrumbs {
	margin-bottom: 2rem;
	padding: 1rem;
	background: #f8f9fa;
	border-radius: 6px;
	font-size: 0.9rem;
}

#breadcrumbs a {
	color: #0073aa;
	text-decoration: none;
}

#breadcrumbs a:hover {
	text-decoration: underline;
}

/* Instructions */
.wrapper h3 {
	text-align: center;
	color: #6c757d;
	font-size: 1.2rem;
	margin-bottom: 2rem;
	font-weight: 500;
}

/* Loading State */
.gridder-show.loading {
	background: #f8f9fa;
	min-height: 200px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.gridder-show.loading::before {
	content: "Loading...";
	font-size: 1.1rem;
	color: #6c757d;
	animation: pulse 1.5s infinite;
}

@keyframes pulse {
	0% { opacity: 0.6; }
	50% { opacity: 1; }
	100% { opacity: 0.6; }
}

/* No Books Found */
.no-books-found {
	text-align: center;
	padding: 4rem 2rem;
	background: #f8f9fa;
	border-radius: 12px;
	margin: 2rem 0;
}

.no-books-found h2 {
	color: #6c757d;
	margin-bottom: 1rem;
}

.no-books-found p {
	color: #868e96;
	font-size: 1.1rem;
}

/* Pagination */
.navigation.pagination {
	margin: 3rem 0;
	text-align: center;
}

.page-numbers {
	display: inline-block;
	padding: 0.8rem 1.2rem;
	margin: 0 0.3rem;
	background: white;
	border: 2px solid #c0ebf1;
	color: #0073aa;
	text-decoration: none;
	border-radius: 6px;
	font-weight: 600;
	transition: all 0.3s ease;
}

.page-numbers:hover,
.page-numbers.current {
	background: #c0ebf1;
	color: #111;
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0,115,170,0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
	
	.book-detail-content {
		flex-direction: column;
	}
	
	.book-detail-left {
		flex: none;
		align-self: center;
		position: static; /* Disable sticky on mobile */
	}
	
	.book-detail-footer {
		flex-direction: column;
		align-items: stretch;
		gap: 1rem;
	}
	
	.book-detail-actions {
		flex-direction: column;
	}
	
	.gridder-padding {
		padding: 1.5rem;
	}
	
	.page-title {
		font-size: 2rem;
	}
	
	.book-detail-title {
		font-size: 1.5rem;
	}
}

@media (max-width: 480px) {
	.gridder-list {
		padding-bottom: calc(143% / 2);
	}
	.gridder-list {
		width: 47%;
		margin-right: 3%;
		margin-bottom: 8px;
	}
	.wrapper {
		padding: 0 0.5rem;
	}
	
	.gridder-padding {
		padding: 1rem;
	}
	
	.book-image-wrapper {
		height: 250px;
	}
	
	.book-detail-cover {
		max-width: 250px;
	}
	
	.page-title {
		font-size: 1.8rem;
	}
	
	.book-detail-title {
		font-size: 1.3rem;
	}
}

/* Accessibility */
.gridder-list:focus {
	outline: 3px solid #c0ebf1;
	outline-offset: 4px;
}

.gridder-close:focus,
.gridder-nav:focus,
.book-buy-button:focus,
.book-view-button:focus {
	outline: 3px solid #c0ebf1;
	outline-offset: 2px;
}

/* Animation preferences */
@media (prefers-reduced-motion: reduce) {
	.gridder-list,
	.book-image-wrapper img,
	.gridder-close,
	.gridder-nav,
	.book-buy-button,
	.book-view-button {
		transition: none;
	}
	
	.gridder-show.loading::before {
		animation: none;
	}
}

/* High contrast support */
@media (prefers-contrast: high) {
	.gridder-list {
		border: 2px solid #000;
	}
	
	.gridder-show {
		border: 2px solid #000;
	}
}

/* Single Book Page Comments */
.book-comments-section {
	margin-top: 3rem;
	padding-top: 2rem;
	border-top: 2px solid #e9ecef;
}

.book-comments-section .comments-area {
	max-width: none;
}

.book-comments-section .comment-form {
	background: #f8f9fa;
	padding: 2rem;
	border-radius: 8px;
	margin-bottom: 2rem;
}

.book-comments-section .comment-list {
	list-style: none;
	padding: 0;
}

.book-comments-section .comment-body {
	background: white;
	padding: 1.5rem;
	border-radius: 8px;
	margin-bottom: 1rem;
	box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}


.single .gridder-show {
    float: none;
    max-width: 1240px;
}
.single .post-navigation-link-previous {
	margin-left: auto;
	margin-right: 16px;
}