/* Volver */
.back-row{ margin-bottom: 12px; }
.back-link{
  color: var(--kairan);
  text-decoration: none;
  font-weight: 900;
}
.back-link:hover{ text-decoration: underline; }

/* Header libro */
.book-header{ margin-bottom: 18px; text-align: center; }
.book-title{
  margin: 0;
  font-size: 2.2rem;
  color: var(--kairan);
  letter-spacing: .2px;
}
.book-desc{
  margin: 14px auto 0;
  max-width: 820px;
  color: #374151;
  text-align: justify;
  line-height: 1.7;
}

/* Capítulos */
/* Capítulos (cards colapsables) */
.chapter{
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
  margin: 14px 0;
  overflow: hidden;
}

.chapter__summary{
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 10px;
  list-style: none;
  color: var(--kairan);
}

/* Quita el marcador nativo (Chrome/Safari) */
.chapter__summary::-webkit-details-marker{ display:none; }

/* Quita el marcador nativo (Firefox) */
.chapter__summary::marker{ content:""; }

/* Flecha personalizada */
.chapter__summary:before{
  content: "▸";
  font-weight: 900;
  transform: translateY(-1px);
}
.chapter[open] > .chapter__summary:before{
  content: "▾";
}

.chapter__body{
  padding: 0 16px 16px;
}

/* Texto del capítulo */
.chapter__text{
  text-align: justify;
  line-height: 1.8;
  color: #111827;
}

.chapter__title{
  font-size: 1.1rem;
  color: #111827;
}
.chapter__label{
  color: var(--kairan);
}

/* =========================
   Libros: separaciones + divisores
   ========================= */

.divider{
  border: 0;
  height: 0;
  border-top: 2px solid rgba(0,0,0,.18);
  margin: 18px 0;
}

.chapter__body{
  padding: 14px 16px 18px;
}

.section{
  background: rgba(255,255,255,.55);
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 14px;
  padding: 14px;
  margin: 16px 0;
}

.sections{
  margin-top: 18px;
}

/* =========================
   Imágenes más pequeñas (capítulo y secciones)
   ========================= */
.chapter__body .media img{
  max-height: 220px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,.12);
}

/* =========================
   Botones “Guardar cambios” más visibles dentro de libros
   ========================= */
.chapter__body .btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  font-weight: 900;
}

.chapter__body button.btn{
  margin-top: 10px;
}

/* =========================
   Biblioteca / Lista de libros
   ========================= */

.library-page{
  padding-top: 4px;
}

.library-hero{
  border-radius: 22px;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(125,25,25,.10), rgba(125,25,25,.03)),
    #ffffff;
  border: 1px solid rgba(125,25,25,.12);
}

.library-hero__eyebrow{
  display: inline-block;
  margin-bottom: 8px;
  font-size: .82rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--kairan);
}

.library-hero__title{
  margin: 0;
  color: var(--kairan);
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  font-weight: 900;
  line-height: 1.05;
}

.library-hero__subtitle{
  max-width: 760px;
  color: #4b5563;
  font-size: .98rem;
  line-height: 1.6;
}

.library-hero__actions{
  min-width: 220px;
}

.library-create-btn{
  min-width: 190px;
  min-height: 42px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.library-stats{
  margin-top: 18px;
}

.library-stat-card{
  height: 100%;
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(125,25,25,.10);
  border-radius: 16px;
  padding: 14px 16px;
}

.library-stat-card__label{
  color: #6b7280;
  font-size: .88rem;
  margin-bottom: 4px;
}

.library-stat-card__value{
  color: var(--kairan);
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1;
}

.library-group{
  margin-bottom: 8px;
}

.library-group__header{
  margin-bottom: 6px;
}

.library-group__title{
  color: var(--kairan);
  font-size: 1.28rem;
  font-weight: 900;
}

.library-group__meta{
  color: #6b7280;
  font-size: .90rem;
}

.library-book{
  border-radius: 16px;
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease;
  background: #fff;
}

.library-book:hover{
  transform: translateY(-3px);
  box-shadow: 0 14px 28px rgba(0,0,0,.09) !important;
}

.library-book__cover{
  display: block;
  background: linear-gradient(180deg, rgba(125,25,25,.08), rgba(125,25,25,.03));
}

.library-book__image{
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
}

.library-book__placeholder{
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid rgba(0,0,0,.06);
  background:
    radial-gradient(circle at top, rgba(255,255,255,.65), rgba(255,255,255,.18)),
    linear-gradient(135deg, rgba(125,25,25,.16), rgba(125,25,25,.05));
}

.library-book__icon{
  font-size: 2.7rem;
  line-height: 1;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,.12));
}

.library-book__body{
  padding: 12px;
}

.library-badge{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .28rem .55rem;
  border-radius: 999px;
  background: rgba(125,25,25,.10);
  border: 1px solid rgba(125,25,25,.18);
  color: var(--kairan);
  font-size: .72rem;
  font-weight: 800;
}

.library-book .badge{
  font-size: .70rem;
}

.library-book__title{
  margin: 0 0 8px;
  font-size: .98rem;
  font-weight: 900;
  line-height: 1.2;
}

.library-book__title a{
  color: #111827;
}

.library-book__title a:hover{
  color: var(--kairan);
}

.library-book__desc{
  margin: 0;
  color: #4b5563;
  line-height: 1.45;
  text-align: left;
  font-size: .88rem;
}

.library-book__meta{
  color: #6b7280;
  font-size: .80rem;
  display: grid;
  gap: 3px;
}

.library-empty{
  border-radius: 22px;
  padding: 48px 24px;
  text-align: center;
}

.library-empty__icon{
  font-size: 3.5rem;
  margin-bottom: 10px;
}

.library-empty__title{
  color: var(--kairan);
  font-weight: 900;
  margin-bottom: 10px;
}

.library-empty__text{
  color: #4b5563;
  max-width: 680px;
  margin: 0 auto;
}

@media (max-width: 991.98px){
  .library-hero{
    padding: 20px;
  }

  .library-hero__actions{
    min-width: auto;
    width: 100%;
  }

  .library-create-btn{
    width: 100%;
  }

  
}