/* libro.css — Lector libro de texto + player audiolibro + tutor IA (WP #1822/#1823) */

/* ── Player audiolibro ──────────────────────────────────────────────── */

.lp-player {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #1a1a2e;
  color: #fff;
  border-radius: 0 0 12px 12px;
  padding: 0.75rem 1rem;
  margin: 0 -1rem 1.5rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.lp-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.lp-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: #aaa;
}

.lp-btn {
  background: none;
  border: 1px solid #555;
  color: #fff;
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  font-size: 0.9rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.lp-btn:hover { border-color: #aaa; }

.lp-btn--play {
  font-size: 1.1rem;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  border-color: #888;
}

.lp-btn-text {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  color: #aaa;
  padding: 0;
}

.lp-btn-text:hover { color: #fff; }

.lp-progress-wrap {
  flex: 1;
}

.lp-progress-bar {
  height: 6px;
  background: #444;
  border-radius: 3px;
  cursor: pointer;
  position: relative;
}

.lp-progress-fill {
  height: 100%;
  background: #6c8ebf;
  border-radius: 3px;
  width: 0%;
  transition: width 0.25s linear;
}

.lp-times {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: #999;
  margin-top: 0.2rem;
}

.lp-badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  background: #333;
  color: #aaa;
}

.lp-badge--cached { background: #1a3a1a; color: #6fcf6f; }

/* Descarga progreso */

.lp-download-progress {
  margin-top: 0.5rem;
}

.lp-dl-bar {
  height: 4px;
  background: #333;
  border-radius: 2px;
}

.lp-dl-fill {
  height: 100%;
  background: #6c8ebf;
  border-radius: 2px;
  width: 0%;
  transition: width 0.1s linear;
}

.lp-dl-label {
  font-size: 0.7rem;
  color: #aaa;
  margin-top: 0.2rem;
  display: block;
}

/* ── Resaltado de párrafo activo ────────────────────────────────────── */

.lp-highlight {
  background: #FFF9C4;
  border-radius: 4px;
  padding: 0.1em 0.2em;
  margin: -0.1em -0.2em;
  transition: background 0.3s;
}

/* ── Contenedor libro ───────────────────────────────────────────────── */

/* ── Contenedor libro ───────────────────────────────────────────────── */

.libro-wrapper {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  color: #1a1a1a;
}

.libro-nav-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: #f5f5f5;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  font-weight: 600;
  color: #444;
  font-size: 0.9rem;
}

.libro-capitulo img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 1rem auto;
  display: block;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.libro-cargando,
.libro-error,
.libro-no-disponible {
  padding: 2rem;
  text-align: center;
  color: #666;
  font-style: italic;
}

/* ── Tooltip de selección ───────────────────────────────────────────── */

.libro-tutor-tooltip {
  position: absolute;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  background: #1565C0;
  color: #fff;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0,0,0,0.25);
  user-select: none;
  white-space: nowrap;
  transition: background 0.15s;
}

.libro-tutor-tooltip:hover {
  background: #0D47A1;
}

.libro-tutor-icon {
  font-size: 1rem;
}

/* ── Caja de respuesta inline ───────────────────────────────────────── */

.libro-tutor-respuesta {
  margin: 1rem 0;
  padding: 1rem 1.25rem;
  background: #FFFDE7;
  border-left: 4px solid #1565C0;
  border-radius: 0 8px 8px 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  animation: libroTutorFadeIn 0.25s ease;
  position: relative;
}

@keyframes libroTutorFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.libro-tutor-fragmento-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #1565C0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 0.25rem;
}

.libro-tutor-cita {
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.75rem;
  background: rgba(21, 101, 192, 0.06);
  border-left: 2px solid #90CAF9;
  border-radius: 0 4px 4px 0;
  font-style: italic;
  font-size: 0.9rem;
  color: #333;
}

.libro-tutor-texto {
  font-size: 0.95rem;
  line-height: 1.65;
  color: #212121;
  white-space: pre-wrap;
}

.libro-tutor-loading {
  color: #555;
  font-size: 0.9rem;
}

.libro-tutor-error {
  color: #c62828;
  font-size: 0.9rem;
  margin: 0;
}

.libro-tutor-cerrar {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  background: none;
  border: none;
  cursor: pointer;
  color: #999;
  font-size: 1rem;
  line-height: 1;
  padding: 0.25rem;
}

.libro-tutor-cerrar:hover {
  color: #333;
}
