/* === BASE === */
body {
  background: #f5f7fa;
  font-family: 'Segoe UI', Arial, sans-serif;
}
.ficha-obra-sinopsis {
  white-space: pre-line;
}

.book-card-caps {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 16px #0001;
  padding: 1.5rem;
  /*margin: 2rem auto;*/
  max-width: 100%;
  max-height: 90%;
}

/* === HEADER === */
    .book-header {
      margin-bottom: 1rem;
      font-weight: bold;
      color: #f8b400;
      font-size: 1.1em;
    
      /* Añadido para alinear título e icono */
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    
    /* Botón de orden ascendente/descendente */
    .order-toggle {
      background: none;
      border: none;
      cursor: pointer;
      font-size: 1.2em;
      color: #f8b400;
      padding: 0;
      margin: 0;
    }
    
    .order-toggle:hover {
      color: #ffd966;
    }

/* === MAIN STRUCTURE === */
.book-main {
  display: flex;
  gap: 2rem;
}

.book-image {
  font-size: 0.75em;
  color: #4e4e4e;
}

.book-image img {
  width: 150px;
  height: 210px;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 2px 8px #0002;
  display: block;
  margin-bottom: 0.7em;
}

/* === INFO === */
.book-info-container {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.book-info h2 {
  margin: 0 0 0.2em 0;
  font-size: 1.5em;
}

.book-author {
  font-size: 0.9em;
  color: #888;
  margin-left: 0.8em;
}

.book-rating {
  margin: 0.5em 0 1em 0;
  display: flex;
  align-items: center;
  gap: 0.5em;
  flex-wrap: wrap;
}

.stars {
  color: #f8b400;
  font-size: 1.2em;
  letter-spacing: 2px;
}

.rating-value, .rating-votes {
  color: #888;
  font-size: 0.97em;
}

.rate-btns button {
  background: none;
  border: none;
  color: #bbb;
  font-size: 1em;
  cursor: pointer;
  transition: color 0.2s;
  padding: 0 0.1em;
}

.rate-btns button.rated,
.rate-btns button:hover {
  color: #f8b400;
}

/* === SYNOPSIS & BUTTONS === */
.book-synopsis {
  margin-bottom: 1em;
  font-size: 0.75em;
  color: #4e4e4e;
}

.book-buttons button {
  margin-right: 0.5em;
  padding: 0.45em 1.2em;
  border: none;
  border-radius: 4px;
  background: #f8b400;
  color: #fff;
  font-weight: bold;
  cursor: pointer;
  font-size: 1em;
  transition: background 0.2s;
}

.book-buttons button:hover {
  background: #f39800;
}

/* === GENRES & LINKS === */
.book-genres, .book-links {
  margin-top: 0.3em;
  font-size: 0.95em;
}

.book-genres span, .book-links a {
  display: block;
  color: #444;
  margin-bottom: 0.2em;
  text-decoration: none;
}

.book-links a:hover {
  color: #f8b400;
}

/* === CHAPTERS === */
.book-latest-chapters, .book-chapters-list {
  margin-top: 2em;
}

.book-latest-chapters h3, .book-chapters-list h3 {
  font-size: 1.1em;
  color: #333;
  margin-bottom: 0.5em;
}

.book-latest-chapters ul,
.book-chapters-list ul {
  list-style: none;
  padding: 0;
  margin: 0 0 0.7em 0;
}
/*
.book-chapters-list ul {
  height: 3.5em
}
*/
.book-latest-chapters li,
.book-chapters-list li {
  padding: 0.3em 0;
  border-bottom: 1px solid #eee;
  font-size: 1em;
}

.book-chapters-list .chapter-columns li {
  border-bottom: 1px dotted #eee;
  padding: 0.2em 0;
}

/* === COLUMNAS EN LISTA DE CAPÍTULOS === */
.book-chapters-list ul {
  column-count: 2;
  column-gap: 30px;
}

.book-chapters-list li {
  break-inside: avoid;
}

/* === PAGINACIÓN === */
.pagination {
  /*display: flex;*/
  gap: 0.5em;
  justify-content: flex-end;
  align-items: center;
}

.pagination button {
  padding: 0.3em 0.8em;
  background: #eee;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
  margin-bottom: 0.3em;
}

.pagination button:disabled {
  background: #ddd;
  color: #bbb;
  cursor: not-allowed;
  margin-bottom: 0.3em;
}

.pagination span {
  margin: 0 0.5em;
  font-weight: bold;
  color: #555;
}

/* === RESPONSIVE === */

/* Tablets < 900px */
@media (max-width: 900px) {
  .book-card-caps {
    max-width: 98vw;
    padding: 1rem;
  }
  .book-main {
    gap: 1rem;
  }
  .book-header {
    font-size: 1em;
  }
}

/* Móviles < 600px */
@media (max-width: 700px) {
  .book-card-caps {
    margin: 0.5rem;
    padding: 0.8rem 0.3rem;
    max-width: 100vw;
    border-radius: 0;
    box-shadow: none;
  }
  .book-main {
    flex-direction: column;
    gap: 0.3rem;
    align-items: center;
  }
  .book-image img {
    width: 120px;
    height: 170px;
  }
  .book-info h2 {
    font-size: 1.1em;
  }
  .book-author {
    font-size: 0.8em;
  }
  .book-chapters-list ul {
    column-count: 1;
  }
  .book-buttons button {
    font-size: 1em;
    width: 98%;
    margin: 0.2em 0;
    padding: 0.7em 0;
    display: block;
  }
  .pagination {
    justify-content: center;
    font-size: 0.98em;
    gap: 0.2em;
  }
}

.chapter-list.pdf-link {
  display: block;
}
/* Tablets pequeñas entre 601px y 700px */
@media (max-width: 700px) and (min-width: 601px) {
  .book-main {
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
  }
  .book-chapters-list ul {
    column-count: 1;
  }
}
/* Responsive: en pantallas pequeñas, apilar los spans */
@media (max-width: 700px) {
  .pdf-link {
    flex-direction: column;
    align-items: flex-start;
  }

  .pdf-link span {
    flex: 1 1 100%;
    text-align: left;
  }
}
/*===botones de paginacion===*/
    .pagination-controls {
      display: flex;
      justify-content: space-between;
      align-items: center;
      text-align: center;
      background-color: transparent;
      color: black;
      padding: 0.5em 1em;
      gap: 0.5em;
      flex-wrap: wrap;
      border-radius: 6px;
    }
    
    /* Botones de paginación */
    .pagina-btn {
      flex: 0 0 100px; /* Todos los botones del mismo ancho */
      padding: 0.4em 0.6em;
      font-size: 0.9em;
      background-color: transparent;
      border: 1px solid #ccc;
      color: black;
      cursor: pointer;
      text-align: center;
      border-radius: 6px;
    }
    
    /* Botón deshabilitado */
    .pagina-btn:disabled {
      opacity: 0.5;
      cursor: default;
    }
    
    /* Rango centrado entre los botones */
    .pagination-range {
      flex: 1 1 auto;
      text-align: center;
      font-weight: bold;
      font-size: 0.95em;
      color: black;
    }
/*===fin botones de paginacion===*/

.chapter-page ul {
  display: flex;
  flex-wrap: wrap;
  gap: 1em; /* Espacio entre columnas y filas */
  padding: 0;
  margin: 0;
  list-style: none;
}

.chapter-page ul li {
  flex: 0 0 calc(50% - 0.5em); /* Dos columnas horizontales */
  box-sizing: border-box;
}
@media (max-width: 700px) {
  .chapter-page ul li {
    flex: 0 0 100%;
  }
}
/*Valoracion obras*/
.book-rating {
  margin-top: 10px;
  font-size: 16px;
  text-align: left;
}

.stars i {
  font-size: 20px;
  margin-right: 5px;
  transition: color 0.3s;
}

.rating-text {
  margin-top: 5px;
  font-weight: bold;
}

.your-rating {
  margin-top: 5px;
  font-style: italic;
  color: #555;
}
/*Fin valoracion obras*/

