/* Base & Variables */
.book-section-wrapper {
  --primary-color: #0f172a;
  --accent-color: #ff6b00;
  --bg-color: #fafbfc;
  --text-muted: #64748b;
  --font-family: 'Inter', sans-serif;
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--primary-color);
  padding: 80px 20px;
  overflow-x: hidden;
}

.book-container {
  max-width: 1280px;
  margin: 0 auto;
}

/* Header Section */
.book-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 50px;
  flex-wrap: wrap;
  gap: 30px;
}
.book-header-left {
  flex: 1;
  min-width: 300px;
}
.book-header-left h2 {
  font-size: 2.8rem;
  font-weight: 700;
  margin: 0 0 24px 0;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--primary-color);
}
.book-buttons {
  display: flex;
  gap: 16px;
}
.book-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 40px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.book-btn-primary {
  background-color: var(--primary-color);
  color: white;
  box-shadow: 0 4px 15px rgba(15, 23, 42, 0.1);
}
.book-btn-primary:hover {
  background-color: #1e293b;
  box-shadow: 0 8px 25px rgba(15, 23, 42, 0.25);
  transform: translateY(-2px);
  color: white;
}
.book-btn-outline {
  background-color: transparent;
  color: var(--primary-color);
  border: 1px solid #cbd5e1;
}
.book-btn-outline:hover {
  border-color: var(--primary-color);
  background-color: white;
  box-shadow: 0 8px 25px rgba(15, 23, 42, 0.08);
  transform: translateY(-2px);
}
.book-btn-icon {
  width: 16px;
  height: 16px;
  transition: transform 0.3s ease;
}
.book-btn:hover .book-btn-icon {
  transform: translateX(3px) translateY(-3px);
}
.book-header-right {
  flex: 0 1 450px;
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.7;
  font-weight: 400;
}

/* Masonry Grid Section */
.book-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 280px;
  grid-auto-flow: dense;
  gap: 24px;
  margin-bottom: 60px;
}
.book-card {
  border-radius: 24px;
  overflow: hidden;
  position: relative;
  background-color: #fff;
  box-shadow: 0 10px 30px rgba(0,0,0,0.03);
  transition: all 0.5s ease;
}
.book-card:hover {
  box-shadow: 0 20px 40px rgba(0,0,0,0.08);
}
.book-img-link {
  display: block;
  height: 100%;
  width: 100%;
  text-decoration: none;
  color: white;
  position: relative;
}
.book-img-link img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1), filter 0.8s ease;
  will-change: transform;
}

/* Elegant Scale & Overlay Effect */
.book-img-link:hover img {
  transform: scale(1.08);
  filter: brightness(1.05);
}
.book-img-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.3) 40%, rgba(0,0,0,0.05) 100%);
  pointer-events: none;
  transition: opacity 0.5s ease;
}
.book-img-link:hover .book-img-overlay { opacity: 0.9; }

.book-card-content {
  position: absolute;
  bottom: 24px;
  left: 24px;
  right: 24px;
  z-index: 2;
  transition: transform 0.4s ease;
}
.book-img-link:hover .book-card-content {
  transform: translateY(-5px);
}
.book-card-title {
  font-size: 1.3rem;
  font-weight: 600;
  margin: 0 0 10px 0;
  line-height: 1.35;
  color: white;
  text-shadow: 0 4px 12px rgba(0,0,0,0.4);
  letter-spacing: -0.01em;
}
.book-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  opacity: 0.9;
  color: white;
}

/* Glassmorphism Icon Top Right */
.book-icon-top {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-color);
  z-index: 2;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.book-img-link:hover .book-icon-top {
  transform: scale(1.15) rotate(-5deg);
  background: white;
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

/* Grid Positions */
.book-card-tall { grid-row: span 2; }
.book-card-tall .book-card-title { font-size: 1.7rem; }

/* Animated Promo Box */
.book-promo {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  padding: 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
}
.book-promo::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle at center, rgba(255, 107, 0, 0.03) 0%, transparent 60%);
  animation: rotateSlow 15s linear infinite;
  pointer-events: none;
}
@keyframes rotateSlow {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.book-promo-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0 0 24px 0;
  line-height: 1.4;
  color: var(--primary-color);
  position: relative;
  z-index: 1;
}
.book-promo-form {
  display: flex;
  background: white;
  border-radius: 40px;
  padding: 6px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.04);
  position: relative;
  z-index: 1;
  transition: box-shadow 0.3s ease;
}
.book-promo-form:focus-within {
  box-shadow: 0 8px 25px rgba(255, 107, 0, 0.15);
}
.book-promo-form input {
  border: none;
  background: transparent;
  padding: 12px 20px;
  flex: 1;
  min-width: 0;
  width: 100%;
  outline: none;
  font-size: 0.95rem;
  font-family: var(--font-family);
  color: var(--primary-color);
}
.book-promo-form button {
  background-color: var(--accent-color);
  color: white;
  border: none;
  border-radius: 30px;
  padding: 12px 24px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}
.book-promo-form button:hover {
  background-color: #e65c00;
  box-shadow: 0 4px 12px rgba(255, 107, 0, 0.3);
  transform: translateY(-1px);
}

/* INFINITE SLIDER WITH FADED EDGES */
.book-slider-wrapper {
  padding: 40px 0 60px 0;
  margin-top: 20px;
  overflow: hidden; 
  position: relative;
  width: 100%;
}
.book-slider-wrapper::before,
.book-slider-wrapper::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 100px;
  z-index: 2;
  pointer-events: none;
}
.book-slider-wrapper::before {
  left: 0;
  background: linear-gradient(to right, var(--bg-color) 0%, transparent 100%);
}
.book-slider-wrapper::after {
  right: 0;
  background: linear-gradient(to left, var(--bg-color) 0%, transparent 100%);
}

.book-slider-track {
  display: flex;
  gap: 24px;
  width: max-content;
  animation: scroll-infinite 35s linear infinite;
  padding: 0 12px;
}
.book-slider-track:hover {
  animation-play-state: paused;
}

@keyframes scroll-infinite {
  0% { transform: translateX(0); }
  100% { transform: translateX(calc(-50% - 12px)); }
}

.book-category {
  flex: 0 0 auto;
  width: 140px;
  background: white;
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 20px;
  padding: 28px 16px;
  text-align: center;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  cursor: pointer;
  text-decoration: none;
  position: relative;
}

.book-category::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 120%; height: 120%;
  background: radial-gradient(circle at center, rgba(255, 107, 0, 0.08) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.5s ease;
  z-index: 0;
  pointer-events: none;
}
.book-category:hover {
  transform: translateY(-12px);
  border-color: rgba(255, 107, 0, 0.4);
  box-shadow: 0 20px 40px rgba(255, 107, 0, 0.12), 0 0 20px rgba(255, 107, 0, 0.05);
  background: #fff;
}
.book-category:hover::before { opacity: 1; }

.book-cat-icon {
  width: 36px;
  height: 36px;
  margin: 0 auto 16px auto;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.book-cat-icon i {
  font-size: 32px;
  color: var(--primary-color);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.book-cat-icon svg {
  width: 100%; height: 100%;
  stroke: var(--primary-color);
  stroke-width: 1.5;
  fill: none;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.book-category:hover .book-cat-icon i,
.book-category:hover .book-cat-icon svg {
  color: var(--accent-color);
  stroke: var(--accent-color);
  transform: scale(1.15);
  filter: drop-shadow(0 4px 8px rgba(255, 107, 0, 0.4));
}
.book-cat-name {
  font-weight: 600;
  font-size: 1rem;
  margin: 0 0 6px 0;
  color: var(--primary-color);
  position: relative;
  z-index: 1;
  transition: color 0.3s ease;
}
.book-category:hover .book-cat-name { color: var(--accent-color); }

.book-cat-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
  position: relative;
  z-index: 1;
  font-weight: 500;
}

/* Mobile Responsive */
@media (max-width: 1024px) {
  .book-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 300px;
  }
}
@media (max-width: 768px) {
  .book-header-left h2 { font-size: 2.2rem; }
  .book-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: 320px;
    gap: 16px;
  }
  .book-card { 
    height: 350px; 
    --col-span: 1 !important;
    --row-span: 1 !important;
  }
  .book-promo { height: auto; padding: 40px 20px; }
  .book-slider-wrapper::before,
  .book-slider-wrapper::after { width: 40px; }
}
