/* ============================================================================
   THE PUZZLE ARCHITECT - BOOKS PAGE STYLES
   Page-specific styles using 'books-' prefix
   ============================================================================ */

/* ============================================================================
   CSS CUSTOM PROPERTIES (Books Page)
   ============================================================================ */

:root {
  --books-primary: #0052CC;
  --books-primary-dark: #003d99;
  --books-accent: #FFD700;
  --books-text: #1a1a2e;
  --books-text-light: #64748b;
  --books-bg: #f8fafc;
  --books-card-bg: #ffffff;
  --books-shadow: 0 10px 40px rgba(0, 82, 204, 0.08);
  --books-shadow-hover: 0 25px 60px rgba(0, 82, 204, 0.15);
}

/* ============================================================================
   PAGE HEADER
   ============================================================================ */

.books-hero {
  background: linear-gradient(135deg, #0052CC 0%, #1a3a6e 50%, #003d99 100%);
  padding: 120px 20px 80px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.books-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 20% 80%, rgba(255, 215, 0, 0.1) 0%, transparent 50%),
              radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
  pointer-events: none;
}

.books-hero-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto;
}

.books-hero-title {
  font-size: 3rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 15px;
}

.books-hero-subtitle {
  font-size: 1.25rem;
  color: rgba(255, 255, 255, 0.9);
  max-width: 600px;
  margin: 0 auto;
}

/* ============================================================================
   FILTER TABS
   ============================================================================ */

.books-filters {
  background: var(--books-bg);
  padding: 30px 20px;
  border-bottom: 1px solid #e2e8f0;
}

.books-filters-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.books-filter-btn {
  padding: 12px 28px;
  border: 2px solid #e2e8f0;
  background: #fff;
  border-radius: 50px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--books-text-light);
  cursor: pointer;
  transition: all 0.3s ease;
}

.books-filter-btn:hover {
  border-color: var(--books-primary);
  color: var(--books-primary);
}

.books-filter-btn.active {
  background: var(--books-primary);
  border-color: var(--books-primary);
  color: #fff;
}

/* ============================================================================
   BOOKS GRID
   ============================================================================ */

.books-section {
  background: var(--books-bg);
  padding: 60px 20px 100px;
}

.books-container {
  max-width: 1400px;
  margin: 0 auto;
}

.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 40px;
}

/* ============================================================================
   BOOK CARD
   ============================================================================ */

.books-card {
  background: var(--books-card-bg);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--books-shadow);
  transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
}

.books-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--books-primary), var(--books-accent));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
}

.books-card:hover {
  transform: translateY(-15px);
  box-shadow: var(--books-shadow-hover);
}

.books-card:hover::before {
  transform: scaleX(1);
}

.books-card.coming-soon {
  opacity: 0.85;
}

.books-card.coming-soon .books-card-cover img {
  filter: grayscale(30%);
}

/* Cover Image */
.books-card-cover {
  position: relative;
  padding-top: 150%; /* 2:3 aspect ratio for book covers */
  background: linear-gradient(135deg, #e2e8f0, #f1f5f9);
  overflow: hidden;
}

.books-card-cover img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.books-card:hover .books-card-cover img {
  transform: scale(1.05);
}

/* Placeholder for coming soon */
.books-card-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  color: #fff;
  font-size: 1.2rem;
  font-weight: 600;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.books-card-placeholder.medium {
  background: linear-gradient(135deg, #3d9140 0%, #5cb85c 100%);
}

.books-card-placeholder.hard {
  background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
}

.books-card-placeholder.expert {
  background: linear-gradient(135deg, #b91c1c 0%, #ef4444 100%);
}

.books-placeholder-text {
  padding: 8px 16px;
  background: rgba(255,255,255,0.2);
  border-radius: 20px;
  backdrop-filter: blur(4px);
}

/* Badges */
.books-card-badge {
  position: absolute;
  top: 15px;
  right: 15px;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.books-card-badge.easy {
  background: linear-gradient(135deg, #22C55E, #16A34A);
  color: #fff;
}

.books-card-badge.medium {
  background: linear-gradient(135deg, #D97706, #B45309);
  color: #fff;
}

.books-card-badge.hard {
  background: linear-gradient(135deg, #EA580C, #C2410C);
  color: #fff;
}

.books-card-badge.expert {
  background: linear-gradient(135deg, #DC2626, #B91C1C);
  color: #fff;
}

.books-card-status {
  position: absolute;
  top: 15px;
  left: 15px;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--books-accent);
  color: #000;
}

.books-card-status.coming-soon-status {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

/* Card Content */
.books-card-content {
  padding: 25px;
}

.books-card-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--books-text);
  margin-bottom: 5px;
}

.books-card-volume {
  font-size: 0.95rem;
  color: var(--books-primary);
  font-weight: 600;
  margin-bottom: 10px;
}

.books-card-meta {
  display: flex;
  gap: 15px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

.books-card-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--books-text-light);
}

.books-card-meta-item svg {
  width: 16px;
  height: 16px;
  color: var(--books-primary);
}

.books-card-description {
  font-size: 0.95rem;
  color: var(--books-text-light);
  line-height: 1.6;
  margin-bottom: 20px;
}

/* Card Actions */
.books-card-actions {
  display: flex;
  gap: 10px;
}

.books-card-btn {
  flex: 1;
  padding: 14px 20px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
}

.books-card-btn-primary {
  background: linear-gradient(135deg, var(--books-primary), var(--books-primary-dark));
  color: #fff;
}

.books-card-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 82, 204, 0.3);
}

.books-card-btn-secondary {
  background: #f1f5f9;
  color: var(--books-text);
}

.books-card-btn-secondary:hover {
  background: #e2e8f0;
}

.books-card-btn-disabled {
  background: #e2e8f0;
  color: #94a3b8;
  cursor: not-allowed;
}

/* ============================================================================
   FEATURES SECTION
   ============================================================================ */

.books-features {
  background: #fff;
  padding: 80px 20px;
}

.books-features-container {
  max-width: 1200px;
  margin: 0 auto;
}

.books-features-title {
  text-align: center;
  font-size: 2rem;
  font-weight: 700;
  color: var(--books-text);
  margin-bottom: 50px;
}

.books-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
}

.books-feature-item {
  text-align: center;
  padding: 30px;
}

.books-feature-icon {
  width: 70px;
  height: 70px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #eef4ff 0%, #e0ebff 100%);
  border-radius: 16px;
  color: var(--books-primary);
}

.books-feature-icon svg {
  width: 32px;
  height: 32px;
}

.books-feature-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--books-text);
  margin-bottom: 10px;
}

.books-feature-text {
  font-size: 0.95rem;
  color: var(--books-text-light);
  line-height: 1.6;
}

/* ============================================================================
   COMING SOON SECTION
   ============================================================================ */

.books-coming-soon {
  background: linear-gradient(135deg, #0052CC 0%, #003d99 100%);
  padding: 80px 20px;
  text-align: center;
  color: #fff;
}

.books-coming-soon-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 15px;
}

.books-coming-soon-text {
  font-size: 1.1rem;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto 30px;
}

.books-coming-soon-list {
  display: flex;
  justify-content: center;
  gap: 30px;
  flex-wrap: wrap;
}

.books-coming-soon-item {
  background: rgba(255, 255, 255, 0.1);
  padding: 20px 30px;
  border-radius: 12px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.books-coming-soon-item strong {
  display: block;
  font-size: 1.1rem;
  margin-bottom: 5px;
}

.books-coming-soon-item span {
  font-size: 0.9rem;
  opacity: 0.8;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
  .books-hero {
    padding: 100px 20px 60px;
  }
  
  .books-hero-title {
    font-size: 2rem;
  }
  
  .books-hero-subtitle {
    font-size: 1rem;
  }
  
  .books-filters {
    top: 60px;
    padding: 20px 15px;
  }
  
  .books-filter-btn {
    padding: 10px 20px;
    font-size: 0.85rem;
  }
  
  .books-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }
  
  .books-card-actions {
    flex-direction: column;
  }
  
  .books-features-title {
    font-size: 1.5rem;
  }
  
  .books-coming-soon-title {
    font-size: 1.5rem;
  }
  
  .books-coming-soon-list {
    flex-direction: column;
    align-items: center;
  }
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

.books-animate-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.books-animate-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger delays */
.books-card:nth-child(1) { transition-delay: 0.1s; }
.books-card:nth-child(2) { transition-delay: 0.2s; }
.books-card:nth-child(3) { transition-delay: 0.3s; }
.books-card:nth-child(4) { transition-delay: 0.4s; }
.books-card:nth-child(5) { transition-delay: 0.5s; }
.books-card:nth-child(6) { transition-delay: 0.6s; }

/* ============================================================================
   REDUCED MOTION
   ============================================================================ */

@media (prefers-reduced-motion: reduce) {
  .books-card,
  .books-card-cover img,
  .books-animate-in {
    transition: none;
  }
  
  .books-animate-in {
    opacity: 1;
    transform: none;
  }
}

/* ============================================================================
   PREVIEW MODAL
   ============================================================================ */

.preview-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
}

.preview-modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
}

.preview-modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.preview-modal-close {
  position: absolute;
  top: -40px;
  right: 0;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  padding: 10px;
  z-index: 10;
}

.preview-modal-close:hover {
  color: #4a6cf7;
}

.preview-modal-gallery {
  display: flex;
  align-items: center;
  gap: 20px;
}

.preview-nav {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  font-size: 1.5rem;
  padding: 15px 20px;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s;
}

.preview-nav:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: #4a6cf7;
}

.preview-modal-image-container {
  text-align: center;
}

.preview-modal-image-container img {
  max-height: 70vh;
  max-width: 60vw;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.preview-caption {
  color: #ccc;
  margin-top: 15px;
  font-size: 1rem;
}

.preview-thumbnails {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.preview-thumbnail {
  width: 60px;
  height: 80px;
  object-fit: cover;
  border: 2px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0.6;
  transition: all 0.2s;
}

.preview-thumbnail:hover,
.preview-thumbnail.active {
  opacity: 1;
  border-color: #4a6cf7;
}

@media (max-width: 768px) {
  .preview-modal-gallery {
    flex-direction: column;
  }
  
  .preview-nav {
    display: none;
  }
  
  .preview-modal-image-container img {
    max-width: 90vw;
    max-height: 60vh;
  }
}
