/**
 * Frontend CSS for Book Catalog Pro
 * Uses BEM methodology and namespace prefixing to prevent conflicts
 * 
 * @package BookCatalogPro
 * @subpackage BookCatalogPro/public/css
 */

/* Scoped reset for bcp elements only */
.bcp-wrapper,
.bcp-container,
.bcp-card,
.bcp-single-book {
  box-sizing: border-box;
}

.bcp-wrapper *,
.bcp-container *,
.bcp-card *,
.bcp-single-book * {
  box-sizing: inherit;
}

/* Book Card Styles - BEM Methodology */
.bcp-card {
  position: relative;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.bcp-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.bcp-card__image {
  position: relative;
  width: 100%;
  aspect-ratio: 3/4;
  overflow: hidden;
}

.bcp-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.bcp-card:hover .bcp-card__image img {
  transform: scale(1.05);
}

.bcp-card__badge--discount {
  position: absolute;
  top: 10px;
  right: -15%;
  background: #e74c3c;
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: bold;
  transform: rotate(45deg);
  z-index: 2;
}

.bcp-card__content {
  padding: 16px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.bcp-card__author {
  font-size: 0.875rem;
  color: #666;
  margin-bottom: 8px;
  display: block;
}

.bcp-card__authors {
  font-size: 0.875rem;
  color: #666;
  margin-bottom: 8px;
  display: block;
  min-height: 1.5em;
  max-height: 3em; /* Limit to 2 lines */
  overflow: hidden;
  line-height: 1.2;
}

.bcp-card__authors::after {
  content: "...";
  position: absolute;
  bottom: 0;
  right: 0;
  padding-left: 40px;
  background: linear-gradient(to right, transparent, white 50%);
}

.bcp-card__editor {
  font-size: 0.8rem;
  color: #777;
  margin-bottom: 5px;
  display: block;
  min-height: 1.2em;
}

.bcp-card__editors {
  font-size: 0.8rem;
  color: #777;
  margin-bottom: 8px;
  display: block;
  min-height: 1.2em;
}

.bcp-card__title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 12px 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.bcp-card__title a {
  text-decoration: none;
  color: inherit;
}

.bcp-card__title a:hover {
  color: #e74c3c;
}

.bcp-card__price {
  margin-top: auto;
}

.bcp-card__price--final {
  font-size: 1.125rem;
  font-weight: bold;
  color: #e74c3c;
  margin: 0;
}

.bcp-card__price--original {
  text-decoration: line-through;
  color: #999;
  font-size: 0.875rem;
  margin: 0 0 0 8px;
  opacity: 0.6;
}

/* Catalog Grid Styles */
.bcp-catalog-grid {
  display: grid;
  gap: 24px;
  margin: 24px 0;
}

/* Responsive grid columns */
.bcp-catalog-grid--cols-1 {
  grid-template-columns: repeat(1, 1fr);
}

.bcp-catalog-grid--cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.bcp-catalog-grid--cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.bcp-catalog-grid--cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

.bcp-catalog-grid--cols-5 {
  grid-template-columns: repeat(5, 1fr);
}

.bcp-catalog-grid--cols-6 {
  grid-template-columns: repeat(6, 1fr);
}

/* Responsive breakpoints */
@media (max-width: 640px) {
  .bcp-catalog-grid--cols-6,
  .bcp-catalog-grid--cols-5,
  .bcp-catalog-grid--cols-4,
  .bcp-catalog-grid--cols-3,
  .bcp-catalog-grid--cols-2 {
    grid-template-columns: repeat(1, 1fr);
  }
}

@media (min-width: 641px) and (max-width: 768px) {
  .bcp-catalog-grid--cols-6,
  .bcp-catalog-grid--cols-5,
  .bcp-catalog-grid--cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .bcp-catalog-grid--cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .bcp-catalog-grid--cols-6,
  .bcp-catalog-grid--cols-5 {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .bcp-catalog-grid--cols-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Single Book Page Styles */
.bcp-single-book {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.bcp-single-book__container {
  display: flex;
  gap: 40px;
  align-items: flex-start;
}

.bcp-single-book__gallery {
  flex: 0 0 40%;
  min-width: 0;
}

.bcp-single-book__details {
  flex: 0 0 60%;
}

.bcp-single-book__image-main {
  width: 100%;
  aspect-ratio: 3/4;
  overflow: hidden;
  border-radius: 8px;
  margin-bottom: 16px;
}

.bcp-single-book__image-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bcp-single-book__authors {
  margin: 0 0 16px 0;
  font-size: 1.125rem;
  color: #666;
  line-height: 1.4;
}

.bcp-single-book__author {
  font-weight: 600;
}

.bcp-single-book__editors {
  margin: 0 0 16px 0;
  font-size: 1rem;
  color: #666;
}

.bcp-single-book__editor {
  font-weight: 600;
}

.bcp-single-book__title {
  font-size: 2rem;
  font-weight: bold;
  margin: 0 0 16px 0;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.bcp-single-book__author {
  font-size: 1.125rem;
  color: #666;
  margin: 0 0 24px 0;
}

.bcp-single-book__price-section {
  display: flex;
  align-items: center;
  margin: 0 0 24px 0;
  flex-wrap: wrap;
  gap: 12px;
}

.bcp-single-book__price--final {
  font-size: 2rem;
  font-weight: bold;
  color: #e74c3c;
  margin: 0;
}

.bcp-single-book__price--original {
  font-size: 1.25rem;
  text-decoration: line-through;
  color: #999;
  opacity: 0.6;
  margin: 0;
}

.bcp-single-book__discount-badge {
  background: #e74c3c;
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: bold;
}

.bcp-single-book__description {
  margin: 0 0 24px 0;
}

.bcp-single-book__description--collapsed {
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
  position: relative;
}

.bcp-single-book__description--collapsed:after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 5em;
  background: linear-gradient(transparent, white);
  pointer-events: none;
}

.bcp-single-book__read-more-btn {
  background: none;
  border: none;
  color: #3498db;
  cursor: pointer;
  font-size: 1rem;
  text-decoration: underline;
  margin-top: 8px;
  padding: 0;
}

.bcp-single-book__specs {
  margin: 32px 0;
  border: 1px solid #eee;
  border-radius: 8px;
  overflow: hidden;
}

.bcp-single-book__specs-header {
  background: #f8f9fa;
  padding: 16px;
  font-weight: bold;
  border-bottom: 1px solid #eee;
}

.bcp-specs-table {
  width: 100%;
  border-collapse: collapse;
}

.bcp-specs-table tr:nth-child(even) {
  background: #f8f9fa;
}

.bcp-specs-table td,
.bcp-specs-table th {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.bcp-specs-table th {
  width: 30%;
  font-weight: 600;
  color: #555;
}

/* Swiper customizations */
.bcp-swiper-container {
  width: 100%;
  height: 100%;
}

.bcp-swiper-slide {
  text-align: center;
  font-size: 18px;
  background: #fff;
  
  /* Center slide content vertically */
  display: flex;
  justify-content: center;
  align-items: center;
}

.bcp-swiper-slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Utility classes */
.bcp-hidden {
  display: none !important;
}

.bcp-show {
  display: block !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .bcp-single-book__container {
    flex-direction: column;
  }
  
  .bcp-single-book__gallery,
  .bcp-single-book__details {
    flex: 1;
  }
  
  .bcp-single-book__title {
    font-size: 1.5rem;
  }
  
  .bcp-single-book__price--final {
    font-size: 1.5rem;
  }
}

/* Pagination Styles */
.bcp-pagination {
	margin: 32px 0;
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 8px;
}

.bcp-pagination .page-numbers {
	display: inline-block;
	padding: 8px 16px;
	border: 1px solid #ddd;
	border-radius: 4px;
	color: #333;
	text-decoration: none;
	transition: background-color 0.2s, color 0.2s;
}

.bcp-pagination .page-numbers:hover {
	background-color: #f0f0f0;
	color: #000;
}

.bcp-pagination .page-numbers.current {
	background-color: #e74c3c;
	color: #fff;
	border-color: #e74c3c;
	font-weight: bold;
}

.bcp-pagination .page-numbers.dots {
	border: none;
	padding: 8px 0;
}

.bcp-pagination .prev,
.bcp-pagination .next {
	font-weight: 600;
}