/* ================= E-BOOK DETAIL PAGE ================= */
/* ================= RESOURCE SUPPORT POPUP ================= */

.resource-support-popup {
  position: fixed;
  z-index: 4000;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.72);
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
}

.resource-support-popup.active {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.resource-support-content {
  position: relative;
  width: min(520px, 100%);
  padding: 38px 32px 30px;
  background: #fffdf8;
  border: 1px solid rgba(140, 98, 57, 0.2);
  border-radius: 16px;
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.3);
  color: var(--text-color);
  text-align: center;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.3s ease;
}

.resource-support-popup.active .resource-support-content {
  transform: translateY(0) scale(1);
}

.resource-support-close {
  position: absolute;
  top: 12px;
  right: 18px;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--text-color);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  transition:
    color 0.25s ease,
    transform 0.25s ease;
}

.resource-support-close:hover {
  color: var(--accent-color);
  transform: rotate(90deg);
}

.resource-support-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  margin: 0 auto 20px;
  background: rgba(140, 98, 57, 0.12);
  border-radius: 50%;
  color: var(--accent-color);
  font-size: 1.8rem;
}

.resource-support-content h2 {
  margin-bottom: 17px;
  color: var(--secondary-color);
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.8rem;
  line-height: 1.25;
}

.resource-support-content p {
  margin-bottom: 13px;
  color: var(--text-color);
  font-size: 0.98rem;
  line-height: 1.65;
  opacity: 0.9;
}

.resource-support-content .resource-support-dua {
  margin: 17px 0 22px;
  color: var(--secondary-color);
  font-weight: 700;
}

.resource-support-buttons {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.resource-donate-button,
.resource-continue-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 48px;
  padding: 12px 18px;
  border-radius: 7px;
  font-family: inherit;
  font-size: 0.97rem;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 0.25s ease,
    background-color 0.25s ease,
    box-shadow 0.25s ease;
}

.resource-donate-button {
  background: var(--accent-color);
  border: 2px solid var(--accent-color);
  color: white;
}

.resource-continue-button {
  background: transparent;
  border: 2px solid var(--secondary-color);
  color: var(--secondary-color);
}

.resource-donate-button:hover,
.resource-continue-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 15px rgba(13, 59, 38, 0.15);
}

.resource-donate-button:hover {
  background: #704b2d;
  border-color: #704b2d;
  color: white;
}

.resource-continue-button:hover {
  background: var(--secondary-color);
  color: white;
}

@media (max-width: 600px) {
  .resource-support-content {
    padding: 34px 20px 24px;
  }

  .resource-support-content h2 {
    font-size: 1.5rem;
  }

  .resource-support-content p {
    font-size: 0.93rem;
  }
}

.ebook-detail-main {
  width: 100%;
  margin-top: 145px;
  padding: 0 20px;
}

.ebook-detail-wrapper {
  width: min(1100px, 100%);
  margin: 0 auto;
}

/* ================= BACK BUTTON ================= */

.back-to-library {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 25px;
  color: var(--secondary-color);
  font-size: 0.95rem;
  font-weight: 700;
  transition:
    color 0.3s ease,
    gap 0.3s ease;
}

.back-to-library:hover {
  gap: 13px;
  color: var(--accent-color);
}

/* ================= PRODUCT CONTAINER ================= */

.product-page {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(350px, 1.1fr);
  align-items: center;
  gap: 50px;
  width: 100%;
  padding: 45px;
  background: #fffdf8;
  border: 1px solid rgba(140, 98, 57, 0.18);
  border-radius: 16px;
  box-shadow: 0 12px 35px rgba(13, 59, 38, 0.12);
}

/* ================= LEFT COLUMN ================= */

.left-column {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.image-gallery {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

/* Main book image */

.main-image {
  display: block;
  width: 100%;
  max-width: 380px;
  height: 520px;
  margin-bottom: 20px;
  object-fit: contain;
  border-radius: 8px;
  cursor: pointer;
  filter: drop-shadow(0 12px 15px rgba(0, 0, 0, 0.2));
  transition:
    transform 0.3s ease,
    filter 0.3s ease;
}

.main-image:hover {
  transform: scale(1.025);
  filter: drop-shadow(0 16px 18px rgba(0, 0, 0, 0.25));
}

/* Thumbnail images */

.thumbnail-images {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  width: 100%;
}

.thumbnail-images img {
  width: 68px;
  height: 82px;
  padding: 3px;
  object-fit: cover;
  background: white;
  border: 2px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  opacity: 0.75;
  transition:
    border-color 0.25s ease,
    transform 0.25s ease,
    opacity 0.25s ease;
}

.thumbnail-images img:hover,
.thumbnail-images img.active {
  border-color: var(--accent-color);
  opacity: 1;
  transform: translateY(-3px);
}

/* ================= RIGHT COLUMN ================= */

.right-column {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  text-align: left;
}

.detail-category {
  display: inline-block;
  margin-bottom: 14px;
  padding: 7px 12px;
  background: rgba(140, 98, 57, 0.12);
  border-radius: 50px;
  color: var(--accent-color);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.right-column h1 {
  margin-bottom: 18px;
  color: var(--secondary-color);
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.15;
}

.right-column > p {
  margin-bottom: 25px;
  color: var(--text-color);
  font-size: 1.05rem;
  line-height: 1.75;
  opacity: 0.88;
}

/* ================= BOOK INFORMATION ================= */

.ebook-information {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  margin-bottom: 28px;
}

.ebook-information div {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 15px;
  background: rgba(140, 98, 57, 0.07);
  border: 1px solid rgba(140, 98, 57, 0.1);
  border-radius: 8px;
  text-align: left;
}

.ebook-information strong {
  color: var(--secondary-color);
  font-size: 0.78rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.ebook-information span {
  color: var(--text-color);
  font-size: 0.98rem;
}

/* ================= BUTTONS ================= */

.btn-container {
  display: flex;
  gap: 12px;
  width: 100%;
}

.btn {
  display: inline-flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 50px;
  padding: 13px 20px;
  border-radius: 7px;
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
  transition:
    transform 0.25s ease,
    background-color 0.25s ease,
    box-shadow 0.25s ease;
}

.rodownload {
  background: var(--secondary-color);
  color: white;
}

.btndownload {
  background: var(--accent-color);
  color: white;
}

.btn:hover {
  color: white;
  transform: translateY(-3px);
  box-shadow: 0 8px 16px rgba(13, 59, 38, 0.18);
}

.rodownload:hover {
  background: #082c1c;
}

.btndownload:hover {
  background: #704b2d;
}

/* ================= LIGHTBOX ================= */

.lightbox {
  position: fixed;
  z-index: 3000;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 70px 80px;
  background: rgba(0, 0, 0, 0.9);
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
}

.lightbox.active {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.expanded-image {
  display: block;
  max-width: 85%;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.lightbox button {
  padding: 0;
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
}

.lightbox-close {
  position: absolute;
  top: 25px;
  right: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  transition:
    color 0.25s ease,
    transform 0.25s ease;
}

.lightbox-close:hover {
  color: var(--accent-color);
  transform: rotate(90deg);
}

.lightbox .arrow {
  position: absolute;
  top: 50%;
  font-size: 2.4rem;
  transform: translateY(-50%);
  transition:
    color 0.25s ease,
    transform 0.25s ease;
}

.lightbox .arrow:hover {
  color: var(--accent-color);
}

.arrow-left {
  left: 30px;
}

.arrow-right {
  right: 30px;
}

/* ================= TABLET ================= */

@media (max-width: 900px) {
  .product-page {
    grid-template-columns: 1fr;
    gap: 35px;
    padding: 35px;
  }

  .main-image {
    max-width: 340px;
    height: 470px;
  }

  .right-column {
    align-items: center;
    text-align: center;
  }

  .ebook-information div {
    text-align: center;
  }
}

/* ================= MOBILE ================= */

@media (max-width: 600px) {
  .ebook-detail-main {
    margin-top: 110px;
    padding: 0 14px;
  }

  .back-to-library {
    margin-bottom: 18px;
  }

  .product-page {
    gap: 28px;
    padding: 24px 18px;
    border-radius: 12px;
  }

  .main-image {
    max-width: 280px;
    height: 400px;
  }

  .thumbnail-images img {
    width: 58px;
    height: 70px;
  }

  .right-column h1 {
    font-size: 2rem;
  }

  .right-column > p {
    font-size: 0.98rem;
  }

  .ebook-information {
    grid-template-columns: 1fr;
  }

  .btn-container {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .lightbox {
    padding: 65px 45px;
  }

  .expanded-image {
    max-width: 100%;
    max-height: 82vh;
  }

  .lightbox .arrow {
    font-size: 1.8rem;
  }

  .arrow-left {
    left: 12px;
  }

  .arrow-right {
    right: 12px;
  }

  .lightbox-close {
    top: 20px;
    right: 20px;
  }
}


/* =========================================================
   E-BOOK FORMAT SELECTOR
   ========================================================= */

.ebook-format-section {
    width: 100%;
    margin-bottom: 28px;
    padding: 15px;

    background: rgba(140, 98, 57, 0.07);

    border: 1px solid rgba(140, 98, 57, 0.1);
    border-radius: 8px;
}


.ebook-format-label {
    display: block;

    margin-bottom: 4px;

    color: var(--secondary-color);

    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.5px;

    text-transform: uppercase;
}


.ebook-format-description {
    margin: 0 0 12px;

    color: var(--text-color);

    font-size: 0.9rem;
    line-height: 1.45;

    opacity: 0.8;
}


.ebook-format-selector {
    display: grid;

    grid-template-columns:
        repeat(
            3,
            minmax(0, 1fr)
        );

    gap: 8px;

    width: 100%;
}


.ebook-format-button {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    gap: 7px;

    min-width: 0;
    min-height: 42px;

    padding: 9px 10px;

    background: #fffdf8;

    border: 1px solid
        rgba(140, 98, 57, 0.22);

    border-radius: 7px;

    color: var(--secondary-color);

    font: inherit;
    font-size: 0.82rem;
    font-weight: 700;

    cursor: pointer;

    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;
}


.ebook-format-button:hover {
    border-color:
        var(--accent-color);

    color:
        var(--accent-color);
}


.ebook-format-button.active {
    background:
        var(--secondary-color);

    border-color:
        var(--secondary-color);

    color:
        white;
}


.ebook-format-button:active {
    transform:
        translateY(1px);
}


/* =========================================================
   FORMAT PREVIEW GROUPS
   ========================================================= */

.ebook-preview-group[hidden] {
    display: none !important;
}


.ebook-preview-group.active {
    display: flex;
}


/* =========================================================
   RESPONSIVE FORMAT SELECTOR
   ========================================================= */

@media (max-width: 600px) {

    .ebook-format-selector {
        grid-template-columns: 1fr;
    }

}