/* ==========================================
   GENRE-DETAIL.CSS - Genre Detail Page Styles
   Page: genre_detail.html
   Dependencies: core.css (must be loaded first)
   ========================================== */

/* ==========================================
   GENRE DETAIL PAGE - COMPREHENSIVE STYLES
   ========================================== */

/* Genre Container */
.bk-genre-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

/* Genre Header */
.bk-genre-header {
  background: linear-gradient(135deg, var(--background-white) 0%, #f8fafc 100%);
  padding: var(--space-10) var(--space-8);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
  position: relative;
  overflow: hidden;
}

.bk-genre-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.bk-genre-info {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--space-6);
  align-items: start;
  margin-top: var(--space-6);
}

.bk-genre-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: var(--text-3xl);
  box-shadow: var(--shadow-lg);
  flex-shrink: 0;
}

.bk-genre-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.bk-genre-title {
  font-size: clamp(var(--text-2xl), 4vw, var(--text-4xl));
  color: var(--text-color);
  margin: 0;
  font-weight: 700;
  line-height: 1.2;
}

.bk-genre-description {
  font-size: var(--text-lg);
  color: var(--text-muted);
  margin: 0;
  line-height: 1.6;
  max-width: 600px;
}

.bk-genre-stats {
  display: flex;
  gap: var(--space-6);
  flex-wrap: wrap;
  margin-top: var(--space-4);
}

.bk-genre-stat {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--background-light);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  transition: var(--transition);
}

.bk-genre-stat:hover {
  background: white;
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.bk-genre-stat i {
  color: var(--primary-color);
  font-size: var(--text-lg);
}

.bk-stat-number {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-color);
}

.bk-stat-label {
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
}

.bk-genre-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  align-items: flex-end;
}

/* ==========================================
   GENRE FILTERS SECTION
   ========================================== */

.bk-genre-filters {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.bk-filter-tabs {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: var(--space-4);
}

.bk-filter-tab {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--background-light);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-weight: 500;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.bk-filter-tab:hover {
  background: var(--primary-light);
  color: var(--primary-color);
  border-color: var(--primary-color);
  transform: translateY(-1px);
}

.bk-filter-tab.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  box-shadow: var(--shadow-sm);
}

.bk-filter-tab i {
  font-size: var(--text-sm);
}

.bk-filter-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.bk-sort-control {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.bk-sort-control label {
  color: var(--text-color);
  font-weight: 600;
  font-size: var(--text-sm);
  margin: 0;
}

.bk-sort-control select {
  appearance: none;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  padding-right: var(--space-8);
  color: var(--text-color);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: var(--transition);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right var(--space-3) center;
  background-repeat: no-repeat;
  background-size: 16px;
}

.bk-sort-control select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.bk-view-toggle {
  display: flex;
  gap: var(--space-1);
  background: var(--background-light);
  border-radius: var(--radius-md);
  padding: var(--space-1);
  border: 1px solid var(--border-light);
}

.bk-view-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-size: var(--text-sm);
}

.bk-view-btn:hover {
  background: white;
  color: var(--primary-color);
  box-shadow: var(--shadow-xs);
}

.bk-view-btn.active {
  background: var(--primary-color);
  color: white;
  box-shadow: var(--shadow-sm);
}

/* ==========================================
   FEATURED BOOKS SECTION
   ========================================== */

.bk-featured-in-genre {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  padding: var(--space-6);
  margin-bottom: var(--space-8);
}

.bk-featured-carousel {
  position: relative;
}

.bk-carousel-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-6);
  overflow: hidden;
}

.bk-carousel-controls {
  display: flex;
  justify-content: center;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

.bk-carousel-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 2px solid var(--border-color);
  background: white;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  font-size: var(--text-lg);
}

.bk-carousel-btn:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ==========================================
   GENRE BOOKS SECTION
   ========================================== */

.bk-genre-books {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  padding: var(--space-6);
}

.bk-books-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-6);
  gap: var(--space-4);
  flex-wrap: wrap;
}

.bk-book-count {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: 500;
}

.bk-quota-reminder {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: linear-gradient(135deg, var(--premium-color), #ffed4a);
  color: #8b6914;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  border: 1px solid rgba(139, 105, 20, 0.2);
}

.bk-quota-reminder i {
  font-size: var(--text-sm);
}

/* ==========================================
   NO BOOKS FOUND STATE
   ========================================== */

.bk-no-books {
  text-align: center;
  padding: var(--space-12);
  color: var(--text-muted);
}

.bk-no-books-icon {
  font-size: var(--text-6xl);
  color: var(--text-light);
  margin-bottom: var(--space-4);
}

.bk-no-books h3 {
  font-size: var(--text-xl);
  color: var(--text-color);
  margin: 0 0 var(--space-2) 0;
}

.bk-no-books p {
  margin: 0 0 var(--space-6) 0;
  font-size: var(--text-base);
}

/* ==========================================
   BOOKS LIST VIEW
   ========================================== */

.bk-books-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.bk-book-list-item {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--background-light);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  transition: var(--transition);
}

.bk-book-list-item:hover {
  background: white;
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.bk-list-cover {
  width: 80px;
  height: 100px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--background-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.bk-list-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bk-list-placeholder {
  color: var(--text-light);
  font-size: var(--text-2xl);
}

.bk-list-details {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.bk-list-details h3 {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-color);
  margin: 0;
  line-height: 1.3;
}

.bk-list-authors {
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin: 0;
  font-style: italic;
}

.bk-list-meta {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  align-items: center;
}

.bk-meta-badge {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.bk-badge-free {
  background: var(--free-color);
  color: white;
}

.bk-badge-featured {
  background: var(--featured-color);
  color: white;
}

.bk-badge-audio {
  background: var(--info-color);
  color: white;
}

.bk-badge-level {
  background: var(--secondary-color);
  color: white;
}

.bk-meta-price {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-color);
  padding: var(--space-1) var(--space-2);
  background: var(--background-light);
  border-radius: var(--radius-sm);
}

.bk-list-description {
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin: 0;
  line-height: 1.4;
}

.bk-list-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  align-items: flex-end;
  justify-content: center;
}

/* ==========================================
   RELATED GENRES SECTION
   ========================================== */

.bk-related-genres {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  padding: var(--space-6);
}

.bk-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-6);
}

.bk-related-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-6);
  background: var(--background-light);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-color);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.bk-related-card:hover {
  background: white;
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
}

.bk-related-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  opacity: 0;
  transition: var(--transition);
}

.bk-related-card:hover::before {
  opacity: 1;
}

.bk-related-icon {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: var(--text-xl);
  margin-bottom: var(--space-4);
  transition: var(--transition);
}

.bk-related-card:hover .bk-related-icon {
  transform: scale(1.1);
}

.bk-related-card h3 {
  font-size: var(--text-lg);
  font-weight: 600;
  margin: 0 0 var(--space-2) 0;
}

.bk-related-card p {
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin: 0;
}

.bk-related-arrow {
  margin-top: var(--space-4);
  color: var(--primary-color);
  font-size: var(--text-sm);
  opacity: 0;
  transition: var(--transition);
}

.bk-related-card:hover .bk-related-arrow {
  opacity: 1;
  transform: translateX(4px);
}

/* ==========================================
   GENRE ANALYTICS SECTION
   ========================================== */

.bk-genre-analytics {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  padding: var(--space-6);
}

.bk-analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-6);
  margin-top: var(--space-6);
}

.bk-analytics-card {
  background: var(--background-light);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  text-align: center;
  transition: var(--transition);
}

.bk-analytics-card:hover {
  background: white;
}

.bk-analytics-icon {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: var(--text-xl);
  margin: 0 auto var(--space-4);
}

.bk-analytics-card h3 {
  font-size: var(--text-lg);
  font-weight: 600;
  margin: 0 0 var(--space-4) 0;
  color: var(--text-color);
}

.bk-analytics-card p {
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin: 0;
  line-height: 1.5;
}

.bk-trend-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
}

.bk-trend-up {
  background: var(--free-color);
  color: white;
}

.bk-level-breakdown {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.bk-level-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
}

.bk-level-label {
  min-width: 80px;
  text-align: left;
  font-weight: 500;
  color: var(--text-color);
}

.bk-level-progress {
  flex: 1;
  height: 8px;
  background: var(--background-light);
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 1px solid var(--border-light);
}

.bk-level-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--primary-hover));
  border-radius: var(--radius-full);
  transition: width 0.8s ease;
}

.bk-level-percent {
  min-width: 40px;
  text-align: right;
  font-weight: 600;
  color: var(--text-color);
}

.bk-release-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: var(--space-4);
}

.bk-release-count {
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--primary-color);
  line-height: 1;
}

.bk-release-text {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

/* ==========================================
   MODAL STYLES
   ========================================== */

.bk-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.bk-modal.active {
  opacity: 1;
  visibility: visible;
}

.bk-modal-content {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9);
  transition: var(--transition);
}

.bk-modal.active .bk-modal-content {
  transform: scale(1);
}

.bk-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-6);
  border-bottom: 1px solid var(--border-light);
}

.bk-modal-header h3 {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  color: var(--text-color);
  font-size: var(--text-lg);
}

.bk-modal-header i {
  color: var(--primary-color);
}

.bk-modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: var(--text-xl);
  border-radius: var(--radius-full);
  transition: var(--transition);
}

.bk-modal-close:hover {
  background: var(--background-light);
  color: var(--text-color);
}

.bk-modal-body {
  padding: var(--space-6);
}

.bk-modal-body p {
  margin: 0 0 var(--space-6) 0;
  color: var(--text-muted);
  line-height: 1.6;
}

.bk-follow-benefits {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.bk-benefit-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--background-light);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.bk-benefit-item i {
  color: var(--primary-color);
  font-size: var(--text-lg);
}

.bk-benefit-item span {
  color: var(--text-color);
  font-size: var(--text-sm);
  font-weight: 500;
}

.bk-modal-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
}

/* ==========================================
   PAGINATION CONTAINER
   ========================================== */

.bk-pagination-container {
  margin-top: var(--space-8);
  display: flex;
  justify-content: center;
}

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

@media (max-width: 768px) {
  .bk-genre-container {
    padding: var(--space-4);
    gap: var(--space-6);
  }

  .bk-genre-header {
    padding: var(--space-6);
  }

  .bk-genre-info {
    grid-template-columns: 1fr;
    gap: var(--space-4);
    text-align: center;
  }

  .bk-genre-actions {
    align-items: center;
  }

  .bk-genre-stats {
    justify-content: center;
  }

  .bk-filter-tabs {
    justify-content: center;
  }

  .bk-filter-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .bk-sort-control {
    justify-content: space-between;
  }

  .bk-books-header {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .bk-carousel-container {
    grid-template-columns: 1fr;
  }

  .bk-related-grid {
    grid-template-columns: 1fr;
  }

  .bk-analytics-grid {
    grid-template-columns: 1fr;
  }

  .bk-book-list-item {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .bk-list-actions {
    flex-direction: row;
    justify-content: center;
    align-items: center;
  }

  .bk-modal-content {
    width: 95%;
  }

  .bk-modal-actions {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .bk-genre-title {
    font-size: var(--text-xl);
  }

  .bk-genre-description {
    font-size: var(--text-base);
  }

  .bk-genre-stats {
    flex-direction: column;
    align-items: center;
  }

  .bk-filter-tabs {
    flex-direction: column;
  }

  .bk-filter-tab {
    justify-content: center;
  }

  .bk-level-bar {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    gap: var(--space-2);
  }

  .bk-level-label,
  .bk-level-percent {
    text-align: center;
  }
}

/* ==========================================
   ACCESSIBILITY & REDUCED MOTION
   ========================================== */

@media (prefers-reduced-motion: reduce) {
  .bk-genre-stat,
  .bk-filter-tab,
  .bk-carousel-btn,
  .bk-related-card,
  .bk-analytics-card,
  .bk-book-list-item,
  .bk-modal-content {
    transition: none;
  }
  
  .bk-genre-stat:hover,
  .bk-filter-tab:hover,
  .bk-carousel-btn:hover,
  .bk-related-card:hover,
  .bk-analytics-card:hover,
  .bk-book-list-item:hover {
    transform: none;
  }
}

/* ==========================================
   HIGH CONTRAST MODE SUPPORT
   ========================================== */

@media (prefers-contrast: high) {
  .bk-genre-header,
  .bk-genre-filters,
  .bk-featured-in-genre,
  .bk-genre-books,
  .bk-related-genres,
  .bk-genre-analytics {
    border: 2px solid #000;
  }
  
  .bk-genre-stat,
  .bk-filter-tab,
  .bk-related-card,
  .bk-analytics-card,
  .bk-book-list-item {
    border: 1px solid #000;
  }
  
  .bk-meta-badge,
  .bk-quota-reminder {
    border: 1px solid #000;
  }
}

/* ==========================================
   PRINT STYLES
   ========================================== */

@media print {
  .bk-genre-filters,
  .bk-modal,
  .bk-carousel-controls {
    display: none !important;
  }
  
  .bk-genre-header,
  .bk-featured-in-genre,
  .bk-genre-books,
  .bk-related-genres,
  .bk-genre-analytics {
    background: white !important;
    box-shadow: none !important;
    border: 1px solid #ccc !important;
  }
}

/* ==========================================
   GENRE SECTION TITLES
   ========================================== */

.bk-genre-container .bk-section-title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-color);
  margin: 0 0 var(--space-6) 0;
}

.bk-genre-container .bk-section-title i {
  color: var(--primary-color);
  font-size: var(--text-lg);
}
