/**
 * Agape Books — Book Listing & Detail Styles
 * Enqueued on: singular agape_book, page-books
 */

/* =========================================
   SUCCESS BANNER
   ========================================= */
.book-success-banner {
  background: var(--green);
  color: var(--white);
  padding: 0.85rem 0;
  position: relative;
  z-index: 10;
}
.book-success-banner .container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.92rem;
  font-weight: 500;
}
.book-success-banner svg {
  flex-shrink: 0;
}
.book-success-banner button {
  background: none;
  border: none;
  color: var(--white);
  font-size: 1.4rem;
  cursor: pointer;
  margin-left: auto;
  padding: 0 0.25rem;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.book-success-banner button:hover {
  opacity: 1;
}

/* =========================================
   BOOKS SECTION — LISTING PAGE
   ========================================= */
.books-section {
  padding: 5rem 0;
  background: var(--white);
}

/* Grid */
.books-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

/* =========================================
   BOOK CARD
   ========================================= */
.book-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  display: flex;
  flex-direction: column;
}
.book-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

/* Cover Image */
.book-card-cover {
  display: block;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: var(--gray-50);
}
.book-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.book-card:hover .book-card-cover img {
  transform: scale(1.03);
}

/* Placeholder when no cover image */
.book-card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  color: rgba(255,255,255,0.4);
}

/* Card Body */
.book-card-body {
  padding: 1.25rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Format Badges */
.book-card-badges {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}
.book-format-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
}
.badge-digital {
  background: rgba(43,122,120,0.1);
  color: var(--gold);
}
.badge-physical {
  background: rgba(26,54,93,0.08);
  color: var(--navy);
}

/* Title */
.book-card-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--navy);
  margin: 0 0 0.35rem;
}
.book-card-title a {
  color: inherit;
  text-decoration: none;
}
.book-card-title a:hover {
  color: var(--gold);
}

/* Author */
.book-card-author {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin: 0 0 0.5rem;
  font-weight: 500;
}

/* Description */
.book-card-desc {
  font-size: 0.88rem;
  color: var(--gray-600);
  line-height: 1.6;
  margin: 0 0 1rem;
  flex: 1;
}

/* Footer (price + actions) */
.book-card-footer {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--gray-100);
}

.book-card-price {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}
.book-price {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--navy);
}
.book-price-free {
  color: var(--green);
}

/* Card Actions */
.book-card-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.book-card-actions .btn {
  text-align: center;
  justify-content: center;
}

/* Purchased Badge (inline) */
.book-purchased-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--green);
  background: rgba(43,122,120,0.08);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
}

/* =========================================
   EMPTY STATE
   ========================================= */
.books-empty {
  text-align: center;
  padding: 5rem 0;
  color: var(--gray-400);
}
.books-empty svg {
  margin: 0 auto 1.5rem;
  opacity: 0.5;
}
.books-empty h3 {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  color: var(--gray-600);
  margin: 0 0 0.5rem;
}
.books-empty p {
  color: var(--gray-500);
  font-size: 0.95rem;
}

/* =========================================
   SINGLE BOOK — DETAIL PAGE
   ========================================= */
.book-detail-section {
  padding: 4rem 0 5rem;
  background: var(--white);
}

/* Content Layout (reuses existing 2-col pattern) */
.book-detail-section .content-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 3rem;
  align-items: start;
}

/* Main Content */
.book-detail-main {
  min-width: 0;
}

/* Cover Image — Single Page */
.book-detail-cover {
  margin-bottom: 2.5rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--gray-50);
  max-width: 420px;
}
.book-detail-cover img {
  width: 100%;
  height: auto;
  display: block;
}
.book-cover-placeholder {
  aspect-ratio: 3 / 4;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  color: rgba(255,255,255,0.35);
}

/* Description */
.book-description {
  font-size: 1rem;
  color: var(--gray-700);
  line-height: 1.8;
}
.book-description p {
  margin-bottom: 1.25rem;
}
.book-description p:last-child {
  margin-bottom: 0;
}

/* Book Metadata Grid */
.book-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.book-meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-100);
  border-right: 1px solid var(--gray-100);
}
.book-meta-item:nth-child(2n) {
  border-right: none;
}
.book-meta-item:nth-last-child(-n+2) {
  border-bottom: none;
}
.book-meta-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray-500);
}
.book-meta-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-800);
}

/* =========================================
   PURCHASE SIDEBAR CARD
   ========================================= */
.book-detail-sidebar {
  position: relative;
}
.book-purchase-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  position: sticky;
  top: 90px;
  box-shadow: var(--shadow);
}

/* Price Display */
.book-purchase-price {
  text-align: center;
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--gray-100);
}
.purchase-price-amount {
  display: block;
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.2;
}
.purchase-price-free {
  color: var(--green);
}
.purchase-price-label {
  display: block;
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-top: 0.15rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* Format Badges in Sidebar */
.book-purchase-formats {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}
.book-purchase-formats .book-format-badge {
  font-size: 0.75rem;
  padding: 0.3rem 0.75rem;
}

/* Purchase Actions */
.book-purchase-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.book-purchase-actions .btn {
  text-align: center;
  justify-content: center;
}

/* Purchased Notice */
.book-purchased-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: rgba(43,122,120,0.08);
  color: var(--green);
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
}

/* Resend Limit Text */
.book-resend-limit {
  font-size: 0.82rem;
  color: var(--gray-500);
  text-align: center;
  margin: 0;
  line-height: 1.5;
}

/* Trust Indicators */
.book-trust-indicators {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--gray-100);
}
.trust-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.82rem;
  color: var(--gray-500);
  font-weight: 500;
}
.trust-item svg {
  flex-shrink: 0;
  color: var(--gold);
}

/* =========================================
   PUBLICATIONS PAGE — DIGITAL BOOKS SECTION
   ========================================= */
.pub-digital-section {
  padding: 4rem 0;
  background: var(--white);
}

.pub-success-banner {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: #e8f5e9;
  color: #2d8653;
  border: 1px solid #c8e6c9;
  border-radius: var(--radius);
  padding: 0.85rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 2rem;
}
.pub-success-banner svg {
  flex-shrink: 0;
}

.pub-books-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.75rem;
}

.pub-book-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.pub-book-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.pub-book-cover {
  display: block;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: var(--gray-50);
  position: relative;
}
.pub-book-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.pub-book-card:hover .pub-book-cover img {
  transform: scale(1.03);
}
.pub-book-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  color: rgba(255,255,255,0.4);
}

.pub-book-format-badges {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  display: flex;
  gap: 0.35rem;
}
.pub-format-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
}
.pub-format--digital {
  background: rgba(43,122,120,0.9);
  color: var(--white);
}
.pub-format--physical {
  background: rgba(26,54,93,0.85);
  color: var(--white);
}

.pub-book-body {
  padding: 1.25rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.pub-book-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy);
  margin: 0 0 0.25rem;
  line-height: 1.3;
}
.pub-book-title a {
  color: inherit;
  text-decoration: none;
}
.pub-book-title a:hover {
  color: var(--gold);
}
.pub-book-author {
  font-size: 0.82rem;
  color: var(--gray-500);
  margin: 0 0 0.5rem;
  font-weight: 500;
}
.pub-book-desc {
  font-size: 0.85rem;
  color: var(--gray-600);
  line-height: 1.6;
  margin: 0 0 1rem;
  flex: 1;
}

.pub-book-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--gray-100);
  margin-top: auto;
}
.pub-book-price {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--navy);
}
.pub-book-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.pub-book-owned {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--green);
  background: rgba(43,122,120,0.08);
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-full);
}

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 1024px) {
  .books-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
  .pub-books-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .books-section {
    padding: 3rem 0;
  }

  .books-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    max-width: 420px;
    margin: 0 auto;
  }
  .pub-books-grid {
    grid-template-columns: 1fr;
    max-width: 420px;
    margin: 0 auto;
  }

  /* Single book — stack sidebar below content */
  .book-detail-section {
    padding: 3rem 0;
  }
  .book-detail-section .content-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .book-detail-cover {
    max-width: 320px;
    margin: 0 auto 2rem;
  }

  .book-purchase-card {
    position: static;
  }

  .book-meta-grid {
    grid-template-columns: 1fr;
  }
  .book-meta-item {
    border-right: none !important;
  }
  .book-meta-item:last-child {
    border-bottom: none;
  }
}

@media (max-width: 480px) {
  .book-card-body {
    padding: 1rem 1.25rem 1.25rem;
  }
  .book-card-title {
    font-size: 1rem;
  }
  .book-price {
    font-size: 1.15rem;
  }
  .purchase-price-amount {
    font-size: 2rem;
  }
}
