/* Shared e-book content styles (front-end + admin preview/editor) */

/* Legacy image blocks (AS-06) */
.books-content img,
.ebook-image-block img,
.ebook-gallery img{
  max-width: 100%;
  height: auto;
}

.ebook-image-block{
  margin: 12px 0;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.ebook-image-block img{
  width: auto;
  max-height: 420px;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: #fff;
}

.ebook-gallery{
  margin: 12px 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.ebook-gallery img{
  width: 100%;
  height: 160px;
  max-height: 160px;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: #fff;
  object-fit: cover;
}

/* Visual editor output (v2) */
.ebook-canvas{
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ebook-block{
  width: 100%;
}

.ebook-block--text p{
  margin-bottom: 10px;
}

.ebook-block--image,
.ebook-combo__image{
  margin: 10px 0;
}

.ebook-block--image img,
.ebook-combo__image img{
  width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: #fff;
}

.ebook-w-25{ width: 25%; max-width: 25%; }
.ebook-w-50{ width: 50%; max-width: 50%; }
.ebook-w-75{ width: 75%; max-width: 75%; }
.ebook-w-100{ width: 100%; max-width: 100%; }

.ebook-align-left{ margin-right: auto; }
.ebook-align-center{ margin-left: auto; margin-right: auto; }
.ebook-align-right{ margin-left: auto; }
.ebook-align-full{ width: 100%; max-width: 100%; margin-left: 0; margin-right: 0; }

.ebook-block--combo.ebook-combo{
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 14px;
  align-items: start;
}

.ebook-combo--reverse{
  grid-template-columns: 0.85fr 1.15fr;
}

.ebook-combo__text{
  min-width: 0;
}

.ebook-combo__media{
  min-width: 0;
}

.ebook-combo__media .ebook-combo__image{
  width: 100%;
  max-width: 100%;
  margin: 0;
}

@media (max-width: 991px){
  .ebook-block--combo.ebook-combo,
  .ebook-combo--reverse{
    grid-template-columns: 1fr;
  }

  .ebook-w-25,
  .ebook-w-50,
  .ebook-w-75{
    width: 100%;
    max-width: 100%;
  }

  .ebook-align-left,
  .ebook-align-center,
  .ebook-align-right{
    margin-left: 0;
    margin-right: 0;
  }
}

@media (max-width: 768px){
  .ebook-image-block img{
    max-height: 280px;
  }
  .ebook-gallery img{
    height: 140px;
    max-height: 140px;
  }
}

