/**
 * ==========================================================
 * READER — Dharma / Zen
 * Basado en Flexbox. Sin header. Con panel flotante.
 * ==========================================================
 */

/* -------------------------------------------
   BASE
------------------------------------------- */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-family: var(--fuente-inter);
  background: var(--bg);
  color: var(--text-color);
  transition: background 0.6s ease, color 0.6s ease;
}
#docFrame {
  background-color: red;
  border: 1px solid red
}
/* -------------------------------------------
   MIGAS DE PAN
------------------------------------------- */
.breadcrumbs {
  margin-top: 60px;
  text-align: left;
  padding-left: 1.2rem;
  font-size: 0.9rem;
  color: var(--text-color);
  opacity: 0.8;
  letter-spacing: 0.5px;
  line-height: 1.5;
}

.breadcrumbs a {
  color: var(--color-principal);
  text-decoration: none;
  transition: color 0.3s ease;
}
.breadcrumbs a:hover { text-decoration: underline; }

/* -------------------------------------------
   CABECERA DEL MATERIAL
------------------------------------------- */
.course-header {
  /* background: #fff; */
  border-radius: 12px;
  display: flex;
  /* box-shadow: var(--shadow-soft); */
  margin: 2rem auto;
  padding: 1rem;
  width: 90vw;
  max-width: 80vw;
  transition: var(--transicion-suave);
}

.course-meta {
  display: flex;
  justify-content: space-between;

  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.autor-foto {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--color-principal);
  box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

.course-info h2 {
  margin: 0 0 0.5rem;
  font-family: var(--fuente-lora);
  color: var(--color-principal);
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  text-align: center;
  padding-bottom: 15px;
  
}

.course-info p {
  margin: 0.5rem 0;
  color: var(--text-color);
  opacity: 1;
  font-size: 0.85rem;

  font-weight: 500;
}
.course-info svg,
.course-info strong {
  color: var(--color-principal);
  padding-right: 6px;
}

.tags {
  margin-top: 1rem;
  
}
.tag {
  background: transparent;
  color: var(--color-principal);
  padding: 0.35rem 0.65rem;
  border-radius: 25px;
  margin: 0 0.6rem 0.6rem 0;
  font-size: 0.75rem;
  display: inline-block;
  border: 2px solid var(--color-principal)

}

/* -------------------------------------------
   LAYOUT PRINCIPAL
------------------------------------------- */
.course-layout {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 1.5rem;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 2rem;
  box-sizing: border-box;
}

/* -------------------------------------------
   SIDEBAR DE SESIONES
------------------------------------------- */
.sidebar {
  flex: 0 0 280px;
  background: #fff;
  border-radius: 10px;
  box-shadow: var(--shadow-soft);
  padding: 1.2rem 1rem;
  overflow-y: auto;
  max-height: calc(100vh - 160px);
  position: sticky;
  top: 100px;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.sidebar h3 {
  margin: 0;
  font-family: var(--fuente-rubik);
  color: var(--color-principal);
  font-size: 1.1rem;
  text-align: left;
  
}

.search-box input {
  width: 90%;
  padding: 0.5rem;
  border-radius: 6px;
  border: 1px dotted var(--color-principal);
  outline: none;
  font-size: 0.9rem;
}

.chapters {
  list-style: none;
  padding: 0;
  margin: 0;
}

.chapters li {
  padding: 0.9rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  line-height: 1.5;
}

.chapters li:hover {
  background: rgba(0,0,0,0.05);
}

.chapters li.active {
  background: var(--color-principal);
  color: #fff;
  font-weight: 500;
}

/* -------------------------------------------
   READER
------------------------------------------- */
.reader {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: rgba(255,255,255,0.95);
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  position: relative;
}

/* Controls */
.controls {
  display: flex;
  justify-content: center;
  align-self: center;
  flex-wrap: wrap;
  gap: 0.8rem;
  padding: 0.8rem;
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.controls button {
  display: inline-flex;      /* <-- permite alinear icono + texto en línea */
  align-items: center;       /* centra verticalmente el SVG con el texto */
  gap: 0.5rem;               /* espacio entre icono y texto */
  background: var(--color-principal);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 0.4rem 1rem;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.2s ease;
}
.controls button:hover {
  background: var(--color-principal-hover);
  transform: scale(1.05);
}
.controls button svg.icon {
  display: block;
  width: 20px;
  height: 20px;
}
/* Iframe */
#reader-container {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 70vh;
}
#docFrame {
  width: 100%;
  flex: 1;
  border: none;
  background: #fff;
  border-radius: 0 0 12px 12px;
}

/* Progress bar */
#progress-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  background: rgba(0,0,0,0.05);
  z-index: 1200;
}
#progress-bar {
  height: 5px;
  width: 0;
  background: var(--color-principal);
  transition: width .2s linear;
}

/* Floating controls */
#floating-controls {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: rgba(255,255,255,0.85);
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 10px;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  box-shadow: var(--shadow-soft);
}
#floating-controls button {
  border: none;
  background: var(--color-principal);
  color: #fff;
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  transition: background 0.3s ease;
}
#floating-controls button:hover {
  background: var(--color-principal-hover);
}

/* -------------------------------------------
   FOOTER
------------------------------------------- */
.footer.minimal {
  text-align: center;
  background: var(--bg);
  color: #666;
  padding: 0.5rem 0;
  font-size: 0.9rem;
  width: 100%;
  border-top: 1px solid rgba(0,0,0,0.05);
  margin-top: auto;
}
/* Pantalla completa simulada en iPhone/iPad */
.ios-fullscreen {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000; /* o el color del fondo del lector */
    z-index: 9999;
    overflow: auto; /* para permitir scroll interno si lo necesitas */
}
body.ios-fullscreen-active {
    overflow: hidden;
}
/* Mejora la respuesta táctil (para evitar el doble toque) */
button, svg, use {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
/* -------------------------------------------
   MODO LECTURA / HIDDEN
------------------------------------------- */
.hidden {
  display: none !important;
}

/* -------------------------------------------
   RESPONSIVE
------------------------------------------- */
@media (max-width: 900px) {
  .course-layout {
    flex-direction: column;
    padding: 1rem;
  }
  .sidebar {
    width: 100%;
    max-height: none;
    position: relative;
    top: auto;
  }
  #floating-controls {
    right: 10px;
    bottom: 10px;
  }
  .controls {
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .tags {
    display: none;
  }
  .course-info p {
    font-size: 1.2rem;
  }
}