libro-de-papel {
  display: flex;
  flex-direction: row;
  position: relative;
  height: 100%;
  width: 100%;
  overflow: hidden;
  box-sizing: border-box;
  background: var(--color-fondo, transparent);
}

hoja-de-papel {
  display: flex;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  height: 100%;
  width: max-content;
  background: var(--color-fondo);
  border: solid 1px var(--color-principal);
}

hoja-de-papel.abierto {
  width: max-content;
}

hoja-de-papel.cerrado {
  width: min-content;
}

hoja-de-papel.oculto {
  width: 24px;
}

hoja-de-papel .resumen-hoja {
  background: var(--color-fondo);
  user-select: none;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  opacity: 1;
  overflow: hidden;
  overflow: clip;
  z-index: var(--z-resumen-hoja, 10);
  min-width: max-content;
  padding: 3em 0px;
  border-right: solid 1px var(--color-principal);
  justify-content: center;
  overflow-y: scroll;
}

hoja-de-papel.oculto .resumen-hoja {
  width: 0;
}
hoja-de-papel.abierto .resumen-hoja {
}

hoja-de-papel .resumen-hoja div {
  display: flex;
  align-items: center;
  background: transparent;
  & > * {
    background: transparent;
  }
  padding: 1em;
  border-top: solid 1px var(--color-principal);
}

hoja-de-papel .resumen-hoja div:first-child {
  border-top: solid 0px var(--color-principal);
}

hoja-de-papel .resumen-hoja div.seleccionado {
  background-color: var(--color-acento, transparent);
  color: var(--color-fondo);
  & > * {
    color: var(--color-fondo);
  }
}


menu-de-papel opcion-de-papel.abierto .resumen-opcion {
  & > span.icono{
    rotate: 180deg;
  }
}

hoja-de-papel .resumen-hoja div.activo {
  background-color: var(--color-secundario, transparent);
  color: var(--color-fondo);
  & > * {
    color: var(--color-fondo);
  }

  & > span.icono{
    rotate: 180deg;
  }
}

hoja-de-papel .contenido-hoja {
  position: relative;
  background: var(--color-fondo);
  width: 0px;
  height: 100%;
  transition: width var(--transicion-normal), height var(--transicion-normal);
}

hoja-de-papel.abierto .contenido-hoja {
  padding: 2em;
  padding-right: 4em;
}

seccion-de-papel {
  position: absolute;
  display: block;
  box-sizing: border-box;
  height: 100%;
}

seccion-de-papel.seleccionada {
  width: max-content;
}

/* =================================================================
   LIBRO DE PAPEL - MÓVIL SIMPLIFICADO
   Layout vertical con todas las secciones visibles
   Sin animaciones de apertura/cierre
   ================================================================= */
@media screen and (max-width: 40em) {
  libro-de-papel {
    display: flex;
    flex-direction: column;
    position: relative;
    height: auto;
    min-height: auto;
    width: 100%;
    overflow: visible;
    box-sizing: border-box;
    background: var(--color-fondo, transparent);
  }

  hoja-de-papel {
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: visible;
    box-sizing: border-box;
    width: 100%;
    height: auto;
    background: var(--color-fondo);
    border: none;
    border-top: solid 1px var(--color-principal);
  }

  /* Estados ignorados en móvil - siempre visible */
  hoja-de-papel.abierto,
  hoja-de-papel.cerrado,
  hoja-de-papel.oculto {
    width: 100%;
    height: auto;
  }

  /* Resumen como tabs horizontales scrolleables */
  hoja-de-papel .resumen-hoja {
    background: var(--color-fondo);
    user-select: none;
    display: flex;
    flex-direction: row;
    flex-shrink: 0;
    flex-wrap: nowrap;
    opacity: 1;
    overflow-x: auto;
    overflow-y: hidden;
    z-index: var(--z-resumen-hoja, 10);
    width: 100%;
    min-height: 50px;
    height: auto;
    padding: 0;
    border-right: none;
    border-bottom: solid 1px var(--color-principal);
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  hoja-de-papel .resumen-hoja::-webkit-scrollbar {
    display: none;
  }

  hoja-de-papel.oculto .resumen-hoja {
    height: auto;
    display: flex;
  }

  hoja-de-papel .resumen-hoja div {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    flex: 0 0 auto;
    padding: var(--espacio-3, 0.75rem) var(--espacio-4, 1rem);
    border-top: none;
    border-right: solid 1px var(--color-linea-suave, rgba(0,0,0,0.1));
    white-space: nowrap;
    min-height: 44px; /* Touch target */
  }

  hoja-de-papel .resumen-hoja div:last-child {
    border-right: none;
  }

  hoja-de-papel .resumen-hoja div:first-child {
    border-top: none;
  }

  /* Contenido de hojas - siempre visible */
  hoja-de-papel .contenido-hoja {
    position: relative;
    background: var(--color-fondo);
    height: auto;
    width: 100%;
    overflow: visible;
    transition: none;
  }

  hoja-de-papel.abierto .contenido-hoja {
    padding: var(--espacio-4, 1rem);
    padding-bottom: var(--espacio-6, 1.5rem);
  }

  /* Secciones - todas visibles verticalmente */
  seccion-de-papel {
    position: relative;
    display: block;
    box-sizing: border-box;
    width: 100%;
    height: auto;
    left: 0 !important;
    top: 0 !important;
    margin-bottom: var(--espacio-6, 1.5rem);
    padding: var(--espacio-4, 1rem);
    border-bottom: solid 1px var(--color-linea-suave, rgba(0,0,0,0.1));
  }

  seccion-de-papel:last-child {
    border-bottom: none;
    margin-bottom: 0;
  }

  /* Estados ignorados - siempre visible */
  seccion-de-papel.seleccionada,
  seccion-de-papel.oculto,
  seccion-de-papel.cerrado {
    display: block;
    width: 100%;
    height: auto;
  }

  /* Sin animaciones de secciones en móvil */
  seccion-de-papel,
  hoja-de-papel,
  .resumen-hoja,
  .contenido-hoja {
    transition: none;
  }

  .seccion-animando {
    transition: none;
  }
}

/* ===== CLASES DE UTILIDAD PARA JS ===== */
.item-resumen-clickeable {
  cursor: pointer;
}

/* Clases de animación para secciones */
.seccion-animando {
  transition: left var(--transicion-normal), top var(--transicion-normal);
}

.seccion-oculta {
  transition: none;
}
